activerecord-jdbc-adapter 1.3.19 → 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19e56fe06c05f03b099bb62c6d6cad31e533d206
4
- data.tar.gz: b48a142b0ed768d61928d393f66f5f23ef104237
3
+ metadata.gz: 82589d846e5ee11d8bd85ffb825c8b58571ef837
4
+ data.tar.gz: 9bda0dc210283b928b1c97a8b66e72b17348635c
5
5
  SHA512:
6
- metadata.gz: f3f2e725dcbaf68da28f4a4dbec5815d350132d8383980adc608a2b269f6a55e2efc90e42169178c432b98d22063abcdd602159b46cf17bb663f3adeb186ad04
7
- data.tar.gz: b1c911e93edfcc4f25c9ac0e091541fa0834f1e6b731c0bbcc57e5df6b06014a3b83fb87c11b241a36f9697b6f02a22fa0c709c57eba5d3b350525447325dc4c
6
+ metadata.gz: 914c271374806217b3e5396036d5e147c7dd56f6fc06515c121715e9abce9a4b91dd70daf91423029d35380d43d20938fd6d75aa9c8295079a0844e93e32202b
7
+ data.tar.gz: 511b7f9fe9adbc153cf2d1fca7992f63341db16097abeba55563b465e81634429460d35e1118864098e53459192ad07e5fd3c3121c61c6e5f24b7e21a3c00711
@@ -8,10 +8,9 @@ before_script:
8
8
  before_install:
9
9
  - ((jruby -v | grep 1.8.7) && jruby --1.9 -S gem update --system 2.1.11) || true
10
10
  rvm:
11
- - jruby-1.7.18
12
- #- jruby-head # 9000 ignores --1.8 and --1.9 switches
11
+ - jruby-1.7.24
13
12
  jdk:
14
- - openjdk6
13
+ - openjdk7
15
14
  gemfile:
16
15
  - gemfiles/rails23.gemfile
17
16
  - gemfiles/rails30.gemfile
@@ -46,102 +45,219 @@ branches:
46
45
  - /.*-stable$/
47
46
  - /^test-.*/
48
47
  matrix:
49
- #allow_failures:
50
- # - env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jdbc
51
- # - env: JRUBY_OPTS="--1.9 $JRUBY_OPTS" DB=jdbc PREPARED_STATEMENTS=true
52
- include: # testing against MariaDB
48
+ allow_failures:
49
+ # yet another BC timestamp issue: <Wed, 31 Dec -0001 22:58:59 +0000> expected but was <Fri, 02 Jan 0000 22:58:59 +0000>
50
+ - rvm: jruby-9.0.5.0
51
+ gemfile: gemfiles/rails41.gemfile
52
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql
53
+ jdk: oraclejdk7
54
+ # ``/system call symlink regression (since JRuby 1.7.19)
55
+ # + (postgres) database_tasks got updated on 4.2 : https://github.com/rails/rails/commit/07f8a96aa14b642a86
56
+ - rvm: jruby-1.7.24
57
+ gemfile: gemfiles/rails42.gemfile
58
+ env: JRUBY_OPTS="--1.9 $JRUBY_OPTS" DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
59
+ - rvm: jruby-1.7.24
60
+ gemfile: gemfiles/rails42.gemfile
61
+ env: JRUBY_OPTS="--1.9 $JRUBY_OPTS" DB=postgresql PREPARED_STATEMENTS=true
62
+ - rvm: jruby-1.7.24
63
+ gemfile: gemfiles/rails42.gemfile
64
+ env: JRUBY_OPTS="--1.9 $JRUBY_OPTS" DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
65
+ - rvm: jruby-1.7.24
66
+ gemfile: gemfiles/rails42.gemfile
67
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql
68
+ include:
69
+ # testing against MariaDB
53
70
  - addons:
54
71
  mariadb: '5.5'
55
- rvm: jruby-1.7.18
72
+ rvm: jruby-1.7.24
56
73
  gemfile: gemfiles/rails32.gemfile
57
74
  env: JRUBY_OPTS="$JRUBY_OPTS" DB=mysql
58
- jdk: openjdk7
75
+ jdk: openjdk6
59
76
  - addons:
60
77
  mariadb: '10.0'
61
- rvm: jruby-1.7.18
78
+ rvm: jruby-1.7.24
62
79
  gemfile: gemfiles/rails40.gemfile
63
80
  env: JRUBY_OPTS="$JRUBY_OPTS" DB=mariadb
64
81
  jdk: openjdk7
65
82
  - addons:
66
83
  mariadb: '10.0'
67
- rvm: jruby-1.7.18
84
+ rvm: jruby-1.7.24
68
85
  gemfile: gemfiles/rails41.gemfile
69
86
  env: JRUBY_OPTS="$JRUBY_OPTS" DB=mariadb PREPARED_STATEMENTS=true
70
- jdk: openjdk7
87
+ jdk: oraclejdk8
88
+ # include some tests on JDK 6 :
89
+ - rvm: jruby-1.7.24
90
+ gemfile: gemfiles/rails42.gemfile
91
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=mysql
92
+ jdk: openjdk6
93
+ - rvm: jruby-1.7.24
94
+ gemfile: gemfiles/rails42.gemfile
95
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql
96
+ jdk: openjdk6
97
+ - rvm: jruby-1.7.24
98
+ gemfile: gemfiles/rails42.gemfile
99
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=sqlite3
100
+ jdk: openjdk6
101
+ - rvm: jruby-1.7.24
102
+ gemfile: gemfiles/rails42.gemfile
103
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=derby
104
+ jdk: openjdk6
105
+ - rvm: jruby-1.7.24
106
+ gemfile: gemfiles/rails42.gemfile
107
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=h2
108
+ jdk: openjdk6
109
+ - rvm: jruby-1.7.24
110
+ gemfile: gemfiles/rails42.gemfile
111
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=hsqldb
112
+ jdk: openjdk6
113
+ # include testing with JRuby 9K (4.2) :
114
+ - rvm: jruby-9.0.5.0
115
+ gemfile: gemfiles/rails42.gemfile
116
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=mysql PREPARED_STATEMENTS=true
117
+ jdk: oraclejdk7
118
+ - rvm: jruby-9.0.5.0
119
+ gemfile: gemfiles/rails42.gemfile
120
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql PREPARED_STATEMENTS=true
121
+ jdk: oraclejdk7
122
+ - rvm: jruby-9.0.5.0
123
+ gemfile: gemfiles/rails42.gemfile
124
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=sqlite3
125
+ jdk: oraclejdk7
126
+ - rvm: jruby-9.0.5.0
127
+ gemfile: gemfiles/rails42.gemfile
128
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=mysql
129
+ jdk: oraclejdk8
130
+ - rvm: jruby-9.0.5.0
131
+ gemfile: gemfiles/rails42.gemfile
132
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql
133
+ jdk: oraclejdk8
134
+ - rvm: jruby-9.0.5.0
135
+ gemfile: gemfiles/rails42.gemfile
136
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=sqlite3
137
+ jdk: oraclejdk8
138
+ - rvm: jruby-9.0.5.0
139
+ gemfile: gemfiles/rails42.gemfile
140
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=derby
141
+ jdk: oraclejdk8
142
+ - rvm: jruby-9.0.5.0
143
+ gemfile: gemfiles/rails42.gemfile
144
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=h2
145
+ jdk: oraclejdk8
146
+ - rvm: jruby-9.0.5.0
147
+ gemfile: gemfiles/rails42.gemfile
148
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=hsqldb
149
+ jdk: oraclejdk8
150
+ # include testing with JRuby 9K (4.1) :
151
+ - rvm: jruby-9.0.5.0
152
+ gemfile: gemfiles/rails41.gemfile
153
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=mysql PREPARED_STATEMENTS=true
154
+ jdk: oraclejdk8
155
+ - rvm: jruby-9.0.5.0
156
+ gemfile: gemfiles/rails41.gemfile
157
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql PREPARED_STATEMENTS=true
158
+ jdk: oraclejdk8
159
+ - rvm: jruby-9.0.5.0
160
+ gemfile: gemfiles/rails41.gemfile
161
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=sqlite3
162
+ jdk: oraclejdk8
163
+ - rvm: jruby-9.0.5.0
164
+ gemfile: gemfiles/rails41.gemfile
165
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=mysql
166
+ jdk: oraclejdk7
167
+ - rvm: jruby-9.0.5.0
168
+ gemfile: gemfiles/rails41.gemfile
169
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=postgresql
170
+ jdk: oraclejdk7
171
+ - rvm: jruby-9.0.5.0
172
+ gemfile: gemfiles/rails41.gemfile
173
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=sqlite3
174
+ jdk: oraclejdk8
175
+ - rvm: jruby-9.0.5.0
176
+ gemfile: gemfiles/rails41.gemfile
177
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=derby
178
+ jdk: oraclejdk7
179
+ - rvm: jruby-9.0.5.0
180
+ gemfile: gemfiles/rails41.gemfile
181
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=h2
182
+ jdk: oraclejdk7
183
+ - rvm: jruby-9.0.5.0
184
+ gemfile: gemfiles/rails41.gemfile
185
+ env: JRUBY_OPTS="$JRUBY_OPTS" DB=hsqldb
186
+ jdk: oraclejdk8
71
187
  exclude:
72
188
  # Rails 4 prefers Ruby 2.0 (or at least >= 1.9.3) :
73
- - rvm: jruby-1.7.18
189
+ - rvm: jruby-1.7.24
74
190
  gemfile: gemfiles/rails40.gemfile
75
191
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=mysql
76
- - rvm: jruby-1.7.18
192
+ - rvm: jruby-1.7.24
77
193
  gemfile: gemfiles/rails40.gemfile
78
194
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=postgresql
79
- - rvm: jruby-1.7.18
195
+ - rvm: jruby-1.7.24
80
196
  gemfile: gemfiles/rails40.gemfile
81
197
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=sqlite3
82
- - rvm: jruby-1.7.18
198
+ - rvm: jruby-1.7.24
83
199
  gemfile: gemfiles/rails40.gemfile
84
200
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=derby
85
- - rvm: jruby-1.7.18
201
+ - rvm: jruby-1.7.24
86
202
  gemfile: gemfiles/rails40.gemfile
87
203
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=h2
88
- - rvm: jruby-1.7.18
204
+ - rvm: jruby-1.7.24
89
205
  gemfile: gemfiles/rails40.gemfile
90
206
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=hsqldb
91
- - rvm: jruby-1.7.18
207
+ - rvm: jruby-1.7.24
92
208
  gemfile: gemfiles/rails40.gemfile
93
209
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jndi
94
- - rvm: jruby-1.7.18
210
+ - rvm: jruby-1.7.24
95
211
  gemfile: gemfiles/rails40.gemfile
96
212
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jdbc
97
213
  # Rails 4.1 does not support Ruby 1.8 :
98
- - rvm: jruby-1.7.18
214
+ - rvm: jruby-1.7.24
99
215
  gemfile: gemfiles/rails41.gemfile
100
216
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=mysql
101
- - rvm: jruby-1.7.18
217
+ - rvm: jruby-1.7.24
102
218
  gemfile: gemfiles/rails41.gemfile
103
219
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=postgresql
104
- - rvm: jruby-1.7.18
220
+ - rvm: jruby-1.7.24
105
221
  gemfile: gemfiles/rails41.gemfile
106
222
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=sqlite3
107
- - rvm: jruby-1.7.18
223
+ - rvm: jruby-1.7.24
108
224
  gemfile: gemfiles/rails41.gemfile
109
225
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=derby
110
- - rvm: jruby-1.7.18
226
+ - rvm: jruby-1.7.24
111
227
  gemfile: gemfiles/rails41.gemfile
112
228
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=h2
113
- - rvm: jruby-1.7.18
229
+ - rvm: jruby-1.7.24
114
230
  gemfile: gemfiles/rails41.gemfile
115
231
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=hsqldb
116
- - rvm: jruby-1.7.18
232
+ - rvm: jruby-1.7.24
117
233
  gemfile: gemfiles/rails41.gemfile
118
234
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jndi
119
- - rvm: jruby-1.7.18
235
+ - rvm: jruby-1.7.24
120
236
  gemfile: gemfiles/rails41.gemfile
121
237
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jdbc
122
238
  # Rails 4.2 will not support Ruby 1.8 :
