activerecord-jdbc-alt-adapter 61.0.0-java → 70.0.0.rc1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +273 -0
- data/.gitignore +1 -0
- data/Gemfile +8 -6
- data/README.md +2 -1
- data/Rakefile +1 -1
- data/activerecord-jdbc-adapter.gemspec +2 -2
- data/activerecord-jdbc-alt-adapter.gemspec +2 -2
- data/lib/arel/visitors/compat.rb +5 -33
- data/lib/arel/visitors/h2.rb +1 -13
- data/lib/arel/visitors/hsqldb.rb +1 -21
- data/lib/arel/visitors/sql_server.rb +2 -103
- data/lib/arjdbc/abstract/core.rb +8 -9
- data/lib/arjdbc/abstract/database_statements.rb +4 -4
- data/lib/arjdbc/discover.rb +0 -67
- data/lib/arjdbc/hsqldb/adapter.rb +2 -2
- data/lib/arjdbc/jdbc/adapter.rb +3 -3
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/adapter_require.rb +3 -1
- data/lib/arjdbc/jdbc/column.rb +1 -26
- data/lib/arjdbc/jdbc/type_cast.rb +2 -2
- data/lib/arjdbc/jdbc.rb +0 -7
- data/lib/arjdbc/mssql/adapter.rb +134 -105
- data/lib/arjdbc/mssql/quoting.rb +26 -27
- data/lib/arjdbc/mssql/schema_creation.rb +1 -1
- data/lib/arjdbc/mssql/schema_definitions.rb +32 -17
- data/lib/arjdbc/mssql/schema_dumper.rb +13 -1
- data/lib/arjdbc/mssql/schema_statements.rb +61 -36
- data/lib/arjdbc/mssql/transaction.rb +2 -2
- data/lib/arjdbc/mssql/types/date_and_time_types.rb +6 -6
- data/lib/arjdbc/mssql/types/numeric_types.rb +2 -2
- data/lib/arjdbc/mssql.rb +1 -1
- data/lib/arjdbc/mysql/adapter.rb +2 -1
- data/lib/arjdbc/oracle/adapter.rb +4 -23
- data/lib/arjdbc/postgresql/adapter.rb +64 -1
- data/lib/arjdbc/postgresql/oid_types.rb +68 -47
- data/lib/arjdbc/sqlite3/adapter.rb +132 -88
- data/lib/arjdbc/tasks/database_tasks.rb +0 -12
- data/lib/arjdbc/util/serialized_attributes.rb +0 -22
- data/lib/arjdbc/util/table_copier.rb +2 -1
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/02-test.rake +3 -18
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +17 -2
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +14 -1
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +33 -0
- metadata +8 -40
- data/lib/active_record/connection_adapters/as400_adapter.rb +0 -2
- data/lib/active_record/connection_adapters/db2_adapter.rb +0 -1
- data/lib/active_record/connection_adapters/derby_adapter.rb +0 -1
- data/lib/active_record/connection_adapters/informix_adapter.rb +0 -1
- data/lib/arel/visitors/db2.rb +0 -137
- data/lib/arel/visitors/derby.rb +0 -112
- data/lib/arel/visitors/firebird.rb +0 -79
- data/lib/arjdbc/db2/adapter.rb +0 -808
- data/lib/arjdbc/db2/as400.rb +0 -142
- data/lib/arjdbc/db2/column.rb +0 -131
- data/lib/arjdbc/db2/connection_methods.rb +0 -48
- data/lib/arjdbc/db2.rb +0 -4
- data/lib/arjdbc/derby/active_record_patch.rb +0 -13
- data/lib/arjdbc/derby/adapter.rb +0 -521
- data/lib/arjdbc/derby/connection_methods.rb +0 -20
- data/lib/arjdbc/derby/schema_creation.rb +0 -15
- data/lib/arjdbc/derby.rb +0 -3
- data/lib/arjdbc/firebird/adapter.rb +0 -413
- data/lib/arjdbc/firebird/connection_methods.rb +0 -23
- data/lib/arjdbc/firebird.rb +0 -4
- data/lib/arjdbc/informix/adapter.rb +0 -139
- data/lib/arjdbc/informix/connection_methods.rb +0 -9
- data/lib/arjdbc/sybase/adapter.rb +0 -47
- data/lib/arjdbc/sybase.rb +0 -2
- data/lib/arjdbc/tasks/db2_database_tasks.rb +0 -104
- data/lib/arjdbc/tasks/derby_database_tasks.rb +0 -95
- data/src/java/arjdbc/derby/DerbyModule.java +0 -178
- data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +0 -152
- data/src/java/arjdbc/firebird/FirebirdRubyJdbcConnection.java +0 -174
- data/src/java/arjdbc/informix/InformixRubyJdbcConnection.java +0 -75
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbc-alt-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 70.0.0.rc1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Nick Sieger, Ola Bini, Karol Bucek, Jesse Chavez, and JRuby contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
18
|
+
version: 7.0.0
|
19
19
|
name: activerecord
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.0.0
|
27
27
|
description: 'Fork of the ActiveRecord JDBC adapter with support for SQL Server and
|
28
28
|
Azure SQL, for more information and help look at the README file in the github repository.
|
29
29
|
AR-JDBC is a database adapter for Rails'' ActiveRecord component designed to be
|
@@ -38,6 +38,7 @@ executables: []
|
|
38
38
|
extensions: []
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
|
+
- ".github/workflows/ruby.yml"
|
41
42
|
- ".gitignore"
|
42
43
|
- ".nvimlog"
|
43
44
|
- ".travis.yml"
|
@@ -52,13 +53,9 @@ files:
|
|
52
53
|
- Rakefile.jdbc
|
53
54
|
- activerecord-jdbc-adapter.gemspec
|
54
55
|
- activerecord-jdbc-alt-adapter.gemspec
|
55
|
-
- lib/active_record/connection_adapters/as400_adapter.rb
|
56
|
-
- lib/active_record/connection_adapters/db2_adapter.rb
|
57
|
-
- lib/active_record/connection_adapters/derby_adapter.rb
|
58
56
|
- lib/active_record/connection_adapters/firebird_adapter.rb
|
59
57
|
- lib/active_record/connection_adapters/h2_adapter.rb
|
60
58
|
- lib/active_record/connection_adapters/hsqldb_adapter.rb
|
61
|
-
- lib/active_record/connection_adapters/informix_adapter.rb
|
62
59
|
- lib/active_record/connection_adapters/jdbc_adapter.rb
|
63
60
|
- lib/active_record/connection_adapters/jndi_adapter.rb
|
64
61
|
- lib/active_record/connection_adapters/mariadb_adapter.rb
|
@@ -71,9 +68,6 @@ files:
|
|
71
68
|
- lib/activerecord-jdbc-adapter.rb
|
72
69
|
- lib/activerecord-jdbc-alt-adapter.rb
|
73
70
|
- lib/arel/visitors/compat.rb
|
74
|
-
- lib/arel/visitors/db2.rb
|
75
|
-
- lib/arel/visitors/derby.rb
|
76
|
-
- lib/arel/visitors/firebird.rb
|
77
71
|
- lib/arel/visitors/h2.rb
|
78
72
|
- lib/arel/visitors/hsqldb.rb
|
79
73
|
- lib/arel/visitors/postgresql_jdbc.rb
|
@@ -86,20 +80,7 @@ files:
|
|
86
80
|
- lib/arjdbc/abstract/database_statements.rb
|
87
81
|
- lib/arjdbc/abstract/statement_cache.rb
|
88
82
|
- lib/arjdbc/abstract/transaction_support.rb
|
89
|
-
- lib/arjdbc/db2.rb
|
90
|
-
- lib/arjdbc/db2/adapter.rb
|
91
|
-
- lib/arjdbc/db2/as400.rb
|
92
|
-
- lib/arjdbc/db2/column.rb
|
93
|
-
- lib/arjdbc/db2/connection_methods.rb
|
94
|
-
- lib/arjdbc/derby.rb
|
95
|
-
- lib/arjdbc/derby/active_record_patch.rb
|
96
|
-
- lib/arjdbc/derby/adapter.rb
|
97
|
-
- lib/arjdbc/derby/connection_methods.rb
|
98
|
-
- lib/arjdbc/derby/schema_creation.rb
|
99
83
|
- lib/arjdbc/discover.rb
|
100
|
-
- lib/arjdbc/firebird.rb
|
101
|
-
- lib/arjdbc/firebird/adapter.rb
|
102
|
-
- lib/arjdbc/firebird/connection_methods.rb
|
103
84
|
- lib/arjdbc/h2.rb
|
104
85
|
- lib/arjdbc/h2/adapter.rb
|
105
86
|
- lib/arjdbc/h2/connection_methods.rb
|
@@ -109,8 +90,6 @@ files:
|
|
109
90
|
- lib/arjdbc/hsqldb/explain_support.rb
|
110
91
|
- lib/arjdbc/hsqldb/schema_creation.rb
|
111
92
|
- lib/arjdbc/informix.rb
|
112
|
-
- lib/arjdbc/informix/adapter.rb
|
113
|
-
- lib/arjdbc/informix/connection_methods.rb
|
114
93
|
- lib/arjdbc/jdbc.rb
|
115
94
|
- lib/arjdbc/jdbc/adapter.rb
|
116
95
|
- lib/arjdbc/jdbc/adapter_java.jar
|
@@ -173,13 +152,9 @@ files:
|
|
173
152
|
- lib/arjdbc/sqlite3.rb
|
174
153
|
- lib/arjdbc/sqlite3/adapter.rb
|
175
154
|
- lib/arjdbc/sqlite3/connection_methods.rb
|
176
|
-
- lib/arjdbc/sybase.rb
|
177
|
-
- lib/arjdbc/sybase/adapter.rb
|
178
155
|
- lib/arjdbc/tasks.rb
|
179
156
|
- lib/arjdbc/tasks/database_tasks.rb
|
180
157
|
- lib/arjdbc/tasks/databases.rake
|
181
|
-
- lib/arjdbc/tasks/db2_database_tasks.rb
|
182
|
-
- lib/arjdbc/tasks/derby_database_tasks.rb
|
183
158
|
- lib/arjdbc/tasks/h2_database_tasks.rb
|
184
159
|
- lib/arjdbc/tasks/hsqldb_database_tasks.rb
|
185
160
|
- lib/arjdbc/tasks/jdbc_database_tasks.rb
|
@@ -206,13 +181,9 @@ files:
|
|
206
181
|
- src/java/arjdbc/ArJdbcModule.java
|
207
182
|
- src/java/arjdbc/db2/DB2Module.java
|
208
183
|
- src/java/arjdbc/db2/DB2RubyJdbcConnection.java
|
209
|
-
- src/java/arjdbc/derby/DerbyModule.java
|
210
|
-
- src/java/arjdbc/derby/DerbyRubyJdbcConnection.java
|
211
|
-
- src/java/arjdbc/firebird/FirebirdRubyJdbcConnection.java
|
212
184
|
- src/java/arjdbc/h2/H2Module.java
|
213
185
|
- src/java/arjdbc/h2/H2RubyJdbcConnection.java
|
214
186
|
- src/java/arjdbc/hsqldb/HSQLDBModule.java
|
215
|
-
- src/java/arjdbc/informix/InformixRubyJdbcConnection.java
|
216
187
|
- src/java/arjdbc/jdbc/AdapterJavaService.java
|
217
188
|
- src/java/arjdbc/jdbc/Callable.java
|
218
189
|
- src/java/arjdbc/jdbc/ConnectionFactory.java
|
@@ -250,9 +221,6 @@ post_install_message:
|
|
250
221
|
rdoc_options:
|
251
222
|
- "--main"
|
252
223
|
- README.md
|
253
|
-
- "-HN"
|
254
|
-
- "-f"
|
255
|
-
- darkfish
|
256
224
|
require_paths:
|
257
225
|
- lib
|
258
226
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -262,11 +230,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
230
|
version: '0'
|
263
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
232
|
requirements:
|
265
|
-
- - "
|
233
|
+
- - ">"
|
266
234
|
- !ruby/object:Gem::Version
|
267
|
-
version:
|
235
|
+
version: 1.3.1
|
268
236
|
requirements: []
|
269
|
-
rubygems_version: 3.
|
237
|
+
rubygems_version: 3.3.25
|
270
238
|
signing_key:
|
271
239
|
specification_version: 4
|
272
240
|
summary: ActiveRecord JDBC adapter, for use within JRuby on Rails and SQL Server
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'arjdbc/db2'
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'arjdbc/derby'
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'arjdbc/informix'
|
data/lib/arel/visitors/db2.rb
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
# NOTE: file contains code adapted from **ruby-ibmdb**'s adapter, license follows
|
2
|
-
=begin
|
3
|
-
Copyright (c) 2006 - 2015 IBM Corporation
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
-
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
-
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
10
|
-
=end
|
11
|
-
|
12
|
-
require 'arel/visitors/compat'
|
13
|
-
|
14
|
-
module Arel
|
15
|
-
module Visitors
|
16
|
-
class DB2 < Arel::Visitors::ToSql
|
17
|
-
|
18
|
-
if ArJdbc::AR42
|
19
|
-
def visit_Arel_Nodes_SelectStatement(o, a = nil)
|
20
|
-
a = o.cores.inject(a) { |c, x| visit_Arel_Nodes_SelectCore(x, c) }
|
21
|
-
|
22
|
-
unless o.orders.empty?
|
23
|
-
a << ' ORDER BY '
|
24
|
-
last = o.orders.length - 1
|
25
|
-
o.orders.each_with_index do |x, i|
|
26
|
-
visit(x, a); a << ', ' unless last == i
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
if limit = o.limit
|
31
|
-
if limit = limit.value
|
32
|
-
limit = limit.to_i
|
33
|
-
end
|
34
|
-
end
|
35
|
-
if offset = o.offset
|
36
|
-
if offset = offset.value
|
37
|
-
offset = offset.to_i
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
if limit || offset
|
42
|
-
add_limit_offset(a, o, limit, offset)
|
43
|
-
else
|
44
|
-
a
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def visit_Arel_Nodes_Limit o, collector
|
49
|
-
# visit o.expr, collector
|
50
|
-
end
|
51
|
-
|
52
|
-
def visit_Arel_Nodes_Offset o, collector
|
53
|
-
# visit o.expr, collector
|
54
|
-
end
|
55
|
-
|
56
|
-
else
|
57
|
-
def visit_Arel_Nodes_SelectStatement o, a = nil
|
58
|
-
sql = o.cores.map { |x| do_visit_select_core x, a }.join
|
59
|
-
sql << " ORDER BY #{o.orders.map { |x| do_visit x, a }.join(', ')}" unless o.orders.empty?
|
60
|
-
|
61
|
-
if limit = o.limit
|
62
|
-
if limit = limit.value
|
63
|
-
limit = limit.to_i
|
64
|
-
end
|
65
|
-
end
|
66
|
-
if offset = o.offset
|
67
|
-
if offset = offset.value
|
68
|
-
offset = offset.to_i
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
if limit || offset
|
73
|
-
add_limit_offset(sql, o, limit, offset)
|
74
|
-
else
|
75
|
-
sql
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
if ArJdbc::AR42
|
81
|
-
def visit_Arel_Nodes_InsertStatement o, a = nil
|
82
|
-
a << "INSERT INTO "
|
83
|
-
visit(o.relation, a)
|
84
|
-
|
85
|
-
values = o.values
|
86
|
-
|
87
|
-
if o.columns.any?
|
88
|
-
cols = o.columns.map { |x| quote_column_name x.name }
|
89
|
-
a << ' (' << cols.join(', ') << ') '
|
90
|
-
elsif o.values.eql? ArJdbc::DB2::VALUES_DEFAULT
|
91
|
-
cols = o.relation.engine.columns.map { |c| c.name }
|
92
|
-
a << ' (' << cols.join(', ') << ')'
|
93
|
-
a << ' VALUES '
|
94
|
-
a << ' (' << cols.map { 'DEFAULT' }.join(', ') << ')'
|
95
|
-
values = false
|
96
|
-
end
|
97
|
-
visit(values, a) if values
|
98
|
-
a
|
99
|
-
end
|
100
|
-
elsif Arel::VERSION >= '4.0' # AR 4.0 ... AREL 5.0 since AR >= 4.1
|
101
|
-
def visit_Arel_Nodes_InsertStatement o, a = nil
|
102
|
-
sql = "INSERT INTO "
|
103
|
-
sql << visit(o.relation, a)
|
104
|
-
|
105
|
-
values = o.values
|
106
|
-
|
107
|
-
if o.columns.any?
|
108
|
-
cols = o.columns.map { |x| quote_column_name x.name }
|
109
|
-
sql << ' (' << cols.join(', ') << ') '
|
110
|
-
# should depend the other way around but who cares it's AR
|
111
|
-
elsif o.values.eql? ArJdbc::DB2::VALUES_DEFAULT
|
112
|
-
cols = o.relation.engine.columns.map { |c| c.name }
|
113
|
-
sql << ' (' << cols.join(', ') << ')'
|
114
|
-
sql << ' VALUES '
|
115
|
-
sql << ' (' << cols.map { 'DEFAULT' }.join(', ') << ')'
|
116
|
-
values = nil
|
117
|
-
end
|
118
|
-
|
119
|
-
sql << visit(values, a) if values
|
120
|
-
|
121
|
-
sql
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
private
|
126
|
-
|
127
|
-
def add_limit_offset(sql, o, limit, offset)
|
128
|
-
@connection.replace_limit_offset! sql, limit, offset, o.orders
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
Arel::Collectors::Bind.class_eval do
|
136
|
-
attr_reader :parts
|
137
|
-
end if defined? Arel::Collectors::Bind
|
data/lib/arel/visitors/derby.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'arel/visitors/compat'
|
2
|
-
|
3
|
-
module Arel
|
4
|
-
module Visitors
|
5
|
-
class Derby < Arel::Visitors::ToSql
|
6
|
-
|
7
|
-
# @private
|
8
|
-
STR_1 = ' '
|
9
|
-
|
10
|
-
if ArJdbc::AR42
|
11
|
-
def visit_Arel_Nodes_SelectStatement(o, a = nil)
|
12
|
-
a = o.cores.inject(a) { |c, x| visit_Arel_Nodes_SelectCore(x, c) }
|
13
|
-
unless o.orders.empty?
|
14
|
-
a << ' ORDER BY '
|
15
|
-
last = o.orders.length - 1
|
16
|
-
o.orders.each_with_index do |x, i|
|
17
|
-
visit(x, a); a << ', ' unless last == i
|
18
|
-
end
|
19
|
-
end
|
20
|
-
if o.offset
|
21
|
-
a << STR_1; visit(o.offset, a)
|
22
|
-
end
|
23
|
-
if o.limit
|
24
|
-
a << STR_1; visit(o.limit, a)
|
25
|
-
end
|
26
|
-
if o.lock
|
27
|
-
a << STR_1; visit(o.lock, a)
|
28
|
-
end
|
29
|
-
a
|
30
|
-
end
|
31
|
-
else
|
32
|
-
def visit_Arel_Nodes_SelectStatement(o, a = nil)
|
33
|
-
sql = o.cores.map { |x| do_visit(x, a) }.join
|
34
|
-
sql << " ORDER BY #{o.orders.map { |x| do_visit x, a }.join(', ')}" unless o.orders.empty?
|
35
|
-
sql << " #{do_visit o.offset, a}" if o.offset
|
36
|
-
sql << " #{do_visit o.limit, a}" if o.limit
|
37
|
-
sql << " #{do_visit o.lock, a}" if o.lock
|
38
|
-
sql
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def visit_Arel_Nodes_Limit(o, a = nil)
|
43
|
-
limit = "FETCH FIRST #{limit_for(o)} ROWS ONLY"
|
44
|
-
a << limit if a
|
45
|
-
limit
|
46
|
-
end
|
47
|
-
|
48
|
-
def visit_Arel_Nodes_Offset(o, a = nil)
|
49
|
-
if a
|
50
|
-
a << 'OFFSET '
|
51
|
-
do_visit(o.value, a)
|
52
|
-
a << ' ROWS'
|
53
|
-
else
|
54
|
-
"OFFSET #{do_visit o.value, a} ROWS"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# This generates SELECT...FOR UPDATE, but it will only work if the
|
59
|
-
# current transaction isolation level is set to SERIALIZABLE. Otherwise,
|
60
|
-
# locks aren't held for the entire transaction.
|
61
|
-
def visit_Arel_Nodes_Lock o, a = nil
|
62
|
-
do_visit o.expr, a
|
63
|
-
end
|
64
|
-
|
65
|
-
# @private
|
66
|
-
VALUES_DEFAULT = 'VALUES ( DEFAULT )' # NOTE: marker set by ArJdbc::Derby
|
67
|
-
|
68
|
-
if ArJdbc::AR42
|
69
|
-
def visit_Arel_Nodes_InsertStatement o, a = nil
|
70
|
-
a << "INSERT INTO "
|
71
|
-
visit(o.relation, a)
|
72
|
-
|
73
|
-
values = o.values
|
74
|
-
|
75
|
-
if o.columns.any?
|
76
|
-
cols = o.columns.map { |x| quote_column_name x.name }
|
77
|
-
a << ' (' << cols.join(', ') << ') '
|
78
|
-
elsif o.values.eql? VALUES_DEFAULT
|
79
|
-
cols = o.relation.engine.columns.map { |c| c.name }
|
80
|
-
a << ' (' << cols.join(', ') << ')'
|
81
|
-
a << ' VALUES '
|
82
|
-
a << ' (' << cols.map { 'DEFAULT' }.join(', ') << ')'
|
83
|
-
values = false
|
84
|
-
end
|
85
|
-
visit(values, a) if values
|
86
|
-
a
|
87
|
-
end
|
88
|
-
elsif Arel::VERSION >= '4.0' # AR 4.0 ... AREL 5.0 since AR >= 4.1
|
89
|
-
def visit_Arel_Nodes_InsertStatement o, a = nil
|
90
|
-
sql = 'INSERT INTO '
|
91
|
-
sql << visit(o.relation, a)
|
92
|
-
|
93
|
-
values = o.values
|
94
|
-
|
95
|
-
if o.columns.any?
|
96
|
-
cols = o.columns.map { |x| quote_column_name x.name }
|
97
|
-
sql << ' (' << cols.join(', ') << ') '
|
98
|
-
elsif o.values.eql? VALUES_DEFAULT
|
99
|
-
cols = o.relation.engine.columns.map { |c| c.name }
|
100
|
-
sql << ' (' << cols.join(', ') << ')'
|
101
|
-
sql << ' VALUES '
|
102
|
-
sql << ' (' << cols.map { 'DEFAULT' }.join(', ') << ')'
|
103
|
-
values = false
|
104
|
-
end
|
105
|
-
|
106
|
-
sql << visit(values, a) if values
|
107
|
-
sql
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'arel/visitors/compat'
|
2
|
-
|
3
|
-
module Arel
|
4
|
-
module Visitors
|
5
|
-
class Firebird < Arel::Visitors::ToSql
|
6
|
-
|
7
|
-
if ArJdbc::AR42
|
8
|
-
def visit_Arel_Nodes_SelectStatement(o, a)
|
9
|
-
a = o.cores.inject(a) { |c, x| visit_Arel_Nodes_SelectCore(x, c) }
|
10
|
-
|
11
|
-
limit, offset = o.limit, o.offset
|
12
|
-
if limit || offset
|
13
|
-
select = a.parts[0]
|
14
|
-
|
15
|
-
sql = Arel::Collectors::SQLString.new
|
16
|
-
visit(limit, sql) if limit
|
17
|
-
if offset
|
18
|
-
sql << ' ' if limit
|
19
|
-
visit(offset, sql)
|
20
|
-
end
|
21
|
-
|
22
|
-
a.parts[0] = "#{select} #{sql.value}"
|
23
|
-
end
|
24
|
-
|
25
|
-
unless o.orders.empty?
|
26
|
-
a << ' ORDER BY '
|
27
|
-
last = o.orders.length - 1
|
28
|
-
o.orders.each_with_index do |x, i|
|
29
|
-
visit(x, a); a << ', ' unless last == i
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
a
|
34
|
-
end
|
35
|
-
|
36
|
-
def visit_Arel_Nodes_Limit(o, a)
|
37
|
-
a << "FIRST #{limit_for(o)}"
|
38
|
-
end
|
39
|
-
|
40
|
-
def visit_Arel_Nodes_Offset(o, a)
|
41
|
-
a << 'SKIP '; visit(o.value, a)
|
42
|
-
end
|
43
|
-
|
44
|
-
else
|
45
|
-
|
46
|
-
def visit_Arel_Nodes_SelectStatement o, a = nil
|
47
|
-
if o.limit
|
48
|
-
limit = do_visit o.limit.expr, a
|
49
|
-
else
|
50
|
-
limit = nil
|
51
|
-
end
|
52
|
-
if o.offset
|
53
|
-
offset = do_visit o.offset.expr, a
|
54
|
-
else
|
55
|
-
offset = nil
|
56
|
-
end
|
57
|
-
|
58
|
-
sql = o.cores.map { |x| do_visit_select_core x, a }.join
|
59
|
-
@connection.insert_limit_offset!(sql, limit, offset) if limit || offset
|
60
|
-
|
61
|
-
unless o.orders.empty?
|
62
|
-
sql << ' ORDER BY '
|
63
|
-
last = o.orders.length - 1
|
64
|
-
o.orders.each_with_index do |x, i|
|
65
|
-
sql << do_visit(x, a); sql << ', ' unless last == i
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
sql
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
Arel::Collectors::Bind.class_eval do
|
78
|
-
attr_reader :parts
|
79
|
-
end if defined? Arel::Collectors::Bind
|