activerecord-cubrid2-adapter 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66a82d90a133133ed00cd25820b12a40df63021603d080cf1670e9d440b20e78
4
- data.tar.gz: 22a8b40fa849ed6bba01660a850a6603b1914e183357367d3d44f60f13862a13
3
+ metadata.gz: 9e8634b1c39dd11d4694db73f13bf36b5f94a3a976f9d326dbffc5ce8e9145c2
4
+ data.tar.gz: aad71acada082d9f3ddd1d7e339d4db8d6d6a7644824705daebed134d5c0f104
5
5
  SHA512:
6
- metadata.gz: 8e52dd2b5fb04ac6da7b6dd34cf251a0fecfeb415e1675f1979316eee291f3570579bfeb624a00eaead3184af9b79bf5a4d46bd4bf2a1e813ba11a5887312007
7
- data.tar.gz: 07d2b7cbdde814f729cbf8e2559bb1797985f844f5598eb5bbc85cfffad8f9546bf991f70afd4ae07d841c78cbf59d602e22657421f9da4acfa4b7efb51931c0
6
+ metadata.gz: ec45cc833218ea9b5193fecbeb27a3aacb85795a7a4a5495fb53ec7f73f8ebeb71a4589e55625222c5c69fe5d9684a964b86d9081c0353fe88e4581d5713f095
7
+ data.tar.gz: 96882f548af718500348c060af3ab9563f04a504af3414304965e109abd7ab7896e442c815a7166c169298ae71eb62872bbb4d7f7e27d12a4267d26e572aca59
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -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
- build_result(columns: columns, rows: rows)
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,21 @@ module ActiveRecord
26
26
  end
27
27
 
28
28
  def visit_CreateIndexDefinition(o)
29
- sql = visit_IndexDefinition(o.index, true)
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 && "UNIQUE"
33
+ index_type = o.type&.to_s&.upcase || o.unique && 'UNIQUE'
35
34
 
36
- sql = create ? ["CREATE"] : []
35
+ sql = create ? ['CREATE'] : []
37
36
  sql << index_type if index_type
38
- sql << "INDEX"
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
41
  sql << "(#{quoted_columns(o)})"
43
42
 
44
- add_sql_comment!(sql.join(" "), o.comment)
43
+ add_sql_comment!(sql.join(' '), o.comment)
45
44
  end
46
45
 
47
46
  def add_table_options!(create_sql, options)
@@ -57,15 +56,15 @@ module ActiveRecord
57
56
  sql << ' NULL'
58
57
  end
59
58
 
60
- if charset = options[:charset]
59
+ if (charset = options[:charset])
61
60
  sql << " CHARSET #{charset}"
62
61
  end
63
62
 
64
- if collation = options[:collation]
63
+ if (collation = options[:collation])
65
64
  sql << " COLLATE #{collation}"
66
65
  end
67
66
 
68
- if as = options[:as]
67
+ if (as = options[:as])
69
68
  sql << " AS (#{as})"
70
69
  end
71
70
 
@@ -83,14 +82,21 @@ module ActiveRecord
83
82
  end
84
83
 
85
84
  def index_in_create(table_name, column_name, options)
86
- index_def, algorithm, if_not_exists = @conn.add_index_options(table_name, column_name, **options)
87
- index_name = index_def.name
88
- index_columns = index_def.columns.map { |x| quote_column_name(x) }.join(', ')
89
- index_type = index_def.unique ? 'UNIQUE' : ''
90
- comment = index_def.comment
91
- add_sql_comment!(
92
- +"#{index_type} INDEX #{quote_column_name(index_name)} (#{index_columns})", comment
93
- )
85
+ if ActiveRecord.version.to_s >= '6.1.0'
86
+ # for activerecord >= 6.1
87
+ index_def, algorithm, if_not_exists = @conn.add_index_options(table_name, column_name, **options)
88
+
89
+ index_name = index_def.name
90
+ index_columns = index_def.columns.map { |x| quote_column_name(x) }.join(', ')
91
+ index_type = index_def.unique ? 'UNIQUE' : ''
92
+ comment = index_def.comment
93
+ else
94
+ # for activerecord == 6.0
95
+ index_name, index_type, index_columns, _, _, index_using, comment =
96
+ @conn.add_index_options(table_name, column_name, **options)
97
+ end
98
+
99
+ add_sql_comment!(+"#{index_type} INDEX #{quote_column_name(index_name)} (#{index_columns})", comment)
94
100
  end
95
101
  end
96
102
  end
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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eui-Taik Na