activerecord-cubrid2-adapter 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/abstract_cubrid2_adapter.rb +2 -0
- data/lib/active_record/connection_adapters/cubrid2/database_statements.rb +4 -1
- data/lib/active_record/connection_adapters/cubrid2/schema_creation.rb +24 -20
- data/lib/active_record/connection_adapters/cubrid2/schema_statements.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb5f0b9e757c88be9651a7fec3f108efbf54ad4c0bc7d6394c88a515691620f9
|
4
|
+
data.tar.gz: ae0a80d45a7ad82610a9c571e7e888758b796ce915df58f6aae168b4ed4b3dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73b48aa18376691eb9d56f087e03e7b9d7943835fe2d405f37b946dec10e6b863a81c5698561be44da39fe5f989ab6f07ca3d7c4a41f6f76572e60d6033eae2
|
7
|
+
data.tar.gz: f31316136f7f417d7eb9874f639b51a38acaa55164ee23f800437cc4ab54ab7cc2c8aeb4bbd32ac69ff54ab4733f671c74149932a0cdc41fa9b180aaa321751c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -80,7 +80,10 @@ module ActiveRecord
|
|
80
80
|
def _build_stmt_result(stmt)
|
81
81
|
columns = stmt.column_info.map { |col| col['name'] }
|
82
82
|
rows = is_conn_utf8? ? _extract_rows_from_stmt__utf8(stmt) : _extract_rows_from_stmt__raw(stmt)
|
83
|
-
|
83
|
+
|
84
|
+
# build_result(columns: columns, rows: rows)
|
85
|
+
# for activerecord <= 6.0
|
86
|
+
ActiveRecord::Result.new(columns, rows, column_types = {})
|
84
87
|
end
|
85
88
|
|
86
89
|
def _extract_rows_from_stmt__raw(stmt, as_hash: false)
|
@@ -26,22 +26,20 @@ module ActiveRecord
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def visit_CreateIndexDefinition(o)
|
29
|
-
|
30
|
-
sql
|
29
|
+
visit_IndexDefinition(o.index, true)
|
31
30
|
end
|
32
31
|
|
33
32
|
def visit_IndexDefinition(o, create = false)
|
34
|
-
index_type = o.type&.to_s&.upcase || o.unique &&
|
33
|
+
index_type = o.type&.to_s&.upcase || o.unique && 'UNIQUE'
|
35
34
|
|
36
|
-
sql = create ? [
|
35
|
+
sql = create ? ['CREATE'] : []
|
37
36
|
sql << index_type if index_type
|
38
|
-
sql <<
|
37
|
+
sql << 'INDEX'
|
39
38
|
sql << quote_column_name(o.name)
|
40
|
-
#sql << "USING #{o.using}" if o.using
|
39
|
+
# sql << "USING #{o.using}" if o.using
|
41
40
|
sql << "ON #{quote_table_name(o.table)}" if create
|
42
|
-
sql << "(
|
43
|
-
|
44
|
-
add_sql_comment!(sql.join(" "), o.comment)
|
41
|
+
sql << "(" + o.columns.map { |c| quote_column_name(c) }.join(', ') +")"
|
42
|
+
add_sql_comment!(sql.join(' '), o.comment)
|
45
43
|
end
|
46
44
|
|
47
45
|
def add_table_options!(create_sql, options)
|
@@ -57,15 +55,15 @@ module ActiveRecord
|
|
57
55
|
sql << ' NULL'
|
58
56
|
end
|
59
57
|
|
60
|
-
if charset = options[:charset]
|
58
|
+
if (charset = options[:charset])
|
61
59
|
sql << " CHARSET #{charset}"
|
62
60
|
end
|
63
61
|
|
64
|
-
if collation = options[:collation]
|
62
|
+
if (collation = options[:collation])
|
65
63
|
sql << " COLLATE #{collation}"
|
66
64
|
end
|
67
65
|
|
68
|
-
if as = options[:as]
|
66
|
+
if (as = options[:as])
|
69
67
|
sql << " AS (#{as})"
|
70
68
|
end
|
71
69
|
|
@@ -83,14 +81,20 @@ module ActiveRecord
|
|
83
81
|
end
|
84
82
|
|
85
83
|
def index_in_create(table_name, column_name, options)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
84
|
+
if ActiveRecord.version.to_s >= '6.1.0'
|
85
|
+
# for activerecord >= 6.1
|
86
|
+
index_def, algorithm, if_not_exists = @conn.add_index_options(table_name, column_name, **options)
|
87
|
+
|
88
|
+
index_name = index_def.name
|
89
|
+
index_columns = index_def.columns.map { |x| quote_column_name(x) }.join(', ')
|
90
|
+
index_type = index_def.unique ? 'UNIQUE' : ''
|
91
|
+
comment = index_def.comment
|
92
|
+
else
|
93
|
+
# for activerecord == 6.0
|
94
|
+
index_name, index_type, index_columns, _, _, index_using, comment =
|
95
|
+
@conn.add_index_options(table_name, column_name, **options)
|
96
|
+
end
|
97
|
+
add_sql_comment!(+"#{index_type} INDEX #{quote_column_name(index_name)} (#{index_columns})", comment)
|
94
98
|
end
|
95
99
|
end
|
96
100
|
end
|
@@ -55,7 +55,7 @@ module ActiveRecord
|
|
55
55
|
indexes.map do |index|
|
56
56
|
options = index.pop
|
57
57
|
|
58
|
-
if expressions = options.delete(:expressions)
|
58
|
+
if (expressions = options.delete(:expressions))
|
59
59
|
orders = options.delete(:orders)
|
60
60
|
lengths = options.delete(:lengths)
|
61
61
|
|
@@ -101,13 +101,13 @@ module ActiveRecord
|
|
101
101
|
def type_to_sql(type, limit: nil,
|
102
102
|
precision: nil, scale: nil,
|
103
103
|
size: limit_to_size(limit, type),
|
104
|
-
unsigned: nil, **)
|
104
|
+
unsigned: nil, **options)
|
105
105
|
|
106
106
|
case type.to_s
|
107
107
|
when 'integer'
|
108
108
|
integer_to_sql(limit)
|
109
109
|
when 'serial'
|
110
|
-
integer_to_sql(8) #bigint
|
110
|
+
integer_to_sql(8) # bigint
|
111
111
|
when 'float', 'real', 'double', 'double precision'
|
112
112
|
float_to_sql(limit)
|
113
113
|
when 'text', 'string', 'varchar', 'char varing'
|
@@ -118,6 +118,8 @@ module ActiveRecord
|
|
118
118
|
type_with_size_to_sql('blob', size)
|
119
119
|
when 'clob'
|
120
120
|
type_with_size_to_sql('clob', size)
|
121
|
+
when 'boolean'
|
122
|
+
type_with_size_to_sql('boolean', size)
|
121
123
|
when 'nchar', 'nchar varing'
|
122
124
|
raise 'Not supported from cubrid 9.0'
|
123
125
|
else
|
@@ -235,6 +237,8 @@ module ActiveRecord
|
|
235
237
|
'blob'
|
236
238
|
when 'clob'
|
237
239
|
'clob'
|
240
|
+
when 'boolean'
|
241
|
+
'smallint'
|
238
242
|
end
|
239
243
|
end
|
240
244
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cubrid2-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eui-Taik Na
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.4.1
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: ActiveRecord Cubrid Adapter.
|