jpzwarte-activerecord-jdbc-adapter 0.9.1.6 → 0.9.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/History.txt +233 -0
  2. data/LICENSE.txt +21 -0
  3. data/Manifest.txt +117 -0
  4. data/README.txt +189 -0
  5. data/Rakefile +10 -0
  6. data/lib/active_record/connection_adapters/cachedb_adapter.rb +1 -0
  7. data/lib/active_record/connection_adapters/derby_adapter.rb +13 -0
  8. data/lib/active_record/connection_adapters/h2_adapter.rb +13 -0
  9. data/lib/active_record/connection_adapters/hsqldb_adapter.rb +13 -0
  10. data/lib/active_record/connection_adapters/informix_adapter.rb +1 -0
  11. data/lib/active_record/connection_adapters/jdbc_adapter.rb +638 -0
  12. data/lib/active_record/connection_adapters/jdbc_adapter_spec.rb +26 -0
  13. data/lib/active_record/connection_adapters/jndi_adapter.rb +1 -0
  14. data/lib/active_record/connection_adapters/mysql_adapter.rb +13 -0
  15. data/lib/active_record/connection_adapters/oracle_adapter.rb +1 -0
  16. data/lib/active_record/connection_adapters/postgresql_adapter.rb +13 -0
  17. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +13 -0
  18. data/lib/jdbc_adapter/jdbc.rake +117 -0
  19. data/lib/jdbc_adapter/jdbc_adapter_internal.jar +0 -0
  20. data/lib/jdbc_adapter/jdbc_cachedb.rb +33 -0
  21. data/lib/jdbc_adapter/jdbc_db2.rb +191 -0
  22. data/lib/jdbc_adapter/jdbc_derby.rb +422 -0
  23. data/lib/jdbc_adapter/jdbc_firebird.rb +109 -0
  24. data/lib/jdbc_adapter/jdbc_hsqldb.rb +218 -0
  25. data/lib/jdbc_adapter/jdbc_informix.rb +147 -0
  26. data/lib/jdbc_adapter/jdbc_mimer.rb +141 -0
  27. data/lib/jdbc_adapter/jdbc_mssql.rb +337 -0
  28. data/lib/jdbc_adapter/jdbc_mysql.rb +236 -0
  29. data/lib/jdbc_adapter/jdbc_oracle.rb +377 -0
  30. data/lib/jdbc_adapter/jdbc_postgre.rb +499 -0
  31. data/lib/jdbc_adapter/jdbc_sqlite3.rb +384 -0
  32. data/lib/jdbc_adapter/jdbc_sybase.rb +50 -0
  33. data/lib/jdbc_adapter/missing_functionality_helper.rb +87 -0
  34. data/lib/jdbc_adapter/rake_tasks.rb +10 -0
  35. data/lib/jdbc_adapter/tsql_helper.rb +60 -0
  36. data/lib/jdbc_adapter/version.rb +5 -0
  37. data/lib/jdbc_adapter.rb +27 -0
  38. data/lib/pg.rb +4 -0
  39. data/rails_generators/jdbc_generator.rb +15 -0
  40. data/rails_generators/templates/jdbc.rake +8 -0
  41. data/rails_generators/templates/jdbc.rb +7 -0
  42. data/rakelib/compile.rake +23 -0
  43. data/rakelib/package.rake +85 -0
  44. data/rakelib/rails.rake +41 -0
  45. data/rakelib/test.rake +71 -0
  46. data/src/java/jdbc_adapter/JdbcAdapterInternalService.java +53 -0
  47. data/src/java/jdbc_adapter/JdbcConnectionFactory.java +36 -0
  48. data/src/java/jdbc_adapter/JdbcDerbySpec.java +293 -0
  49. data/src/java/jdbc_adapter/JdbcMySQLSpec.java +134 -0
  50. data/src/java/jdbc_adapter/MssqlRubyJdbcConnection.java +71 -0
  51. data/src/java/jdbc_adapter/PostgresRubyJdbcConnection.java +55 -0
  52. data/src/java/jdbc_adapter/RubyJdbcConnection.java +1162 -0
  53. data/src/java/jdbc_adapter/SQLBlock.java +27 -0
  54. data/src/java/jdbc_adapter/Sqlite3RubyJdbcConnection.java +41 -0
  55. data/test/abstract_db_create.rb +47 -0
  56. data/test/activerecord/connection_adapters/type_conversion_test.rb +31 -0
  57. data/test/activerecord/connections/native_jdbc_mysql/connection.rb +25 -0
  58. data/test/cachedb_simple_test.rb +6 -0
  59. data/test/db/cachedb.rb +9 -0
  60. data/test/db/db2.rb +9 -0
  61. data/test/db/derby.rb +14 -0
  62. data/test/db/h2.rb +11 -0
  63. data/test/db/hsqldb.rb +12 -0
  64. data/test/db/informix.rb +11 -0
  65. data/test/db/jdbc.rb +11 -0
  66. data/test/db/jndi_config.rb +30 -0
  67. data/test/db/logger.rb +3 -0
  68. data/test/db/mssql.rb +9 -0
  69. data/test/db/mysql.rb +10 -0
  70. data/test/db/oracle.rb +34 -0
  71. data/test/db/postgres.rb +9 -0
  72. data/test/db/sqlite3.rb +15 -0
  73. data/test/db2_simple_test.rb +10 -0
  74. data/test/derby_migration_test.rb +21 -0
  75. data/test/derby_multibyte_test.rb +12 -0
  76. data/test/derby_simple_test.rb +12 -0
  77. data/test/generic_jdbc_connection_test.rb +9 -0
  78. data/test/h2_simple_test.rb +6 -0
  79. data/test/has_many_through.rb +79 -0
  80. data/test/helper.rb +5 -0
  81. data/test/hsqldb_simple_test.rb +6 -0
  82. data/test/informix_simple_test.rb +48 -0
  83. data/test/jdbc_adapter/jdbc_db2_test.rb +26 -0
  84. data/test/jdbc_adapter/jdbc_sybase_test.rb +33 -0
  85. data/test/jdbc_common.rb +26 -0
  86. data/test/jndi_callbacks_test.rb +38 -0
  87. data/test/jndi_test.rb +35 -0
  88. data/test/manualTestDatabase.rb +191 -0
  89. data/test/minirunit/testConnect.rb +14 -0
  90. data/test/minirunit/testH2.rb +73 -0
  91. data/test/minirunit/testHsqldb.rb +73 -0
  92. data/test/minirunit/testLoadActiveRecord.rb +3 -0
  93. data/test/minirunit/testMysql.rb +83 -0
  94. data/test/minirunit/testRawSelect.rb +24 -0
  95. data/test/minirunit.rb +109 -0
  96. data/test/models/add_not_null_column_to_table.rb +12 -0
  97. data/test/models/auto_id.rb +18 -0
  98. data/test/models/data_types.rb +28 -0
  99. data/test/models/entry.rb +23 -0
  100. data/test/models/mixed_case.rb +20 -0
  101. data/test/models/reserved_word.rb +18 -0
  102. data/test/models/validates_uniqueness_of_string.rb +19 -0
  103. data/test/mssql_simple_test.rb +6 -0
  104. data/test/mysql_db_create_test.rb +25 -0
  105. data/test/mysql_multibyte_test.rb +10 -0
  106. data/test/mysql_nonstandard_primary_key_test.rb +42 -0
  107. data/test/mysql_simple_test.rb +31 -0
  108. data/test/oracle_simple_test.rb +29 -0
  109. data/test/postgres_db_create_test.rb +21 -0
  110. data/test/postgres_mixed_case_test.rb +19 -0
  111. data/test/postgres_nonseq_pkey_test.rb +40 -0
  112. data/test/postgres_reserved_test.rb +22 -0
  113. data/test/postgres_simple_test.rb +12 -0
  114. data/test/simple.rb +452 -0
  115. data/test/sqlite3_simple_test.rb +232 -0
  116. data/test/sybase_jtds_simple_test.rb +6 -0
  117. metadata +147 -23
