activerecord-jdbc-adapter 1.0.3-java → 50.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +33 -0
  3. data/.travis.yml +79 -0
  4. data/.yardopts +4 -0
  5. data/CONTRIBUTING.md +50 -0
  6. data/Gemfile +91 -0
  7. data/History.md +1191 -0
  8. data/LICENSE.txt +22 -17
  9. data/README.md +169 -0
  10. data/RUNNING_TESTS.md +127 -0
  11. data/Rakefile +294 -5
  12. data/Rakefile.jdbc +20 -0
  13. data/activerecord-jdbc-adapter.gemspec +55 -0
  14. data/lib/active_record/connection_adapters/as400_adapter.rb +2 -0
  15. data/lib/active_record/connection_adapters/db2_adapter.rb +1 -0
  16. data/lib/active_record/connection_adapters/firebird_adapter.rb +1 -0
  17. data/lib/active_record/connection_adapters/mariadb_adapter.rb +1 -0
  18. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +1 -0
  19. data/lib/activerecord-jdbc-adapter.rb +0 -5
  20. data/lib/arel/visitors/compat.rb +60 -0
  21. data/lib/arel/visitors/db2.rb +128 -6
  22. data/lib/arel/visitors/derby.rb +103 -10
  23. data/lib/arel/visitors/firebird.rb +79 -0
  24. data/lib/arel/visitors/h2.rb +25 -0
  25. data/lib/arel/visitors/hsqldb.rb +18 -10
  26. data/lib/arel/visitors/postgresql_jdbc.rb +6 -0
  27. data/lib/arel/visitors/sql_server.rb +225 -0
  28. data/lib/arel/visitors/sql_server/ng42.rb +293 -0
  29. data/lib/arjdbc.rb +11 -21
  30. data/lib/arjdbc/abstract/connection_management.rb +35 -0
  31. data/lib/arjdbc/abstract/core.rb +64 -0
  32. data/lib/arjdbc/abstract/database_statements.rb +64 -0
  33. data/lib/arjdbc/abstract/statement_cache.rb +58 -0
  34. data/lib/arjdbc/abstract/transaction_support.rb +86 -0
  35. data/lib/arjdbc/db2.rb +3 -1
  36. data/lib/arjdbc/db2/adapter.rb +630 -250
  37. data/lib/arjdbc/db2/as400.rb +130 -0
  38. data/lib/arjdbc/db2/column.rb +167 -0
  39. data/lib/arjdbc/db2/connection_methods.rb +44 -0
  40. data/lib/arjdbc/derby.rb +1 -5
  41. data/lib/arjdbc/derby/active_record_patch.rb +13 -0
  42. data/lib/arjdbc/derby/adapter.rb +409 -217
  43. data/lib/arjdbc/derby/connection_methods.rb +16 -14
  44. data/lib/arjdbc/derby/schema_creation.rb +15 -0
  45. data/lib/arjdbc/discover.rb +62 -50
  46. data/lib/arjdbc/firebird.rb +3 -1
  47. data/lib/arjdbc/firebird/adapter.rb +365 -62
  48. data/lib/arjdbc/firebird/connection_methods.rb +23 -0
  49. data/lib/arjdbc/h2.rb +2 -3
  50. data/lib/arjdbc/h2/adapter.rb +273 -6
  51. data/lib/arjdbc/h2/connection_methods.rb +23 -8
  52. data/lib/arjdbc/hsqldb.rb +2 -3
  53. data/lib/arjdbc/hsqldb/adapter.rb +204 -77
  54. data/lib/arjdbc/hsqldb/connection_methods.rb +24 -10
  55. data/lib/arjdbc/hsqldb/explain_support.rb +35 -0
  56. data/lib/arjdbc/hsqldb/schema_creation.rb +11 -0
  57. data/lib/arjdbc/informix.rb +4 -2
  58. data/lib/arjdbc/informix/adapter.rb +78 -54
  59. data/lib/arjdbc/informix/connection_methods.rb +8 -9
  60. data/lib/arjdbc/jdbc.rb +59 -2
  61. data/lib/arjdbc/jdbc/adapter.rb +356 -166
  62. data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
  63. data/lib/arjdbc/jdbc/adapter_require.rb +46 -0
  64. data/lib/arjdbc/jdbc/base_ext.rb +15 -0
  65. data/lib/arjdbc/jdbc/callbacks.rb +27 -18
  66. data/lib/arjdbc/jdbc/column.rb +79 -20
  67. data/lib/arjdbc/jdbc/connection.rb +5 -119
  68. data/lib/arjdbc/jdbc/connection_methods.rb +32 -4
  69. data/lib/arjdbc/jdbc/error.rb +65 -0
  70. data/lib/arjdbc/jdbc/extension.rb +41 -29
  71. data/lib/arjdbc/jdbc/java.rb +5 -6
  72. data/lib/arjdbc/jdbc/jdbc.rake +3 -126
  73. data/lib/arjdbc/jdbc/railtie.rb +2 -9
  74. data/lib/arjdbc/jdbc/rake_tasks.rb +3 -10
  75. data/lib/arjdbc/jdbc/serialized_attributes_helper.rb +3 -0
  76. data/lib/arjdbc/jdbc/type_cast.rb +166 -0
  77. data/lib/arjdbc/jdbc/type_converter.rb +35 -19
  78. data/lib/arjdbc/mssql.rb +6 -3
  79. data/lib/arjdbc/mssql/adapter.rb +630 -298
  80. data/lib/arjdbc/mssql/column.rb +200 -0
  81. data/lib/arjdbc/mssql/connection_methods.rb +66 -17
  82. data/lib/arjdbc/mssql/explain_support.rb +99 -0
  83. data/lib/arjdbc/mssql/limit_helpers.rb +189 -50
  84. data/lib/arjdbc/mssql/lock_methods.rb +77 -0
  85. data/lib/arjdbc/mssql/types.rb +343 -0
  86. data/lib/arjdbc/mssql/utils.rb +82 -0
  87. data/lib/arjdbc/mysql.rb +2 -3
  88. data/lib/arjdbc/mysql/adapter.rb +86 -356
  89. data/lib/arjdbc/mysql/connection_methods.rb +159 -23
  90. data/lib/arjdbc/oracle/adapter.rb +714 -263
  91. data/lib/arjdbc/postgresql.rb +2 -3
  92. data/lib/arjdbc/postgresql/_bc_time_cast_patch.rb +24 -0
  93. data/lib/arjdbc/postgresql/adapter.rb +570 -400
  94. data/lib/arjdbc/postgresql/base/array_decoder.rb +26 -0
  95. data/lib/arjdbc/postgresql/base/array_encoder.rb +25 -0
  96. data/lib/arjdbc/postgresql/base/array_parser.rb +95 -0
  97. data/lib/arjdbc/postgresql/base/pgconn.rb +11 -0
  98. data/lib/arjdbc/postgresql/column.rb +51 -0
  99. data/lib/arjdbc/postgresql/connection_methods.rb +57 -18
  100. data/lib/arjdbc/postgresql/name.rb +24 -0
  101. data/lib/arjdbc/postgresql/oid_types.rb +192 -0
  102. data/lib/arjdbc/railtie.rb +11 -0
  103. data/lib/arjdbc/sqlite3.rb +2 -3
  104. data/lib/arjdbc/sqlite3/adapter.rb +518 -198
  105. data/lib/arjdbc/sqlite3/connection_methods.rb +49 -24
  106. data/lib/arjdbc/sybase.rb +2 -2
  107. data/lib/arjdbc/sybase/adapter.rb +7 -6
  108. data/lib/arjdbc/tasks.rb +13 -0
  109. data/lib/arjdbc/tasks/database_tasks.rb +52 -0
  110. data/lib/arjdbc/tasks/databases.rake +91 -0
  111. data/lib/arjdbc/tasks/databases3.rake +215 -0
  112. data/lib/arjdbc/tasks/databases4.rake +39 -0
  113. data/lib/arjdbc/tasks/db2_database_tasks.rb +104 -0
  114. data/lib/arjdbc/tasks/derby_database_tasks.rb +95 -0
  115. data/lib/arjdbc/tasks/h2_database_tasks.rb +31 -0
  116. data/lib/arjdbc/tasks/hsqldb_database_tasks.rb +70 -0
  117. data/lib/arjdbc/tasks/jdbc_database_tasks.rb +169 -0
  118. data/lib/arjdbc/tasks/mssql_database_tasks.rb +46 -0
  119. data/lib/arjdbc/util/quoted_cache.rb +60 -0
  120. data/lib/arjdbc/util/serialized_attributes.rb +98 -0
  121. data/lib/arjdbc/util/table_copier.rb +110 -0
  122. data/lib/arjdbc/version.rb +1 -6
  123. data/lib/generators/jdbc/USAGE +9 -0
  124. data/lib/generators/jdbc/jdbc_generator.rb +8 -0
  125. data/lib/jdbc_adapter.rb +1 -1
  126. data/lib/jdbc_adapter/rake_tasks.rb +3 -2
  127. data/lib/jdbc_adapter/version.rb +2 -1
  128. data/pom.xml +114 -0
  129. data/rails_generators/jdbc_generator.rb +1 -1
  130. data/rails_generators/templates/config/initializers/jdbc.rb +8 -5
  131. data/rails_generators/templates/lib/tasks/jdbc.rake +7 -4
  132. data/rakelib/01-tomcat.rake +51 -0
  133. data/rakelib/02-test.rake +132 -0
  134. data/rakelib/bundler_ext.rb +11 -0
  135. data/rakelib/compile.rake +67 -22
  136. data/rakelib/db.rake +61 -0
  137. data/rakelib/rails.rake +204 -29
  138. data/src/java/arjdbc/ArJdbcModule.java +286 -0
  139. data/src/java/arjdbc/db2/DB2Module.java +76 -0
  140. data/src/java/arjdbc/db2/DB2RubyJdbcConnection.java +126 -0
  141. data/src/java/arjdbc/derby/DerbyModule.java +99 -243
  142. data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +152 -0
  143. data/src/java/arjdbc/firebird/FirebirdRubyJdbcConnection.java +174 -0
  144. data/src/java/arjdbc/{jdbc/JdbcConnectionFactory.java → h2/H2Module.java} +20 -6
  145. data/src/java/arjdbc/h2/H2RubyJdbcConnection.java +27 -12
  146. data/src/java/arjdbc/hsqldb/HSQLDBModule.java +73 -0
  147. data/src/java/arjdbc/informix/InformixRubyJdbcConnection.java +7 -6
  148. data/src/java/arjdbc/jdbc/AdapterJavaService.java +7 -29
  149. data/src/java/arjdbc/jdbc/Callable.java +44 -0
  150. data/src/java/arjdbc/jdbc/ConnectionFactory.java +132 -0
  151. data/src/java/arjdbc/jdbc/DataSourceConnectionFactory.java +157 -0
  152. data/src/java/arjdbc/jdbc/DriverConnectionFactory.java +63 -0
  153. data/src/java/arjdbc/jdbc/DriverWrapper.java +119 -0
  154. data/src/java/arjdbc/jdbc/JdbcResult.java +130 -0
  155. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +3622 -948
  156. data/src/java/arjdbc/mssql/MSSQLModule.java +90 -0
  157. data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +181 -0
  158. data/src/java/arjdbc/mysql/MySQLModule.java +99 -81
  159. data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +294 -0
  160. data/src/java/arjdbc/oracle/OracleModule.java +80 -0
  161. data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +387 -17
  162. data/src/java/arjdbc/postgresql/ByteaUtils.java +157 -0
  163. data/src/java/arjdbc/postgresql/PgResultSetMetaDataWrapper.java +23 -0
  164. data/src/java/arjdbc/postgresql/PostgreSQLModule.java +77 -0
  165. data/src/java/arjdbc/postgresql/PostgreSQLResult.java +184 -0
  166. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +952 -0
  167. data/src/java/arjdbc/sqlite3/SQLite3Module.java +73 -0
  168. data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +525 -0
  169. data/src/java/arjdbc/util/CallResultSet.java +826 -0
  170. data/src/java/arjdbc/util/DateTimeUtils.java +580 -0
  171. data/src/java/arjdbc/util/ObjectSupport.java +65 -0
  172. data/src/java/arjdbc/util/QuotingUtils.java +138 -0
  173. data/src/java/arjdbc/util/StringCache.java +63 -0
  174. data/src/java/arjdbc/util/StringHelper.java +159 -0
  175. metadata +245 -268
  176. data/History.txt +0 -369
  177. data/Manifest.txt +0 -180
  178. data/README.txt +0 -181
  179. data/lib/active_record/connection_adapters/oracle_adapter.rb +0 -1
  180. data/lib/arel/engines/sql/compilers/db2_compiler.rb +0 -9
  181. data/lib/arel/engines/sql/compilers/derby_compiler.rb +0 -6
  182. data/lib/arel/engines/sql/compilers/h2_compiler.rb +0 -6
  183. data/lib/arel/engines/sql/compilers/hsqldb_compiler.rb +0 -15
  184. data/lib/arel/engines/sql/compilers/jdbc_compiler.rb +0 -6
  185. data/lib/arel/engines/sql/compilers/mssql_compiler.rb +0 -46
  186. data/lib/arel/visitors/mssql.rb +0 -44
  187. data/lib/arjdbc/jdbc/compatibility.rb +0 -51
  188. data/lib/arjdbc/jdbc/core_ext.rb +0 -24
  189. data/lib/arjdbc/jdbc/discover.rb +0 -18
  190. data/lib/arjdbc/jdbc/driver.rb +0 -44
  191. data/lib/arjdbc/jdbc/missing_functionality_helper.rb +0 -87
  192. data/lib/arjdbc/jdbc/quoted_primary_key.rb +0 -28
  193. data/lib/arjdbc/jdbc/require_driver.rb +0 -16
  194. data/lib/arjdbc/mimer.rb +0 -2
  195. data/lib/arjdbc/mimer/adapter.rb +0 -142
  196. data/lib/arjdbc/mssql/tsql_helper.rb +0 -61
  197. data/lib/arjdbc/oracle.rb +0 -3
  198. data/lib/arjdbc/oracle/connection_methods.rb +0 -11
  199. data/lib/pg.rb +0 -4
  200. data/rakelib/package.rake +0 -92
  201. data/rakelib/test.rake +0 -81
  202. data/src/java/arjdbc/jdbc/SQLBlock.java +0 -48
  203. data/src/java/arjdbc/mssql/MssqlRubyJdbcConnection.java +0 -127
  204. data/src/java/arjdbc/postgresql/PostgresqlRubyJdbcConnection.java +0 -57
  205. data/src/java/arjdbc/sqlite3/Sqlite3RubyJdbcConnection.java +0 -64
  206. data/test/abstract_db_create.rb +0 -117
  207. data/test/activerecord/connection_adapters/type_conversion_test.rb +0 -31
  208. data/test/activerecord/connections/native_jdbc_mysql/connection.rb +0 -25
  209. data/test/db/db2.rb +0 -11
  210. data/test/db/derby.rb +0 -12
  211. data/test/db/h2.rb +0 -11
  212. data/test/db/hsqldb.rb +0 -13
  213. data/test/db/informix.rb +0 -11
  214. data/test/db/jdbc.rb +0 -11
  215. data/test/db/jndi_config.rb +0 -40
  216. data/test/db/logger.rb +0 -3
  217. data/test/db/mssql.rb +0 -9
  218. data/test/db/mysql.rb +0 -10
  219. data/test/db/oracle.rb +0 -34
  220. data/test/db/postgres.rb +0 -9
  221. data/test/db/sqlite3.rb +0 -11
  222. data/test/db2_simple_test.rb +0 -66
  223. data/test/derby_migration_test.rb +0 -68
  224. data/test/derby_multibyte_test.rb +0 -12
  225. data/test/derby_simple_test.rb +0 -99
  226. data/test/generic_jdbc_connection_test.rb +0 -29
  227. data/test/h2_simple_test.rb +0 -41
  228. data/test/has_many_through.rb +0 -79
  229. data/test/helper.rb +0 -5
  230. data/test/hsqldb_simple_test.rb +0 -6
  231. data/test/informix_simple_test.rb +0 -48
  232. data/test/jdbc_common.rb +0 -25
  233. data/test/jndi_callbacks_test.rb +0 -40
  234. data/test/jndi_test.rb +0 -25
  235. data/test/manualTestDatabase.rb +0 -191
  236. data/test/models/add_not_null_column_to_table.rb +0 -12
  237. data/test/models/auto_id.rb +0 -18
  238. data/test/models/data_types.rb +0 -28
  239. data/test/models/entry.rb +0 -43
  240. data/test/models/mixed_case.rb +0 -25
  241. data/test/models/reserved_word.rb +0 -18
  242. data/test/models/string_id.rb +0 -18
  243. data/test/models/validates_uniqueness_of_string.rb +0 -19
  244. data/test/mssql_db_create_test.rb +0 -26
  245. data/test/mssql_identity_insert_test.rb +0 -19
  246. data/test/mssql_legacy_types_test.rb +0 -58
  247. data/test/mssql_limit_offset_test.rb +0 -136
  248. data/test/mssql_multibyte_test.rb +0 -18
  249. data/test/mssql_simple_test.rb +0 -55
  250. data/test/mysql_db_create_test.rb +0 -27
  251. data/test/mysql_info_test.rb +0 -113
  252. data/test/mysql_multibyte_test.rb +0 -10
  253. data/test/mysql_nonstandard_primary_key_test.rb +0 -42
  254. data/test/mysql_simple_test.rb +0 -49
  255. data/test/oracle_simple_test.rb +0 -18
  256. data/test/oracle_specific_test.rb +0 -83
  257. data/test/pick_rails_version.rb +0 -3
  258. data/test/postgres_db_create_test.rb +0 -32
  259. data/test/postgres_drop_db_test.rb +0 -16
  260. data/test/postgres_mixed_case_test.rb +0 -29
  261. data/test/postgres_nonseq_pkey_test.rb +0 -38
  262. data/test/postgres_reserved_test.rb +0 -22
  263. data/test/postgres_schema_search_path_test.rb +0 -44
  264. data/test/postgres_simple_test.rb +0 -51
  265. data/test/postgres_table_alias_length_test.rb +0 -15
  266. data/test/simple.rb +0 -546
  267. data/test/sqlite3_simple_test.rb +0 -233
  268. data/test/sybase_jtds_simple_test.rb +0 -28
@@ -0,0 +1,23 @@
1
+ ArJdbc::ConnectionMethods.module_eval do
2
+ def firebird_connection(config)
3
+ config[:adapter_spec] ||= ::ArJdbc::Firebird
4
+
5
+ return jndi_connection(config) if jndi_config?(config)
6
+
7
+ begin
8
+ require 'jdbc/firebird'
9
+ ::Jdbc::Firebird.load_driver(:require)
10
+ rescue LoadError # assuming driver.jar is on the class-path
11
+ end
12
+
13
+ config[:host] ||= 'localhost'
14
+ config[:port] ||= 3050
15
+ config[:url] ||= begin
16
+ "jdbc:firebirdsql://#{config[:host]}:#{config[:port]}/#{config[:database]}"
17
+ end
18
+ config[:driver] ||= ::Jdbc::Firebird.driver_name
19
+
20
+ jdbc_connection(config)
21
+ end
22
+ # alias_method :jdbcfirebird_connection, :firebird_connection
23
+ end
@@ -1,4 +1,3 @@
1
- require 'arjdbc/jdbc'
2
- jdbc_require_driver 'jdbc/h2'
3
- require 'arjdbc/h2/connection_methods'
1
+ require 'arjdbc'
4
2
  require 'arjdbc/h2/adapter'
3
+ require 'arjdbc/h2/connection_methods'
@@ -1,36 +1,303 @@
1
+ ArJdbc.load_java_part :H2
1
2
  require 'arjdbc/hsqldb/adapter'
3
+ require 'arel/visitors/h2'
2
4
 
3
5
  module ArJdbc
4
6
  module H2
5
7
  include HSQLDB
6
8
 
9
+ # @see ActiveRecord::ConnectionAdapters::JdbcAdapter#jdbc_connection_class
7
10
  def self.jdbc_connection_class
8
11
  ::ActiveRecord::ConnectionAdapters::H2JdbcConnection
9
12
  end
10
13
 
11
- def adapter_name #:nodoc:
12
- 'H2'
14
+ # @see ActiveRecord::ConnectionAdapters::JdbcColumn#column_types
15
+ def self.column_selector
16
+ [ /\.h2\./i, lambda { |config, column| column.extend(Column) } ]
13
17
  end
14
18
 
15
- def arel2_visitors
16
- super.merge 'h2' => ::Arel::Visitors::HSQLDB, 'jdbch2' => ::Arel::Visitors::HSQLDB
19
+ # @see ActiveRecord::ConnectionAdapters::JdbcColumn
20
+ module Column
21
+
22
+ private
23
+
24
+ def extract_limit(sql_type)
25
+ limit = super
26
+ case @sql_type = sql_type.downcase
27
+ # NOTE: JDBC driver f*cks sql_type up with limits (just like HSQLDB) :
28
+ when /^tinyint/i then @sql_type = 'tinyint'; limit = 1
29
+ when /^smallint|int2/i then @sql_type = 'smallint'; limit = 2
30
+ when /^bigint|int8/i then @sql_type = 'bigint'; limit = 8
31
+ when /^int|int4/i then @sql_type = 'int'; limit = 4
32
+ when /^double/i then @sql_type = 'double'; limit = 8
33
+ when /^real/i then @sql_type = 'real'; limit = 4
34
+ when /^date/i then @sql_type = 'date'; limit = nil
35
+ when /^timestamp/i then @sql_type = 'timestamp'; limit = nil
36
+ when /^time/i then @sql_type = 'time'; limit = nil
37
+ when /^boolean/i then @sql_type = 'boolean'; limit = nil
38
+ when /^binary|bytea/i; then @sql_type = 'binary'; limit = 2 * 1024 * 1024
39
+ when /blob|image|oid/i then @sql_type = 'blob'; limit = nil
40
+ when /clob|text/i then @sql_type = 'clob'; limit = nil
41
+ # NOTE: use lower-case due SchemaDumper not handling it's decimal/integer
42
+ # optimization case-insensitively due : column.type == :integer &&
43
+ # [/^numeric/, /^decimal/].any? { |e| e.match(column.sql_type) }
44
+ when /^decimal\(65535,32767\)/i
45
+ @sql_type = 'decimal'; nil
46
+ end
47
+ limit
48
+ end
49
+
50
+ def simplified_type(field_type)
51
+ case field_type
52
+ when /^bit|bool/i then :boolean
53
+ when /^signed|year/i then :integer
54
+ when /^real|double/i then :float
55
+ when /^varchar/i then :string
56
+ when /^longvarchar/i then :text
57
+ when /^binary|raw|bytea/i then :binary
58
+ when /varbinary/i then :binary # longvarbinary, varbinary
59
+ when /^blob|image|oid/i then :binary
60
+ else
61
+ super
62
+ end
63
+ end
64
+
65
+ # Post process default value from JDBC into a Rails-friendly format (columns{-internal})
66
+ def default_value(value)
67
+ # H2 auto-generated key default value
68
+ return nil if value =~ /^\(NEXT VALUE FOR/i
69
+ # JDBC returns column default strings with actual single quotes around the value.
70
+ return $1 if value =~ /^'(.*)'$/
71
+ value
72
+ end
73
+
17
74
  end
18
75
 
76
+ ADAPTER_NAME = 'H2'.freeze
77
+
78
+ # @override
79
+ def adapter_name
80
+ ADAPTER_NAME
81
+ end
82
+
83
+ # @deprecated no longer used. only here for backwards compatibility with 1.2
19
84
  def h2_adapter
20
85
  true
21
86
  end
22
87
 
88
+ NATIVE_DATABASE_TYPES = {
89
+ # "integer GENERATED BY DEFAULT AS IDENTITY(START WITH 0) PRIMARY KEY"
90
+ :primary_key => "bigint identity",
91
+ :boolean => { :name => "boolean" },
92
+ :tinyint => { :name => "tinyint", :limit => 1 },
93
+ :smallint => { :name => "smallint", :limit => 2 },
94
+ :bigint => { :name => "bigint", :limit => 8 },
95
+ :integer => { :name => "int", :limit => 4 },
96
+ :decimal => { :name => "decimal" }, # :limit => 2147483647
97
+ :numeric => { :name => "numeric" }, # :limit => 2147483647
98
+ :float => { :name => "float", :limit => 8 },
99
+ :double => { :name => "double", :limit => 8 },
100
+ :real => { :name => "real", :limit => 4 }, # :limit => 8
101
+ :date => { :name => "date" },
102
+ :time => { :name => "time" },
103
+ :timestamp => { :name => "timestamp" },
104
+ :datetime => { :name => "timestamp" },
105
+ :binary => { :name => "binary" },
106
+ :string => { :name => "varchar", :limit => 255 },
107
+ :char => { :name => "char" }, # :limit => 2147483647
108
+ :blob => { :name => "blob" },
109
+ :text => { :name => "clob" },
110
+ :clob => { :name => "clob" },
111
+ :uuid => { :name => "uuid" }, # :limit => 2147483647
112
+ :other => { :name => "other" }, # java.lang.Object
113
+ :array => { :name => "array" }, # java.lang.Object[]
114
+ # NOTE: would be great if AR allowed as to refactor as :
115
+ # t.column :string, :ignorecase => true
116
+ :varchar_casesensitive => { :name => 'varchar_casesensitive' },
117
+ :varchar_ignorecase => { :name => 'varchar_ignorecase' },
118
+ # :identity : { :name=>"identity", :limit => 19 }
119
+ # :result_set : { :name=>"result_set" }
120
+ }
121
+
122
+ # @override
123
+ def native_database_types
124
+ NATIVE_DATABASE_TYPES
125
+ end
126
+
127
+ # @override
128
+ def type_to_sql(type, limit = nil, precision = nil, scale = nil)
129
+ case type.to_sym
130
+ when :integer
131
+ case limit
132
+ when 1; 'tinyint'
133
+ when 2; 'smallint'
134
+ when nil, 3, 4; 'int'
135
+ when 5..8; 'bigint'
136
+ else raise(ActiveRecordError, "No integer type has byte size #{limit}")
137
+ end
138
+ when :float
139
+ case limit
140
+ when 1..4; 'real'
141
+ when 5..8; 'double'
142
+ else raise(ActiveRecordError, "No float type has byte size #{limit}")
143
+ end
144
+ when :binary
145
+ if limit && limit < 2 * 1024 * 1024
146
+ 'binary'
147
+ else
148
+ 'blob'
149
+ end
150
+ else
151
+ super
152
+ end
153
+ end
154
+
155
+ # @override
156
+ def empty_insert_statement_value
157
+ "VALUES ()"
158
+ end
159
+
160
+ # @override
23
161
  def tables
24
162
  @connection.tables(nil, h2_schema)
25
163
  end
26
164
 
27
- def columns(table_name, name=nil)
28
- @connection.columns_internal(table_name.to_s, name, h2_schema)
165
+ # @override
166
+ def columns(table_name, name = nil)
167
+ @connection.columns_internal(table_name.to_s, nil, h2_schema)
168
+ end
169
+
170
+ # @override
171
+ def change_column(table_name, column_name, type, options = {})
172
+ execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} #{type_to_sql(type, options[:limit])}"
173
+ change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)
174
+ change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)
175
+ end
176
+
177
+ def current_schema
178
+ execute('CALL SCHEMA()')[0].values[0]
179
+ end
180
+
181
+ # @override
182
+ def quote(value, column = nil)
183
+ case value
184
+ when String
185
+ if value.empty?
186
+ "''"
187
+ else
188
+ super
189
+ end
190
+ else
191
+ super
192
+ end
193
+ end
194
+
195
+ # @override
196
+ def supports_views?; true end
197
+
198
+ # EXPLAIN support :
199
+
200
+ # @override
201
+ def supports_explain?; true end
202
+
203
+ # @override
204
+ def explain(arel, binds = [])
205
+ sql = "EXPLAIN #{to_sql(arel, binds)}"
206
+ raw_result = exec_query_raw(sql, "EXPLAIN", binds)
207
+ raw_result[0].values.join("\n") # [ "SELECT \n ..." ].to_s
208
+ end
209
+
210
+ # @override
211
+ def structure_dump
212
+ execute('SCRIPT SIMPLE').map do |result|
213
+ # [ { 'script' => SQL }, { 'script' ... }, ... ]
214
+ case sql = result.first[1] # ['script']
215
+ when /CREATE USER IF NOT EXISTS SA/i then nil
216
+ else sql
217
+ end
218
+ end.compact.join("\n\n")
219
+ end
220
+
221
+ # @see #structure_dump
222
+ def structure_load(dump)
223
+ dump.each_line("\n\n") { |ddl| execute(ddl) }
224
+ end
225
+
226
+ def shutdown
227
+ execute 'SHUTDOWN COMPACT'
228
+ end
229
+
230
+ # @private
231
+ def recreate_database(name = nil, options = {})
232
+ drop_database(name)
233
+ create_database(name, options)
234
+ end
235
+
236
+ # @private
237
+ def create_database(name = nil, options = {}); end
238
+
239
+ # @private
240
+ def drop_database(name = nil)
241
+ execute('DROP ALL OBJECTS')
242
+ end
243
+
244
+ # @private
245
+ def database_path(base_only = false)
246
+ db_path = jdbc_connection(true).getSession.getDataHandler.getDatabasePath
247
+ return db_path if base_only
248
+ if File.exist?(mv_path = "#{db_path}.mv.db")
249
+ return mv_path
250
+ else
251
+ "#{db_path}.h2.db"
252
+ end
253
+ end
254
+
255
+ # @override
256
+ def jdbc_connection(unwrap = nil)
257
+ java_connection = raw_connection.connection
258
+ return java_connection unless unwrap
259
+ if java_connection.java_class.name == 'org.h2.jdbc.JdbcConnection'
260
+ return java_connection
261
+ end
262
+ connection_class = java.sql.Connection.java_class
263
+ if java_connection.wrapper_for?(connection_class)
264
+ java_connection.unwrap(connection_class) # java.sql.Wrapper.unwrap
265
+ elsif java_connection.respond_to?(:connection)
266
+ # e.g. org.apache.tomcat.jdbc.pool.PooledConnection
267
+ java_connection.connection # getConnection
268
+ else
269
+ java_connection
270
+ end
29
271
  end
30
272
 
31
273
  private
274
+
275
+ def change_column_null(table_name, column_name, null, default = nil)
276
+ if !null && !default.nil?
277
+ execute("UPDATE #{table_name} SET #{column_name}=#{quote(default)} WHERE #{column_name} IS NULL")
278
+ end
279
+ if null
280
+ execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET NULL"
281
+ else
282
+ execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET NOT NULL"
283
+ end
284
+ end
285
+
32
286
  def h2_schema
33
287
  @config[:schema] || ''
34
288
  end
289
+
35
290
  end
36
291
  end
292
+
293
+ module ActiveRecord::ConnectionAdapters
294
+
295
+ class H2Adapter < JdbcAdapter
296
+ include ArJdbc::H2
297
+
298
+ def arel_visitor
299
+ Arel::Visitors::H2.new(self)
300
+ end
301
+ end
302
+
303
+ end
@@ -1,12 +1,27 @@
1
- module ActiveRecord
2
- class Base
3
- class << self
4
- def h2_connection(config)
5
- config[:url] ||= "jdbc:h2:#{config[:database]}"
6
- config[:driver] ||= "org.h2.Driver"
7
- embedded_driver(config)
1
+ ArJdbc::ConnectionMethods.module_eval do
2
+ def h2_connection(config)
3
+ config[:adapter_spec] ||= ::ArJdbc::H2
4
+ config[:adapter_class] = ActiveRecord::ConnectionAdapters::H2Adapter unless config.key?(:adapter_class)
5
+
6
+ return jndi_connection(config) if jndi_config?(config)
7
+
8
+ begin
9
+ require 'jdbc/h2'
10
+ ::Jdbc::H2.load_driver(:require) if defined?(::Jdbc::H2.load_driver)
11
+ rescue LoadError # assuming driver.jar is on the class-path
12
+ end
13
+
14
+ config[:url] ||= begin
15
+ db = config[:database]
16
+ if db[0, 4] == 'mem:' || db[0, 5] == 'file:' || db[0, 5] == 'hsql:'
17
+ "jdbc:h2:#{db}"
18
+ else
19
+ "jdbc:h2:file:#{File.expand_path(db)}"
8
20
  end