123
- - rvm: jruby-1.7.18
239
+ - rvm: jruby-1.7.24
124
240
  gemfile: gemfiles/rails42.gemfile
125
241
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=mysql
126
- - rvm: jruby-1.7.18
242
+ - rvm: jruby-1.7.24
127
243
  gemfile: gemfiles/rails42.gemfile
128
244
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=postgresql
129
- - rvm: jruby-1.7.18
245
+ - rvm: jruby-1.7.24
130
246
  gemfile: gemfiles/rails42.gemfile
131
247
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=sqlite3
132
- - rvm: jruby-1.7.18
248
+ - rvm: jruby-1.7.24
133
249
  gemfile: gemfiles/rails42.gemfile
134
250
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=derby
135
- - rvm: jruby-1.7.18
251
+ - rvm: jruby-1.7.24
136
252
  gemfile: gemfiles/rails42.gemfile
137
253
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=h2
138
- - rvm: jruby-1.7.18
254
+ - rvm: jruby-1.7.24
139
255
  gemfile: gemfiles/rails42.gemfile
140
256
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=hsqldb
141
- - rvm: jruby-1.7.18
257
+ - rvm: jruby-1.7.24
142
258
  gemfile: gemfiles/rails42.gemfile
143
259
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jndi
144
- - rvm: jruby-1.7.18
260
+ - rvm: jruby-1.7.24
145
261
  gemfile: gemfiles/rails42.gemfile
146
262
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jdbc
147
263
  ## JRuby 9K :
@@ -280,19 +396,19 @@ matrix:
280
396
  - rvm: jruby-head
281
397
  gemfile: gemfiles/rails41.gemfile
282
398
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=sqlite3
283
- - rvm: jruby-1.7.18
399
+ - rvm: jruby-1.7.24
284
400
  gemfile: gemfiles/rails41.gemfile
285
401
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=derby
286
- - rvm: jruby-1.7.18
402
+ - rvm: jruby-1.7.24
287
403
  gemfile: gemfiles/rails41.gemfile
288
404
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=h2
289
- - rvm: jruby-1.7.18
405
+ - rvm: jruby-1.7.24
290
406
  gemfile: gemfiles/rails41.gemfile
291
407
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=hsqldb
292
- - rvm: jruby-1.7.18
408
+ - rvm: jruby-1.7.24
293
409
  gemfile: gemfiles/rails41.gemfile
294
410
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jndi
295
- - rvm: jruby-1.7.18
411
+ - rvm: jruby-1.7.24
296
412
  gemfile: gemfiles/rails41.gemfile
297
413
  env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" DB=jdbc
298
414
  # Rails 4.2 (JRuby 9K) :