data/History.txt ADDED
@@ -0,0 +1,233 @@
1
+ == 0.9.2
2
+
3
+ - The main, highly awaited fix for this release is a solution to the
4
+ rake db:create/db:drop issue. The main change is a new 'jdbc' rails
5
+ generator that should be run once to prepare a Rails application to
6
+ use JDBC. The upside of this generator is that you no longer will
7
+ need to alter database.yml for JDBC. See the README.txt for details.
8
+ - Cleanup and reconnect if errors occur during begin/rollback
9
+ (Jean-Dominique Morani, Christian Seiler)
10
+ - ACTIVERECORD_JDBC-1: Add #drop_database method for oracle (does the
11
+ same thing as recreate_database)
12
+ - Sqlite3 and MSSQL fixes (Jean-Dominique Morani)
13
+ - JRUBY-3512: Treat LONGVARCHAR as a CLOB for Mssql
14
+ - JRUBY-3624: Upgrade Derby to 10.5.3.0 and add native limit/offset
15
+ support (Christopher Saunders)
16
+ - JRUBY-3616: Fix postgres non-sequence primary keys (David Kellum)
17
+ - JRUBY-3669: Fix Oracle case with unconfigured schema (Dan Powell)
18
+ - Fixed quote_column_name of jdbc_oracle to accept numbers (Marcelo
19
+ Murad)
20
+ - Fix for mysql tables with non standard primary keys such that the
21
+ schema dump is correct (Nick Zalabak)
22
+ - MSSQL fixes from Mike Luu:
23
+ - add support for MSSQL uniqueidentifier datatype
24
+ - always quote strings using unicode identifier for MSSQL
25
+ - Changes primary_key generation to use always instead of by default
26
+ for DB2 (Amos King)
27
+ - Improves the SQLite adapter by fixing rename_column, change_column,
28
+ change_column_default, changing remove_column, and adding
29
+ remove_columns (Ryan Baumann)
30
+ - More oracle love courtesy Ben Browning and Jens Himmelreich
31
+ - JRUBY-3608: Add missing change_column_null method for postgres
32
+ - JRUBY-3508: Fix quoting of integer and float columns
33
+
34
+ == 0.9.1
35
+
36
+ - We did a lot of internal cleanup this release in the hopes of
37
+ simplifying the code and increasing performance.
38
+ - Many SQLite updates (thanks Nils Christian Haugen)
39
+ - JRUBY-2912: Fix MSSQL create/drop database (Joern Hartmann)
40
+ - JRUBY-2767: Mistake in selecting identity with H2/HSQLDB
41
+ - JRUBY-2884: jdbc_postgre.rb issue handling nil booleans (also a fix
42
+ for hsqldb/h2) + tests
43
+ - JRUBY-2995: activerecord jdbc derby adapter should quote columns
44
+ called 'year'
45
+ - JRUBY-2897: jdbc_postgre.rb needs microsecond support
46
+ - JRUBY-3282: Upgrade to derby 10.4.2.0 to allow unique constraints
47
+ with nullable columns
48
+ - Update h2 from 1.0.63 to 1.1.107 in driver
49
+ - JRUBY-3026: [Derby] Allow select/delete/update conditions with
50
+ comparison to NULL using '='
51
+ - JRUBY-2996: ...(actually this fixes only remaining issue of this bug
52
+ which was symbols making into quote were exploding
53
+ - JRUBY-2691: Update sybase driver to pass simple unit tests with jtds
54
+ and verify it works with the new dialect keyword. patch by Leigh
55
+ Kennedy
56
+ - Make :float type work on h2,hsql [returned as string]. Make :float
57
+ work on hsqldb (no paren value supported). Make REAL_TYPE just
58
+ return RubyFloat
59
+ - JRUBY-3222: Upgrade #type_to_sql to variation of AR 2.1.2 version
60
+ - Add patch supplied in JRUBY-3489 (patch by Jean-Dominique Morani)
61
+ - Various Oracle fixes by edsono
62
+ - JRUBY-2688: Don't hard-code MySQL connection character encoding to
63
+ utf8
64
+
65
+ == 0.9
66
+
67
+ - Now updated to support ActiveRecord 2.2. JNDI-based connections will
68
+ automatically connect/disconnect for every AR connection pool
69
+ checkout/checkin. For best results, set your pool: parameter >= the
70
+ actual maximum size of the JNDI connection pool. (We'll look at how
71
+ to eliminate the need to configure AR's pool in the future.)
72
+ - NEW! Informix support courtesy of Javier Fernandez-Ivern.
73
+ - Backport another Oracle CLOB issue, thanks Edson C�sar.
74
+ - Rubyforge #22018: chomp final trailing semicolon for oracle
75
+ - JRUBY-2848: Fix NPE error in set_native_database_types
76
+ - Rework oracle lob saving callback to be Rails 2.1 friendly (assist
77
+ from court3nay)
78
+ - JRUBY-2715: Add create/drop database methods to Postgres (Peter Williams)
79
+ - JRUBY-3183: Fix structure dump for Postgres (Ryan Bell)
80
+ - JRUBY-3184: recreate_database for test database working for PG (Ryan Bell)
81
+ - JRUBY-3186: disable referential integrity for PG (Ryan Bell)
82
+ - Authoritative repository now hosted at
83
+ git://github.com/nicksieger/activerecord-jdbc-adapter.git; rubyforge
84
+ svn trunk cleaned out.
85
+
86
+ == 0.8.2
87
+
88
+ - Added an optional config key called :dialect. Using :dialect allows you to
89
+ override the default SQL dialect for the driver class being used. There are
90
+ a few cases for this:
91
+ - Using using Sybase w/ the jTDS driver.
92
+ - Using rebranded drivers.
93
+ - It makes more sense to use :dialect, rather then :driver when using JNDI.
94
+ - JRUBY-2619: Typo with :test config causing problems with dev database (Igor Minar)
95
+ - 20524, JRUBY-2612: Since when did I think that there was a #true? method on Object?
96
+
97
+ == 0.8.1
98
+
99
+ - Now sporting a JDBC sqlite3 adapter! Thanks Joseph Athman.
100
+ - Added support for InterSystems Cache database (Ryan Bell)
101
+ - Fix for JRUBY-2256
102
+ - JRUBY-1638, JRUBY-2404, JRUBY-2463: schema.table handling and Oracle NUMBER fixes (Darcy Schultz & Jesse Hu)
103
+ - Add structure dump and other DDL-ish for DB2 (courtesy abedra and stuarthalloway)
104
+ - Fix missing quote_table_name function under Rails 1.2.6 and earlier
105
+ - Small tweaks to jdbc.rake to select proper config
106
+ - JRUBY-2011: Fix MSSQL string un-quoting issue (Silvio Fonseca)
107
+ - JRUBY-1977, 17427: Fix information_schema select issue with MSSQL (Matt Burke)
108
+ - 20479: Improve get_table_name for MSSQL (Aslak Hellesøy)
109
+ - 20243: numerics improvements for MSSQL (Aslak Hellesøy)
110
+ - 20172: don't quote table names for MSSQL (Thor Marius Henrichsen)
111
+ - 19729: check for primary key existence in postgres during insert (Martin Luder)
112
+ - JRUBY-2297, 18846: retrying failing SQL statements is harmful when not autocommitting (Craig McMillan)
113
+ - 10021: very preliminary sybase support. (Mark Atkinson) Not usable until collision w/ sqlserver driver is resolved.
114
+ - JRUBY-2312, JRUBY-2319, JRUBY-2322: Oracle timestamping issues (Jesse Hu & Michael König)
115
+ - JRUBY-2422: Fix MySQL referential integrity and rollback issues
116
+ - JRUBY-2382: mysql string quoting fails with ArrayIndexOutofBoundsException
117
+
118
+ == 0.8
119
+
120
+ - NOTE: This release is only compatible with JRuby 1.1RC3 or later.
121
+ - Because of recent API changes in trunk in preparation for JRuby 1.1, this release is not
122
+ backward compatible with previous JRuby releases. Hence the version bump.
123
+ - Internal: convert Java methods to be defined with annotations
124
+ - Fix problem with reserved words coming back pre-quoted from #indexes in postgres
125
+ - JRUBY-2205: Fix N^2 allocation of bytelists for mysql quoting (taw)
126
+ - Attempt a fix for Rubyforge 18059
127
+ - Upgrade derby to 10.3.2.1
128
+ - Fix db:create etc. in the case where JDBC is loaded in Rails' preinitializer.rb
129
+ - Fix db:drop to actually work
130
+ - Fix for Rubyforge #11567 (Matt Williams)
131
+
132
+ == 0.7.2
133
+
134
+ - JRUBY-1905: add_column for derby, hsqldb, and postgresql (Stephen Bannasch)
135
+ - Fix db:create for JDBC
136
+ - Support Rails 2 with the old "require 'jdbc_adapter'" approach
137
+ - JRUBY-1966: Instead of searching for just tables, search for views and tables.
138
+ - JRUBY-1583: DB2 numeric quoting (Ryan Shillington)
139
+ - JRUBY-1634: Oracle DATE type mapping (Daniel Wintschel)
140
+ - JRUBY-1543: rename_column issue with more recent MySQL drivers (Oliver Schmelzle)
141
+ - Rubyforge #15074: ConnectionAdapters::JdbcAdapter.indexes is missing name and
142
+ schema_name parameters in the method signature (Igor Minar)
143
+ - Rubyforge #13558: definition for the indexes method (T Meyarivan)
144
+ - JRUBY-2051: handle schemaname and tablename more correctly for columns
145
+ - JRUBY-2102: Postgres Adapter cannot handle datetime type (Rainer Hahnekamp)
146
+ - JRUBY-2018: Oracle behind ActiveRecord-JDBC fails with "Invalid column index" (K Venkatasubramaniyan)
147
+ - JRUBY-2012: jdbc_mysql structure dump fails for mysql views (Tyler Jennings)
148
+
149
+ == 0.7.1
150
+
151
+ - Add adapter and driver for H2 courtesy of Caleb Land
152
+ - Fix "undefined method `last' for {}:Hash" error introduced with new Rake 0.8.1 (JRUBY-1859)
153
+
154
+ == 0.7
155
+
156
+ - PLEASE NOTE: This release is not compatible with JRuby releases earlier than
157
+ 1.0.3 or 1.1b2. If you must use JRuby 1.0.2 or earlier, please install the
158
+ 0.6 release.
159
+ - Release coincides with JRuby 1.0.3 and JRuby 1.1b2 releases
160
+ - Simultaneous support for JRuby trunk and 1.0 branch
161
+ - Get rid of log_no_bench method, so we time SQL execution again.
162
+ - Implement #select_rows
163
+ - MySQL migration and quoting updates
164
+
165
+ == 0.6
166
+
167
+ - Gem is renamed to "activerecord-jdbc-adapter" to follow new conventions
168
+ introduced in Rails 2.0 for third-party adapters. Rails 2.0 compatibility is
169
+ introduced.
170
+ - Add dependency on ActiveRecord >= 1.14 (from the Rails 1.1.x release)
171
+ - New drivers (jdbc-XXX) and adapter (activerecord-jdbcXXX-adapter) gems
172
+ available separately. See the README.txt file for details.
173
+ - Plain "jdbc" driver is still available if you want to use the full
174
+ driver/url way of specifying the driver.
175
+ - More bugfixes to Oracle and SQLServer courtesy of Ola & ThoughtWorks
176
+
177
+ == 0.5
178
+
179
+ - Release coincides with JRuby 1.0.1 release
180
+ - It is no longer necessary to specify :driver and :url configuration
181
+ parameters for the mysql, postgresql, oracle, derby, hsqldb, and h2
182
+ adapters. The previous configuration is still valid and compatible, but for
183
+ new applications, this makes it possible to use the exact same database.yml
184
+ configuration as Rails applications running under native Ruby.
185
+ - JDBC drivers can now be dynamically loaded by Ruby code, without being on
186
+ the classpath prior to launching JRuby. Simply use "require
187
+ 'jdbc-driver.jar'" in JRuby code to add it to the runtime classpath.
188
+ - Updates to HSQL, MS SQLServer, Postgres, Oracle and Derby adapters
189
+
190
+ == 0.4
191
+
192
+ - Release coincides with JRuby 1.0 release
193
+ - Shoring up PostgreSQL (courtesy Dudley Flanders) and HSQL (courtesy Matthew
194
+ Williams)
195
+ - Fix timestamps on Oracle to use DATE (as everything else)
196
+ - Derby fixes: Fix for open result set issue, better structure dump, quoting,
197
+ column type changing
198
+ - Sybase type recognition fix (courtesy Dean Mao)
199
+
200
+ == 0.3.1
201
+
202
+ - Derby critical fixes shortly after 0.3
203
+
204
+ == 0.3
205
+
206
+ - Release coincides with JRuby 1.0.0RC1 release
207
+ - Improvements for Derby, Postgres, and Oracle, all of which are running
208
+ > 95% of AR tests
209
+
210
+ == 0.2.4
211
+
212
+ - Release coincides with JRuby 0.9.9 release
213
+ - JRuby 0.9.9 is required
214
+ - MySQL close to 100% working
215
+ - Derby improvements
216
+ - DECIMAL/NUMERIC/FLOAT/REAL bugs fixed with type recognition for Oracle,
217
+ Postgres, etc.
218
+ - HSQLDB has regressed this release and may not be functioning; we'll get it
219
+ fixed for the next one
220
+
221
+ == 0.2.3
222
+
223
+ - Release coincides (and compatible) with JRuby 0.9.8 release
224
+ - 8 bugs fixed: see http://rubyurl.com/0Da
225
+ - Improvements and compatibility fixes for Rails 1.2.x
226
+
227
+ == 0.2.1, 0.2.2
228
+
229
+ - Early releases, added better support for multiple databases
230
+
231
+ == 0.0.1
232
+
233
+ - Initial, very alpha release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2006-2008 Nick Sieger <nick@nicksieger.com>
2
+ Copyright (c) 2006-2008 Ola Bini <ola.bini@gmail.com>
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,117 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ LICENSE.txt
6
+ lib/jdbc_adapter.rb
7
+ lib/pg.rb
8
+ lib/active_record/connection_adapters/cachedb_adapter.rb
9
+ lib/active_record/connection_adapters/derby_adapter.rb
10
+ lib/active_record/connection_adapters/h2_adapter.rb
11
+ lib/active_record/connection_adapters/hsqldb_adapter.rb
12
+ lib/active_record/connection_adapters/informix_adapter.rb
13
+ lib/active_record/connection_adapters/jdbc_adapter.rb
14
+ lib/active_record/connection_adapters/jdbc_adapter_spec.rb
15
+ lib/active_record/connection_adapters/jndi_adapter.rb
16
+ lib/active_record/connection_adapters/mysql_adapter.rb
17
+ lib/active_record/connection_adapters/oracle_adapter.rb
18
+ lib/active_record/connection_adapters/postgresql_adapter.rb
19
+ lib/active_record/connection_adapters/sqlite3_adapter.rb
20
+ lib/jdbc_adapter/jdbc_cachedb.rb
21
+ lib/jdbc_adapter/jdbc_db2.rb
22
+ lib/jdbc_adapter/jdbc_derby.rb
23
+ lib/jdbc_adapter/jdbc_firebird.rb
24
+ lib/jdbc_adapter/jdbc_hsqldb.rb
25
+ lib/jdbc_adapter/jdbc_informix.rb
26
+ lib/jdbc_adapter/jdbc_mimer.rb
27
+ lib/jdbc_adapter/jdbc_mssql.rb
28
+ lib/jdbc_adapter/jdbc_mysql.rb
29
+ lib/jdbc_adapter/jdbc_oracle.rb
30
+ lib/jdbc_adapter/jdbc_postgre.rb
31
+ lib/jdbc_adapter/jdbc_sqlite3.rb
32
+ lib/jdbc_adapter/jdbc_sybase.rb
33
+ lib/jdbc_adapter/missing_functionality_helper.rb
34
+ lib/jdbc_adapter/rake_tasks.rb
35
+ lib/jdbc_adapter/tsql_helper.rb
36
+ lib/jdbc_adapter/version.rb
37
+ lib/jdbc_adapter/jdbc_adapter_internal.jar
38
+ test/abstract_db_create.rb
39
+ test/cachedb_simple_test.rb
40
+ test/db2_simple_test.rb
41
+ test/derby_migration_test.rb
42
+ test/derby_multibyte_test.rb
43
+ test/derby_simple_test.rb
44
+ test/generic_jdbc_connection_test.rb
45
+ test/h2_simple_test.rb
46
+ test/has_many_through.rb
47
+ test/helper.rb
48
+ test/hsqldb_simple_test.rb
49
+ test/informix_simple_test.rb
50
+ test/jdbc_common.rb
51
+ test/jndi_callbacks_test.rb
52
+ test/jndi_test.rb
53
+ test/manualTestDatabase.rb
54
+ test/minirunit.rb
55
+ test/mssql_simple_test.rb
56
+ test/mysql_db_create_test.rb
57
+ test/mysql_multibyte_test.rb
58
+ test/mysql_nonstandard_primary_key_test.rb
59
+ test/mysql_simple_test.rb
60
+ test/oracle_simple_test.rb
61
+ test/postgres_db_create_test.rb
62
+ test/postgres_mixed_case_test.rb
63
+ test/postgres_nonseq_pkey_test.rb
64
+ test/postgres_reserved_test.rb
65
+ test/postgres_simple_test.rb
66
+ test/simple.rb
67
+ test/sqlite3_simple_test.rb
68
+ test/sybase_jtds_simple_test.rb
69
+ test/activerecord/connection_adapters/type_conversion_test.rb
70
+ test/activerecord/connections/native_jdbc_mysql/connection.rb
71
+ test/db/cachedb.rb
72
+ test/db/db2.rb
73
+ test/db/derby.rb
74
+ test/db/h2.rb
75
+ test/db/hsqldb.rb
76
+ test/db/informix.rb
77
+ test/db/jdbc.rb
78
+ test/db/jndi_config.rb
79
+ test/db/logger.rb
80
+ test/db/mssql.rb
81
+ test/db/mysql.rb
82
+ test/db/oracle.rb
83
+ test/db/postgres.rb
84
+ test/db/sqlite3.rb
85
+ test/jdbc_adapter/jdbc_db2_test.rb
86
+ test/jdbc_adapter/jdbc_sybase_test.rb
87
+ test/minirunit/testConnect.rb
88
+ test/minirunit/testH2.rb
89
+ test/minirunit/testHsqldb.rb
90
+ test/minirunit/testLoadActiveRecord.rb
91
+ test/minirunit/testMysql.rb
92
+ test/minirunit/testRawSelect.rb
93
+ test/models/add_not_null_column_to_table.rb
94
+ test/models/auto_id.rb
95
+ test/models/data_types.rb
96
+ test/models/entry.rb
97
+ test/models/mixed_case.rb
98
+ test/models/reserved_word.rb
99
+ test/models/validates_uniqueness_of_string.rb
100
+ lib/jdbc_adapter/jdbc.rake
101
+ src/java/jdbc_adapter/JdbcAdapterInternalService.java
102
+ src/java/jdbc_adapter/JdbcConnectionFactory.java
103
+ src/java/jdbc_adapter/JdbcDerbySpec.java
104
+ src/java/jdbc_adapter/JdbcMySQLSpec.java
105
+ src/java/jdbc_adapter/MssqlRubyJdbcConnection.java
106
+ src/java/jdbc_adapter/PostgresRubyJdbcConnection.java
107
+ src/java/jdbc_adapter/RubyJdbcConnection.java
108
+ src/java/jdbc_adapter/SQLBlock.java
109
+ src/java/jdbc_adapter/Sqlite3RubyJdbcConnection.java
110
+ rakelib/compile.rake
111
+ rakelib/package.rake
112
+ rakelib/rails.rake
113
+ rakelib/test.rake
114
+ rails_generators/jdbc_generator.rb
115
+ rails_generators/templates
116
+ rails_generators/templates/jdbc.rake
117
+ rails_generators/templates/jdbc.rb
data/README.txt ADDED
@@ -0,0 +1,189 @@
1
+ activerecord-jdbc-adapter is a database adapter for Rails' ActiveRecord
2
+ component that can be used with JRuby[http://www.jruby.org/]. It allows use of
3
+ virtually any JDBC-compliant database with your JRuby on Rails application.
4
+
5
+ == Project Info
6
+
7
+ * Mailing Lists: http://kenai.com/projects/activerecord-jdbc/lists
8
+ * Issues: http://kenai.com/jira/browse/ACTIVERECORD_JDBC
9
+ * Source: git://kenai.com/activerecord-jdbc~main
10
+ git://github.com/nicksieger/activerecord-jdbc-adapter.git
11
+
12
+ == Databases
13
+
14
+ What's there, and what is not there:
15
+
16
+ * MySQL - Complete support
17
+ * PostgreSQL - Complete support
18
+ * Oracle - Complete support
19
+ * Microsoft SQL Server - Complete support except for change_column_default
20
+ * DB2 - Complete, except for the migrations:
21
+ * change_column
22
+ * change_column_default
23
+ * remove_column
24
+ * rename_column
25
+ * add_index
26
+ * remove_index
27
+ * rename_table
28
+ * FireBird - Complete, except for change_column_default and rename_column
29
+ * Derby - Complete, except for:
30
+ * change_column
31
+ * change_column_default
32
+ * remove_column
33
+ * rename_column
34
+ * HSQLDB - Complete
35
+ * H2 - Complete
36
+ * SQLite3 - work in progress
37
+ * Informix - Fairly complete support, all tests pass and migrations appear to work. Comments welcome.
38
+
39
+ Other databases will require testing and likely a custom configuration module.
40
+ Please join the activerecord-jdbc
41
+ mailing-lists[http://kenai.com/projects/activerecord-jdbc/lists] to help us discover
42
+ support for more databases.
43
+
44
+ == Using ActiveRecord JDBC
45
+
46
+ === Inside Rails
47
+
48
+ To use activerecord-jdbc-adapter with JRuby on Rails:
49
+
50
+ 1. Choose the adapter you wish to gem install. The following pre-packaged
51
+ adapters are available:
52
+
53
+ * base jdbc (<tt>activerecord-jdbc-adapter</tt>). Supports all available databases via JDBC, but requires you to download and manually install the database vendor's JDBC driver .jar file.
54
+ * mysql (<tt>activerecord-jdbcmysql-adapter</tt>)
55
+ * postgresql (<tt>activerecord-jdbcpostgresql-adapter</tt>)
56
+ * derby (<tt>activerecord-jdbcderby-adapter</tt>)
57
+ * hsqldb (<tt>activerecord-jdbchsqldb-adapter</tt>)
58
+ * h2 (<tt>activerecord-jdbch2-adapter</tt>)
59
+ * sqlite3 (<tt>activerecord-jdbcsqlite3-adapter</tt>)
60
+
61
+ 2. Run the "jdbc" generator to prepare your Rails application for
62
+ JDBC.
63
+
64
+ jruby script/generate jdbc
65
+
66
+ The initializer and rake task files generated are guarded such that
67
+ they won't be loaded if you still run your application under C Ruby.
68
+
69
+ Legacy: If you're using Rails prior to version 2.0, you'll need to
70
+ add one-time setup to your config/environment.rb file in your Rails
71
+ application. Add the following lines just before the
72
+ <code>Rails::Initializer</code>. (If you're using
73
+ activerecord-jdbc-adapter under the old gem name used in versions
74
+ 0.5 and earlier (ActiveRecord-JDBC), replace
75
+ 'activerecord-jdbc-adapter' with 'ActiveRecord-JDBC' below.)
76
+
77
+ if RUBY_PLATFORM =~ /java/
78
+ require 'rubygems'
79
+ gem 'activerecord-jdbc-adapter'
80
+ require 'jdbc_adapter'
81
+ end
82
+
83
+ 3. Configure your database.yml in the normal Rails style.
84
+
85
+ Legacy configuration: If you use one of the convenience
86
+ 'activerecord-jdbcXXX-adapter' adapters, you can still put a 'jdbc'
87
+ prefix in front of the database adapter name as below.
88
+
89
+ development:
90
+ adapter: jdbcmysql
91
+ username: blog
92
+ password:
93
+ hostname: localhost
94
+ database: weblog_development
95
+
96
+ For other databases, you'll need to know the database driver class
97
+ and URL. Example:
98
+
99
+ development:
100
+ adapter: jdbc
101
+ username: blog
102
+ password:
103
+ driver: com.mysql.jdbc.Driver
104
+ url: jdbc:mysql://localhost:3306/weblog_development
105
+
106
+ === Standalone, with ActiveRecord
107
+
108
+ 1. Install the gem with JRuby:
109
+
110
+ jruby -S gem install activerecord-jdbc-adapter
111
+
112
+ If you wish to use the adapter for a specific database, you can install it
113
+ directly and a driver gem will be installed as well:
114
+
115
+ jruby -S gem install activerecord-jdbcderby-adapter
116
+
117
+ 2. If using ActiveRecord 2.0 (Rails 2.0) or greater, you can skip to the next
118
+ step. Otherwise, ensure the following code gets executed in your script:
119
+
120
+ require 'rubygems'
121
+ gem 'activerecord-jdbc-adapter'
122
+ require 'jdbc_adapter'
123
+ require 'active_record'
124
+
125
+ 3. After this you can establish a JDBC connection like this:
126
+
127
+ ActiveRecord::Base.establish_connection(
128
+ :adapter => 'jdbcderby',
129
+ :database => "db/my-database"
130
+ )
131
+
132
+ or like this (but requires that you manually put the driver jar on the classpath):
133
+
134
+ ActiveRecord::Base.establish_connection(
135
+ :adapter => 'jdbc',
136
+ :driver => 'org.apache.derby.jdbc.EmbeddedDriver',
137
+ :url => 'jdbc:derby:test_ar;create=true'
138
+ )
139
+
140
+ == Getting the source
141
+
142
+ The source for activerecord-jdbc-adapter is available using git.
143
+
144
+ git clone git://github.com/nicksieger/activerecord-jdbc-adapter.git
145
+
146
+ == Feedback
147
+
148
+ Please file bug reports at
149
+ http://kenai.com/jira/browse/ACTIVERECORD_JDBC. If you're not sure if
150
+ something's a bug, feel free to pre-report it on the mailing lists.
151
+
152
+ == Running AR-JDBC's Tests
153
+
154
+ Drivers for 6 open-source databases are included. Provided you have MySQL
155
+ installed, you can simply type <tt>jruby -S rake</tt> to run the tests. A
156
+ database named <tt>weblog_development</tt> is needed beforehand with a
157
+ connection user of "blog" and an empty password.
158
+
159
+ If you also have PostgreSQL available, those tests will be run if the
160
+ `psql' executable can be found. Also ensure you have a database named
161
+ <tt>weblog_development</tt> and a user named "blog" and an empty
162
+ password.
163
+
164
+ If you want rails logging enabled during these test runs you can edit
165
+ test/jdbc_common.rb and add the following line:
166
+
167
+ require 'db/logger'
168
+
169
+ == Running AR Tests
170
+
171
+ To run the current AR-JDBC sources with ActiveRecord, just use the
172
+ included "rails:test" task. Be sure to specify a driver and a path to
173
+ the ActiveRecord sources.
174
+
175
+ jruby -S rake rails:test DRIVER=mysql RAILS=/path/activerecord_source_dir
176
+
177
+ == Authors
178
+
179
+ This project was written by Nick Sieger <nick@nicksieger.com> and Ola Bini
180
+ <olabini@gmail.com> with lots of help from the JRuby community.
181
+
182
+ == License
183
+
184
+ activerecord-jdbc-adapter is released under a BSD license. See the LICENSE file
185
+ included with the distribution for details.
186
+
187
+ Open-source driver gems for activerecord-jdbc-adapter are licensed under the
188
+ same license the database's drivers are licensed. See each driver gem's
189
+ LICENSE.txt file for details.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'rake/testtask'
2
+ require 'rake/clean'
3
+ CLEAN.include 'derby*', 'test.db.*','test/reports', 'test.sqlite3','lib/**/*.jar','manifest.mf', '*.log'
4
+
5
+ task :default => [:java_compile, :test]
6
+
7
+ task :filelist do
8
+ puts FileList['pkg/**/*'].inspect
9
+ end
10
+
@@ -0,0 +1 @@
1
+ require 'active_record/connection_adapters/jdbc_adapter'
@@ -0,0 +1,13 @@
1
+ tried_gem = false
2
+ begin
3
+ require "jdbc/derby"
4
+ rescue LoadError
5
+ unless tried_gem
6
+ require 'rubygems'
7
+ gem "jdbc-derby"
8
+ tried_gem = true
9
+ retry
10
+ end
11
+ # trust that the derby jar is already present
12
+ end
13
+ require 'active_record/connection_adapters/jdbc_adapter'
@@ -0,0 +1,13 @@
1
+ tried_gem = false
2
+ begin
3
+ require "jdbc/h2"
4
+ rescue LoadError
5
+ unless tried_gem
6
+ require 'rubygems'
7
+ gem "jdbc-h2"
8
+ tried_gem = true
9
+ retry
10
+ end
11
+ # trust that the hsqldb jar is already present
12
+ end
13
+ require 'active_record/connection_adapters/jdbc_adapter'
@@ -0,0 +1,13 @@
1
+ tried_gem = false
2
+ begin
3
+ require "jdbc/hsqldb"
4
+ rescue LoadError
5
+ unless tried_gem
6
+ require 'rubygems'
7
+ gem "jdbc-hsqldb"
8
+ tried_gem = true
9
+ retry
10
+ end
11
+ # trust that the hsqldb jar is already present
12
+ end
13
+ require 'active_record/connection_adapters/jdbc_adapter'
@@ -0,0 +1 @@
1
+ require 'active_record/connection_adapters/jdbc_adapter'