9
- alias_method :jdbch2_connection, :h2_connection
10
21
  end
22
+ config[:driver] ||= defined?(::Jdbc::H2.driver_name) ? ::Jdbc::H2.driver_name : 'org.h2.Driver'
23
+
24
+ embedded_driver(config)
11
25
  end
26
+ alias_method :jdbch2_connection, :h2_connection
12
27
  end
@@ -1,4 +1,3 @@
1
- require 'arjdbc/jdbc'
2
- jdbc_require_driver 'jdbc/hsqldb'
3
- require 'arjdbc/hsqldb/connection_methods'
1
+ require 'arjdbc'
4
2
  require 'arjdbc/hsqldb/adapter'
3
+ require 'arjdbc/hsqldb/connection_methods'
@@ -1,88 +1,155 @@
1
- module ::ArJdbc
1
+ ArJdbc.load_java_part :HSQLDB
2
+ require 'arjdbc/hsqldb/explain_support'
3
+ require 'arjdbc/hsqldb/schema_creation' # AR 4.x
4
+ require 'arel/visitors/hsqldb'
5
+
6
+ module ArJdbc
2
7
  module HSQLDB
8
+ include ExplainSupport
9
+
10
+ # @see ActiveRecord::ConnectionAdapters::JdbcColumn#column_types
3
11
  def self.column_selector