data/History.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 1.3.20 (03/09/16)
2
+
3
+ - Retrieve AM::Type::Boolean::FALSE_VALUES for Rails 5 (#705)
4
+ - [mysql] only mock mysql / mysql2 error under adapter /mysql/
5
+ and make sure db:create works (#702)
6
+ - use system instead of `` to run dumps (on < 4.0) as it has issues under 1.7.x
7
+ - avoid column.default type_cast-ing on AR 4.2 (#715)
8
+ - [postgres] data_sources support - backport on AR 4.2
9
+ - add support for data sources (backport on AR 4.2) in base (jdbc) adapter
10
+ - [derby] Enable DDL transaction on Derby (#714)
11
+ - [db2] support for DB2 big integer (BIGINT) data type
12
+ - [mysql] Fixed MySQL primary key for MySQL >= 5.7.3 (#695)
13
+ - [sqlite] on AR 4.2 is not supposed to have an implicit string limit: 255
14
+ - [postgres] on AR 4.2 is not supposed to have an implicit string limit: 255
15
+
1
16
  ## 1.3.19 (11/02/15)
2
17
 
3
18
  - [sqlite] add supports_partial_index? and remove duplicate support_index_sort_order?
@@ -118,6 +118,7 @@ module ArJdbc
118
118
  NATIVE_DATABASE_TYPES = {
119
119
  :string => { :name => "varchar", :limit => 255 },
120
120
  :integer => { :name => "integer" },
121
+ :bigint => { :name => 'bigint' },
121
122
  :float => { :name => "real" }, # :limit => 24
122
123
  :double => { :name => "double" }, # :limit => 53
123
124
  :text => { :name => "clob" },
@@ -433,6 +433,9 @@ module ArJdbc
433
433
  @connection.tables(nil, current_schema)
434
434
  end
435
435
 
436
+ # @override
437
+ def supports_ddl_transactions?; true end
438
+
436
439
  # @override
437
440
  def supports_foreign_keys?; true end
438
441
 
@@ -618,6 +618,16 @@ module ActiveRecord
618
618
  @connection.table_exists?(name) # schema_name = nil
619
619
  end
620
620
 
621
+ # @override
622
+ def data_sources
623
+ tables
624
+ end if ArJdbc::AR42
625
+
626
+ # @override
627
+ def data_source_exists?(name)
628
+ table_exists?(name)
629
+ end if ArJdbc::AR42
630
+
621
631
  # @override
622
632
  def indexes(table_name, name = nil, schema_name = nil)
623
633
  @connection.indexes(table_name, name, schema_name)
@@ -26,7 +26,6 @@ module ActiveRecord
26
26
  end
27
27
  end
28
28
  default = default_value(default)
29
- default = args[0].type_cast_from_database(default) if ArJdbc::AR42
30
29
 
31
30
  # super <= 4.1: (name, default, sql_type = nil, null = true)
32
31
  # super >= 4.2: (name, default, cast_type, sql_type = nil, null = true)
@@ -6,8 +6,8 @@ module ActiveRecord::ConnectionAdapters
6
6
  # @private Simply to quickly "hack-in" 4.2 compatibility.
7
7
  module TypeCast
8
8
 
9
- TRUE_VALUES = Column::TRUE_VALUES
10
- FALSE_VALUES = Column::FALSE_VALUES
9
+ TRUE_VALUES = Column::TRUE_VALUES if Column.const_defined?(:TRUE_VALUES)
10
+ FALSE_VALUES = Column.const_defined?(:FALSE_VALUES) ? Column::FALSE_VALUES : ActiveModel::Type::Boolean::FALSE_VALUES
11
11
 
12
12
  #module Format
13
13
  ISO_DATE = Column::Format::ISO_DATE
@@ -58,7 +58,16 @@ module ActiveRecord::ConnectionAdapters
58
58
  else
59
59
  TRUE_VALUES.include?(value)
60
60
  end
61
- end
61
+ end if const_defined?(:TRUE_VALUES) # removed on AR 5.0
62
+
63
+ # convert something to a boolean
64
+ def value_to_boolean(value)
65
+ if value.is_a?(String) && value.empty?
66
+ nil
67
+ else
68
+ ! FALSE_VALUES.include?(value)
69
+ end
70
+ end unless const_defined?(:TRUE_VALUES)
62
71
 
63
72
  # Used to convert values to integer.
64
73
  # handle the case when an integer column is used to store boolean values
@@ -98,7 +98,7 @@ module ArJdbc
98
98
  def self.emulate_booleans=(emulate); @@emulate_booleans = emulate; end
99
99
 
100
100
  NATIVE_DATABASE_TYPES = {
101
- :primary_key => "int(11) DEFAULT NULL auto_increment PRIMARY KEY",
101
+ :primary_key => "int(11) auto_increment PRIMARY KEY",
102
102
  :string => { :name => "varchar", :limit => 255 },
103
103
  :text => { :name => "text" },
104
104
  :integer => { :name => "int", :limit => 4 },
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  ArJdbc.load_java_part :PostgreSQL
2
3
 
3
4
  require 'ipaddr'
@@ -281,6 +282,7 @@ module ArJdbc
281
282
  }) if AR40
282
283
 
283
284
  NATIVE_DATABASE_TYPES.update(
285
+ :string => { :name => "character varying" },
284
286
  :bigserial => "bigserial",
285
287
  :bigint => { :name => "bigint" },
286
288
  :bit => { :name => "bit" },
@@ -1302,7 +1304,9 @@ module ArJdbc
1302
1304
 
1303
1305
  # @private
1304
1306
  TABLES_SQL = 'SELECT tablename FROM pg_tables WHERE schemaname = ANY (current_schemas(false))'
1307
+ private_constant :TABLES_SQL rescue nil
1305
1308
 
1309
+ # @override
1306
1310
  def tables(name = nil)
1307
1311
  select_values(TABLES_SQL, 'SCHEMA')
1308
1312
  end
@@ -1316,6 +1320,7 @@ module ArJdbc
1316
1320
  TABLE_EXISTS_SQL_PREFIX << " WHERE c.relkind IN ('r','v')"
1317
1321
  end
1318
1322
  TABLE_EXISTS_SQL_PREFIX << " AND c.relname = ?"
1323
+ private_constant :TABLE_EXISTS_SQL_PREFIX rescue nil
1319
1324
 
1320
1325
  # Returns true if table exists.
1321
1326
  # If the schema is not specified as part of +name+ then it will only find tables within
@@ -1333,6 +1338,19 @@ module ArJdbc
1333
1338
  @connection.execute_query_raw(sql, binds).first['table_count'] > 0
1334
1339
  end
1335
1340
  end
1341
+ alias data_source_exists? table_exists?
1342
+
1343
+ # @private
1344
+ DATA_SOURCES_SQL = 'SELECT c.relname FROM pg_class c'
1345
+ DATA_SOURCES_SQL << ' LEFT JOIN pg_namespace n ON n.oid = c.relnamespace'
1346
+ DATA_SOURCES_SQL << " WHERE c.relkind IN ('r', 'v','m')" # -- (r)elation/table, (v)iew, (m)aterialized view
1347
+ DATA_SOURCES_SQL << ' AND n.nspname = ANY (current_schemas(false))'
1348
+ private_constant :DATA_SOURCES_SQL rescue nil
1349
+
1350
+ # @override
1351
+ def data_sources
1352
+ select_values(DATA_SOURCES_SQL, 'SCHEMA')
1353
+ end
1336
1354
 
1337
1355
  def drop_table(table_name, options = {})
1338
1356
  execute "DROP TABLE #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}"
@@ -128,6 +128,9 @@ module ArJdbc
128
128
  :binary => { :name => "blob" },
129
129
  :boolean => { :name => "boolean" }
130
130
  }
131
+ NATIVE_DATABASE_TYPES.update(
132
+ :string => { :name => "varchar" }
133
+ ) if AR42
131
134
 
132
135
  # @override
133
136
  def native_database_types
@@ -1,11 +1,3 @@
1
- # NOTE: fake these for create_database(config)
2
- module Mysql
3
- Error = ActiveRecord::JDBCError unless const_defined?(:Error)
4
- end
5
- module Mysql2
6
- Error = ActiveRecord::JDBCError unless const_defined?(:Error)
7
- end
8
-
9
1
  module ArJdbc
10
2
  module Tasks
11
3
  class << self
@@ -53,7 +45,27 @@ namespace :db do
53
45
 
54
46
  def create_database(config)
55
47
  case config['adapter']
56
- when /mysql|postgresql|sqlite/
48
+ when /mysql2/
49
+ unless defined? Mysql2::Error
50
+ # NOTE: fake it for create_database(config)
51
+ Object.const_set :Mysql2, Module.new
52
+ Mysql2.const_set :Error, ActiveRecord::JDBCError
53
+ ActiveRecord::JDBCError.class_eval do
54
+ def error; self end # Mysql2::Error#error
55
+ end
56
+ end
57
+ _rails_create_database adapt_jdbc_config(config)
58
+ when /mysql/
59
+ unless defined? Mysql::Error
60
+ # NOTE: fake it for create_database(config)
61
+ Object.const_set :Mysql, Module.new
62
+ Mysql.const_set :Error, ActiveRecord::JDBCError
63
+ ActiveRecord::JDBCError.class_eval do
64
+ def error; self end # Mysql::Error#error
65
+ end
66
+ end
67
+ _rails_create_database adapt_jdbc_config(config)
68
+ when /postgresql|sqlite/
57
69
  _rails_create_database adapt_jdbc_config(config)
58
70
  else
59
71
  ArJdbc::Tasks.create(config)
@@ -100,13 +112,12 @@ namespace :db do
100
112
  unless search_path.blank?
101
113
  search_path = search_path.split(",").map{ |part| "--schema=#{Shellwords.escape(part.strip)}" }.join(" ")
102
114
  end
103
- `pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}`
104
- raise 'Error dumping database' if $?.exitstatus == 1
115
+ sh "pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}"
105
116
 
106
117
  File.open(filename, 'a') { |f| f << "SET search_path TO #{ActiveRecord::Base.connection.schema_search_path};\n\n" }
107
118
  when /sqlite/
108
119
  dbfile = config['database']
109
- `sqlite3 #{dbfile} .schema > #{filename}`
120
+ sh "sqlite3 #{dbfile} .schema > #{filename}"
110
121
  else
111
122
  ActiveRecord::Base.establish_connection(config)
112
123
  ArJdbc::Tasks.structure_dump(config, filename)
@@ -115,10 +126,11 @@ namespace :db do
115
126
  if ActiveRecord::Base.connection.supports_migrations?
116
127
  File.open(filename, 'a') { |f| f << ActiveRecord::Base.connection.dump_schema_information }
117
128
  end
129
+
118
130
  end
119
131
 
120
132
  redefine_task :load do
121
- config = current_config
133
+ config = current_config
122
134
  filename = structure_sql
123
135
 
124
136
  case config['adapter']
@@ -1,5 +1,5 @@
1
1
  module ArJdbc
2
- VERSION = "1.3.19"
2
+ VERSION = "1.3.20"
3
3
  # @deprecated
4
4
  module Version
5
5
  # @private 1.2.x compatibility
@@ -41,7 +41,7 @@ def test_task_for(adapter, options = {})
41
41
  test_task = Rake::TestTask.new(name => prereqs) do |test_task|
42
42
  files = options[:files] || begin
43
43
  FileList["test/#{adapter}*_test.rb"] +
44
- FileList["test/db/#{adapter}/*_test.rb"]
44
+ FileList["test/db/#{adapter}/**/*_test.rb"]
45
45
  end
46
46
  test_task.test_files = files
47
47
  test_task.libs = []
@@ -56,6 +56,7 @@ def test_task_for(adapter, options = {})
56
56
  if defined?(JRUBY_VERSION) && JRUBY_VERSION.index('1.7') == 0
57
57
  test_task.ruby_opts << "--#{RUBY_VERSION[/^(\d+\.\d+)/, 1]}"
58
58
  end
59
+ test_task.options = '--use-color=t'
59
60
  test_task.verbose = true if $VERBOSE
60
61
  yield(test_task) if block_given?
61
62
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbc-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.19
4
+ version: 1.3.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-02 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activerecord
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '2.2'
20
14
  requirement: !ruby/object:Gem::Requirement
21
15
  requirements:
22
- - - '>='
16
+ - - ">="
23
17
  - !ruby/object:Gem::Version
24
18
  version: '2.2'
19
+ name: activerecord
25
20
  prerelease: false
26
21
  type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
27
27
  description: 'AR-JDBC is a database adapter for Rails'' ActiveRecord component designed
28
28
  to be used with JRuby built upon Java''s JDBC API for database access. Provides
29
29
  (ActiveRecord) built-in adapters: MySQL, PostgreSQL and SQLite3 as well as adapters
@@ -38,9 +38,9 @@ executables: []
38
38
  extensions: []
39
39
  extra_rdoc_files: []
40
40
  files:
41
- - .gitignore
42
- - .travis.yml
43
- - .yardopts
41
+ - ".gitignore"
42
+ - ".travis.yml"
43
+ - ".yardopts"
44
44
  - Appraisals
45
45
  - CONTRIBUTING.md
46
46
  - Gemfile
@@ -233,21 +233,21 @@ licenses:
233
233
  metadata: {}
234
234
  post_install_message:
235
235
  rdoc_options:
236
- - --main
236
+ - "--main"
237
237
  - README.md
238
- - -SHN
239
- - -f
238
+ - "-SHN"
239
+ - "-f"
240
240
  - darkfish
241
241
  require_paths:
242
242
  - lib
243
243
  required_ruby_version: !ruby/object:Gem::Requirement
244
244
  requirements:
245
- - - '>='
245
+ - - ">="
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
- - - '>='
250
+ - - ">="
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []