activerecord-jdbc-adapter 70.0.pre-java → 70.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/activerecord-jdbc-adapter.gemspec +1 -3
  4. data/lib/arel/visitors/compat.rb +5 -33
  5. data/lib/arel/visitors/h2.rb +1 -13
  6. data/lib/arel/visitors/hsqldb.rb +1 -21
  7. data/lib/arel/visitors/sql_server.rb +2 -103
  8. data/lib/arjdbc/abstract/core.rb +8 -9
  9. data/lib/arjdbc/abstract/database_statements.rb +8 -0
  10. data/lib/arjdbc/discover.rb +0 -67
  11. data/lib/arjdbc/jdbc/adapter.rb +1 -1
  12. data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
  13. data/lib/arjdbc/jdbc/column.rb +1 -26
  14. data/lib/arjdbc/jdbc.rb +0 -7
  15. data/lib/arjdbc/mysql/adapter.rb +2 -1
  16. data/lib/arjdbc/mysql/connection_methods.rb +43 -42
  17. data/lib/arjdbc/oracle/adapter.rb +4 -23
  18. data/lib/arjdbc/postgresql/adapter.rb +152 -3
  19. data/lib/arjdbc/postgresql/oid_types.rb +155 -108
  20. data/lib/arjdbc/sqlite3/adapter.rb +54 -36
  21. data/lib/arjdbc/tasks/database_tasks.rb +0 -15
  22. data/lib/arjdbc/util/serialized_attributes.rb +0 -22
  23. data/lib/arjdbc/util/table_copier.rb +2 -1
  24. data/lib/arjdbc/version.rb +1 -1
  25. data/rakelib/02-test.rake +3 -18
  26. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +1 -1
  27. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +5 -0
  28. data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +6 -1
  29. metadata +6 -39
  30. data/lib/active_record/connection_adapters/as400_adapter.rb +0 -2
  31. data/lib/active_record/connection_adapters/db2_adapter.rb +0 -1
  32. data/lib/active_record/connection_adapters/derby_adapter.rb +0 -1
  33. data/lib/active_record/connection_adapters/informix_adapter.rb +0 -1
  34. data/lib/arel/visitors/db2.rb +0 -137
  35. data/lib/arel/visitors/derby.rb +0 -112
  36. data/lib/arel/visitors/firebird.rb +0 -79
  37. data/lib/arjdbc/db2/adapter.rb +0 -808
  38. data/lib/arjdbc/db2/as400.rb +0 -142
  39. data/lib/arjdbc/db2/column.rb +0 -131
  40. data/lib/arjdbc/db2/connection_methods.rb +0 -48
  41. data/lib/arjdbc/db2.rb +0 -4
  42. data/lib/arjdbc/derby/active_record_patch.rb +0 -13
  43. data/lib/arjdbc/derby/adapter.rb +0 -521
  44. data/lib/arjdbc/derby/connection_methods.rb +0 -20
  45. data/lib/arjdbc/derby/schema_creation.rb +0 -15
  46. data/lib/arjdbc/derby.rb +0 -3
  47. data/lib/arjdbc/firebird/adapter.rb +0 -413
  48. data/lib/arjdbc/firebird/connection_methods.rb +0 -23
  49. data/lib/arjdbc/firebird.rb +0 -4
  50. data/lib/arjdbc/informix/adapter.rb +0 -139
  51. data/lib/arjdbc/informix/connection_methods.rb +0 -9
  52. data/lib/arjdbc/sybase/adapter.rb +0 -47
  53. data/lib/arjdbc/sybase.rb +0 -2
  54. data/lib/arjdbc/tasks/db2_database_tasks.rb +0 -104
  55. data/lib/arjdbc/tasks/derby_database_tasks.rb +0 -95
  56. data/src/java/arjdbc/derby/DerbyModule.java +0 -178
  57. data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +0 -152
  58. data/src/java/arjdbc/firebird/FirebirdRubyJdbcConnection.java +0 -174
  59. data/src/java/arjdbc/informix/InformixRubyJdbcConnection.java +0 -75
@@ -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