4
- [/hsqldb|\.h2\./i, lambda {|cfg,col| col.extend(::ArJdbc::HSQLDB::Column)}]
12
+ [ /hsqldb/i, lambda { |config, column| column.extend(Column) } ]
5
13
  end
6
14
 
15
+ # @see ActiveRecord::ConnectionAdapters::JdbcColumn
7
16
  module Column
17
+
8
18
  private
9
- def simplified_type(field_type)
10
- case field_type
11
- when /longvarchar/i
12
- :text
13
- when /tinyint/i
14
- :boolean
15
- when /real/i
16
- :float
19
+
20
+ def extract_limit(sql_type)
21
+ limit = super
22
+ case @sql_type = sql_type.downcase
23
+ when /^tinyint/i then @sql_type = 'tinyint'; limit = 1
24
+ when /^smallint/i then @sql_type = 'smallint'; limit = 2
25
+ when /^bigint/i then @sql_type = 'bigint'; limit = 8
26
+ when /^double/i then @sql_type = 'double'; limit = 8
27
+ when /^real/i then @sql_type = 'real'; limit = 8
28
+ # NOTE: once again we get incorrect "limits" from HypesSQL's JDBC
29
+ # thus yet again we need to fix incorrectly detected limits :
30
+ when /^integer/i then @sql_type = 'integer'; limit = 4
31
+ when /^float/i then @sql_type = 'float'; limit = 8
32
+ when /^decimal/i then @sql_type = 'decimal';
33
+ when /^datetime/i then @sql_type = 'datetime'; limit = nil
34
+ when /^timestamp/i then @sql_type = 'timestamp'; limit = nil
35
+ when /^time/i then @sql_type = 'time'; limit = nil
36
+ when /^date/i then @sql_type = 'date'; limit = nil
17
37
  else
18
- super(field_type)
38
+ # HSQLDB appears to return "LONGVARCHAR(0)" for :text columns,
39
+ # which for AR purposes should be interpreted as "no limit" :
40
+ limit = nil if sql_type =~ /\(0\)$/
19
41
  end
42
+ limit
20
43
  end
21
44
 
22
- # Override of ActiveRecord::ConnectionAdapters::Column
23
- def extract_limit(sql_type)
24
- # HSQLDB appears to return "LONGVARCHAR(0)" for :text columns, which
25
- # for AR purposes should be interpreted as "no limit"
26
- return nil if sql_type =~ /\(0\)/
27
- super
45
+ def simplified_type(field_type)
46
+ case field_type
47
+ when /^nvarchar/i then :string
48
+ when /^character/i then :string
49
+ when /^longvarchar/i then :text
50
+ when /int/i then :integer # TINYINT, SMALLINT, BIGINT, INT
51
+ when /real|double/i then :float
52
+ when /^bit/i then :boolean
53
+ when /binary/i then :binary # VARBINARY, LONGVARBINARY
54
+ else
55
+ super
56
+ end
28
57
  end
29
58
 
30
59
  # Post process default value from JDBC into a Rails-friendly format (columns{-internal})
31
60
  def default_value(value)
32
- # jdbc returns column default strings with actual single quotes around the value.
61
+ # JDBC returns column default strings with actual single quotes around the value.
33
62
  return $1 if value =~ /^'(.*)'$/
34
-
35
63
  value
36
64
  end
37
- end
38
65
 
39
- def adapter_name #:nodoc:
40
- 'Hsqldb'
41
66
  end
42
67
 
43
- def arel2_visitors
44
- require 'arel/visitors/hsqldb'
45
- {'hsqldb' => ::Arel::Visitors::HSQLDB, 'jdbchsqldb' => ::Arel::Visitors::HSQLDB}
68
+ ADAPTER_NAME = 'HSQLDB'.freeze
69
+
70
+ def adapter_name
71
+ ADAPTER_NAME
46
72
  end
47
73
 
48
- def modify_types(tp)
49
- tp[:primary_key] = "INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) PRIMARY KEY"
50
- tp[:integer][:limit] = nil
51
- tp[:boolean][:limit] = nil
52
- # set text and float limits so we don't see odd scales tacked on
53
- # in migrations
54
- tp[:boolean] = { :name => "tinyint" }
55
- tp[:text][:limit] = nil
56
- tp[:float][:limit] = 17 if defined?(::Jdbc::H2)
57
- tp[:string][:limit] = 255
58
- tp[:datetime] = { :name => "DATETIME" }
59
- tp[:timestamp] = { :name => "DATETIME" }
60
- tp[:time] = { :name => "TIME" }
61
- tp[:date] = { :name => "DATE" }
62
- tp
74
+ NATIVE_DATABASE_TYPES = {
75
+ :primary_key => "integer GENERATED BY DEFAULT AS IDENTITY(START WITH 0) PRIMARY KEY",
76
+ :string => { :name => "varchar", :limit => 255 }, # :limit => 2147483647
77
+ :text => { :name => "clob" },
78
+ :binary => { :name => "blob" },
79
+ :boolean => { :name => "boolean" }, # :name => "tinyint", :limit => 1
80
+ :bit => { :name=>"bit" }, # stored as 0/1 on HSQLDB 2.2 (translates true/false)
81
+ :integer => { :name => "integer", :limit => 4 },
82
+ :decimal => { :name => "decimal" }, # :limit => 2147483647
83
+ :numeric => { :name => "numeric" }, # :limit => 2147483647
84
+ # NOTE: fix incorrectly detected limits :
85
+ :tinyint => { :name => "tinyint", :limit => 1 },
86
+ :smallint => { :name => "smallint", :limit => 2 },
87
+ :bigint => { :name => "bigint", :limit => 8 },
88
+ :float => { :name => "float" },
89
+ :double => { :name => "double", :limit => 8 },
90
+ :real => { :name => "real", :limit => 8 },
91
+ :date => { :name=>"date" },
92
+ :time => { :name=>"time" },
93
+ :timestamp => { :name=>"timestamp" },
94
+ :datetime => { :name=>"timestamp" },
95
+ :other => { :name=>"other" },
96
+ # NOTE: would be great if AR allowed as to refactor as :
97
+ # t.column :string, :ignorecase => true
98
+ :character => { :name => "character" },
99
+ :varchar_ignorecase => { :name => "varchar_ignorecase" },
100
+ }
101
+
102
+ # @override
103
+ def native_database_types
104
+ NATIVE_DATABASE_TYPES
63
105
  end
64
106
 
65
- def quote(value, column = nil) # :nodoc:
107
+ # @override
108
+ def quote(value, column = nil)
66
109
  return value.quoted_id if value.respond_to?(:quoted_id)
110
+ return value if sql_literal?(value)
67
111
 
68
112
  case value
69
113
  when String
70
- if respond_to?(:h2_adapter) && value.empty?
71
- "''"
72
- elsif column && column.type == :binary
73
- "'#{value.unpack("H*")}'"
74
- elsif column && (column.type == :integer ||
75
- column.respond_to?(:primary) && column.primary && column.klass != String)
114
+ column_type = column && column.type
115
+ if column_type == :binary
116
+ "X'#{value.unpack("H*")[0]}'"
117
+ elsif column_type == :integer ||
118
+ column.respond_to?(:primary) && column.primary && column.klass != String
76
119
  value.to_i.to_s
77
120
  else
78
121
  "'#{quote_string(value)}'"
79
122
  end
123
+ when Time
124
+ column_type = column && column.type
125
+ if column_type == :time
126
+ "'#{value.strftime("%H:%M:%S")}'"
127
+ #elsif column_type == :timestamp # || column_type == :datetime
128
+ #value = ::ActiveRecord::Base.default_timezone == :utc ? value.getutc : value.getlocal
129
+ #"'#{value.strftime("%Y-%m-%d %H:%M:%S")}.#{sprintf("%06d", value.usec)}'"
130
+ else
131
+ super
132
+ end
80
133
  else
81
134
  super
82
135
  end
83
136
  end
84
137
 
85
- def quote_column_name(name) #:nodoc:
138
+ # Quote date/time values for use in SQL input.
139
+ # Includes microseconds if the value is a Time responding to usec.
140
+ # @override
141
+ def quoted_date(value)
142
+ if value.acts_like?(:time) && value.respond_to?(:usec)
143
+ usec = sprintf("%06d", value.usec)
144
+ value = ::ActiveRecord::Base.default_timezone == :utc ? value.getutc : value.getlocal
145
+ "#{value.strftime("%Y-%m-%d %H:%M:%S")}.#{usec}"
146
+ else
147
+ super
148
+ end
149
+ end if ::ActiveRecord::VERSION::MAJOR >= 3
150
+
151
+ # @override
152
+ def quote_column_name(name)
86
153
  name = name.to_s
87
154
  if name =~ /[-]/
88
155
  %Q{"#{name.upcase}"}
@@ -91,25 +158,15 @@ module ::ArJdbc
91
158
  end
92
159
  end
93
160
 
94
- def quote_string(str)
95
- str.gsub(/'/, "''")
96
- end
97
-
98
- def quoted_true
99
- '1'
100
- end
101
-
102
- def quoted_false
103
- '0'
104
- end
105
-
161
+ # @override
106
162
  def add_column(table_name, column_name, type, options = {})
107
163
  add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}"
108
164
  add_column_options!(add_column_sql, options)
109
165
  execute(add_column_sql)
110
- end
166
+ end unless const_defined? :SchemaCreation
111
167
 
112
- def change_column(table_name, column_name, type, options = {}) #:nodoc:
168
+ # @override
169
+ def change_column(table_name, column_name, type, options = {})
113
170
  execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} #{type_to_sql(type, options[:limit])}"
114
171
  end
115
172
 
@@ -117,54 +174,124 @@ module ::ArJdbc
117
174
  execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET DEFAULT #{quote(default)}"
118
175
  end
119
176
 
177
+ # @override
120
178
  def rename_column(table_name, column_name, new_column_name) #:nodoc:
121
179
  execute "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} RENAME TO #{new_column_name}"
122
180
  end
123
181
 
124
- # Maps logical Rails types to MySQL-specific data types.
182
+ # @override
125
183
  def type_to_sql(type, limit = nil, precision = nil, scale = nil)
126
184
  return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil
127
-
128
185
  type
129
186
  end
130
187
 
188
+ # @override
131
189
  def rename_table(name, new_name)
132
190
  execute "ALTER TABLE #{name} RENAME TO #{new_name}"
133
191
  end
134
192
 
193
+ # @note AR API since 4.2
194
+ def truncate(table_name, name = nil)
195
+ execute "TRUNCATE TABLE #{quote_table_name(table_name)}", name
196
+ end
197
+
135
198
  def last_insert_id
136
- Integer(select_value("CALL IDENTITY()"))
199
+ identity = select_value("CALL IDENTITY()")
200
+ Integer(identity.nil? ? 0 : identity)
137
201
  end
138
202
 
203
+ # @private
139
204
  def _execute(sql, name = nil)
140
205
  result = super
141
- ActiveRecord::ConnectionAdapters::JdbcConnection::insert?(sql) ? last_insert_id : result
206
+ self.class.insert?(sql) ? last_insert_id : result
142
207
  end
208
+ private :_execute
143
209
 
144
- def add_limit_offset!(sql, options) #:nodoc:
210
+ # @note Only used with (non-AREL) ActiveRecord **2.3**.
211
+ # @see Arel::Visitors::HSQLDB#limit_offset
212
+ def add_limit_offset!(sql, options)
145
213
  if sql =~ /^select/i
146
214
  offset = options[:offset] || 0
147
- bef = sql[7..-1]
148
215
  if limit = options[:limit]
149
- sql.replace "SELECT LIMIT #{offset} #{limit} #{bef}"
216
+ sql.replace "SELECT LIMIT #{offset} #{limit} #{sql[7..-1]}"
150
217
  elsif offset > 0
151
- sql.replace "SELECT LIMIT #{offset} 0 #{bef}"
218
+ sql.replace "SELECT LIMIT #{offset} 0 #{sql[7..-1]}"
152
219
  end
153
220
  end
221
+ end if ::ActiveRecord::VERSION::MAJOR < 3
222
+
223
+ # @override
224
+ def empty_insert_statement_value
225
+ # on HSQLDB only work with tables that have a default value for each
226
+ # and every column ... you'll need to avoid `Model.create!` on 4.0
227
+ 'DEFAULT VALUES'
154
228
  end
155
229
 
156
- # override to filter out system tables that otherwise end
157
- # up in db/schema.rb during migrations. JdbcConnection#tables
158
- # now takes an optional block filter so we can screen out
159
- # rows corresponding to system tables. HSQLDB names its
160
- # system tables SYSTEM.*, but H2 seems to name them without
161
- # any kind of convention
230
+ # We filter out HSQLDB's system tables (named "SYSTEM.*").
231
+ # @override
162
232
  def tables
163
- @connection.tables.select {|row| row.to_s !~ /^system_/i }
233
+ @connection.tables.select { |row| row.to_s !~ /^system_/i }
164
234
  end
165
235
 
236
+ # @override
166
237
  def remove_index(table_name, options = {})
167
238
  execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}"
168
239
  end
240
+
241
+ # @override
242
+ def supports_views?; true end
243
+
244
+ # @override
245
+ def supports_foreign_keys?; true end
246
+
247
+ # @override
248
+ def structure_dump
249
+ execute('SCRIPT').map do |result|
250
+ # [ { 'command' => SQL }, { 'command' ... }, ... ]
251
+ case sql = result.first[1] # ['command']
252
+ when /CREATE USER SA PASSWORD DIGEST .*?/i then nil
253
+ when /CREATE SCHEMA PUBLIC AUTHORIZATION DBA/i then nil
254
+ when /GRANT DBA TO SA/i then nil
255
+ else sql
256
+ end
257
+ end.compact.join("\n\n")
258
+ end
259
+
260
+ # @see #structure_dump
261
+ def structure_load(dump)
262
+ dump.each_line("\n\n") { |ddl| execute(ddl) }
263
+ end
264
+
265
+ def shutdown
266
+ execute 'SHUTDOWN'
267
+ end
268
+
269
+ # @private
270
+ def recreate_database(name = nil, options = {})
271
+ drop_database(name)
272
+ create_database(name, options)
273
+ end
274
+
275
+ # @private
276
+ def create_database(name = nil, options = {}); end
277
+
278
+ # @private
279
+ def drop_database(name = nil)
280
+ execute('DROP SCHEMA PUBLIC CASCADE')
281
+ end
282
+
283
+ end
284
+ end
285
+
286
+ module ActiveRecord::ConnectionAdapters
287
+
288
+ class HsqldbAdapter < JdbcAdapter
289
+ include ArJdbc::HSQLDB
290
+
291
+ def arel_visitor # :nodoc:
292
+ Arel::Visitors::HSQLDB
293
+ end
169
294
  end
295
+
170
296
  end
297
+