activerecord-jdbc-adapter 1.3.9 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb8275489a147bf60f8705498a80efe51ec395cc
4
- data.tar.gz: 757b6d0d663b6d94499d42bb4aa27873456b1034
3
+ metadata.gz: 11049989079fcc38fceef1db1689c5db555fd37e
4
+ data.tar.gz: 01a9dab21474a9548126ee80d840264f8d0018f5
5
5
  SHA512:
6
- metadata.gz: 309e8913e85548dc626989380c8b6d0f3cd5cd66e98912b30d160995cb69e1b984a2671004c7ca26b8e5c5b2e4b0ab003e451958fa6656f25643a03aca296e09
7
- data.tar.gz: 67e41e8ef986c2d4bc113f8d85a5ed5e2ef947e353ca6dd75fa607ebb1cbbc09a0d502afafc017a29e9927bd248dd5d05c6b44ccbd8cadfe72f1ddfa3618ff63
6
+ metadata.gz: ed02de30c898c0a8fba369ef315572e16997b19436828294a367c93fd1101ae7bd077c7989d0372f524b87bf66cb6a421b4ac8e6d682d7d4655eb5cfc2157156
7
+ data.tar.gz: 1dafdc93914c961ae1894d79e23b8f7b10c957fd183c96fd471031c16ff2dd6f87b786a8554770ea79612131f406742088c0bbb3dc2ab7ae7fb94fcd32f255be
data/Gemfile CHANGED
@@ -51,3 +51,7 @@ end
51
51
  gem 'mysql2', :require => nil, :platform => :mri, :group => :test
52
52
  gem 'pg', :require => nil, :platform => :mri, :group => :test
53
53
  gem 'sqlite3', :require => nil, :platform => :mri, :group => :test
54
+ group :mssql do
55
+ gem 'tiny_tds', :require => nil, :platform => :mri, :group => :test
56
+ gem 'activerecord-sqlserver-adapter', :require => nil, :platform => :mri, :group => :test
57
+ end
data/History.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 1.3.10 (08/29/14)
2
+
3
+ - [postgres] preliminary (temp) fix for Marshal.dump broken since 1.3.8 (#573)
4
+ - [postgres] adapter was missing the custom rename_index method (fixes #577)
5
+ - [postgres] user defined types should not raise an error
6
+ - [postgres] align with Rails distict white-space fix (regression in 4.0.10)
7
+ - [mssql] allow for `offset(x)` without `limit(y)` to work ... (fixes #564)
8
+ - [mssql] correctly parse set_table_name string with owner (#574)
9
+ - allow database.yml or config option to set `:insert_returning` (#570)
10
+ - [sqlite3] savepoint without passed explicit name not supported
11
+ - synchronize setting resolved visitor type
12
+ - [mssql] (hopefully) fix ORDER BY mis-detection - closes #532 (improved #549)
13
+ - [mysql] columns were sometimes instantiated with the wrong column class (#566)
14
+
1
15
  ## 1.3.9 (07/07/14)
2
16
 
3
17
  - [postgres] improve Range's type cast - fixing minor quoting failure on AR 4.x
data/Rakefile CHANGED
@@ -73,7 +73,9 @@ task 'release:do' => 'build:adapters' do
73
73
  sh("git diff-index --quiet --cached HEAD") { |ok| fail "git index is not clean" unless ok }
74
74
 
75
75
  sh "git tag -a -m \"AR-JDBC #{version}\" #{version_tag}"
76
- sh "for gem in `ls pkg/*-#{version}.gem`; do gem push $gem; done"
76
+ sh "for gem in `ls pkg/*-#{version}.gem`; do gem push $gem; done" do |ok|
77
+ sh "git push origin master --tags" if ok
78
+ end
77
79
  end
78
80
 
79
81
  # ALL
@@ -8,11 +8,7 @@ module Arel
8
8
  def visit_Arel_Nodes_SelectStatement(*args) # [o] AR <= 4.0 [o, a] on 4.1
9
9
  o, a = args.first, args.last
10
10
 
11
- if ! o.limit && ! o.offset
12
- return super
13
- elsif ! o.limit && o.offset
14
- raise ActiveRecord::ActiveRecordError, "must specify :limit with :offset"
15
- end
11
+ return super if ! o.limit && ! o.offset # NOTE: really?
16
12
 
17
13
  unless o.orders.empty?
18
14
  select_order_by = "ORDER BY #{do_visit_columns(o.orders, a).join(', ')}"
@@ -46,10 +42,13 @@ module Arel
46
42
  sql
47
43
  end
48
44
 
45
+ # @private
46
+ MAX_LIMIT_VALUE = 9_223_372_036_854_775_807
47
+
49
48
  def visit_Arel_Nodes_UpdateStatement(*args) # [o] AR <= 4.0 [o, a] on 4.1
50
49
  o = args.first
51
50
  if o.orders.any? && o.limit.nil?
52
- o.limit = Nodes::Limit.new(9223372036854775807)
51
+ o.limit = Nodes::Limit.new(MAX_LIMIT_VALUE)
53
52
  end
54
53
  super
55
54
  end
@@ -67,7 +66,7 @@ module Arel
67
66
  # User.select("distinct first_name").limit(10)
68
67
  # would generate "select top 10 distinct first_name from users",
69
68
  # which is invalid should be "select distinct top 10 first_name ..."
70
- ""
69
+ ''
71
70
  end
72
71
 
73
72
  def visit_Arel_Nodes_Limit o, a = nil
Binary file
@@ -49,8 +49,9 @@ module ActiveRecord::ConnectionAdapters
49
49
  visitor_type ||= ::Arel::Visitors::VISITORS[ arel_visitor_name(adapter_spec) ]
50
50
  visitor_type ||= ::Arel::Visitors::ToSql # default (if nothing resolved)
51
51
 
52
- ::Arel::Visitors::VISITORS[ adapter ] = visitor_type
53
- RESOLVED_VISITORS[ adapter ] = visitor_type
52
+ RESOLVED_VISITORS.to_java.synchronized do
53
+ RESOLVED_VISITORS[ adapter ] = ::Arel::Visitors::VISITORS[ adapter ] = visitor_type
54
+ end
54
55
  end
55
56
 
56
57
  visitor_type
@@ -38,10 +38,6 @@ module ActiveRecord
38
38
  ArJdbc.deprecate "set_native_database_types is no longer used and does nothing override native_database_types instead"
39
39
  end
40
40
 
41
- def self.jndi_config?(config)
42
- config[:jndi] || config[:data_source]
43
- end
44
-
45
41
  def jndi?; @jndi; end
46
42
  alias_method :jndi_connection?, :jndi?
47
43
 
@@ -4,64 +4,71 @@ module ArJdbc
4
4
 
5
5
  # @private
6
6
  FIND_SELECT = /\b(SELECT(\s+DISTINCT)?)\b(.*)/mi
7
- FIND_AGGREGATE_FUNCTIONS = /AVG|COUNT|COUNT_BIG|MAX|MIN|SUM|STDDEV|STDEVP|VAR|VARP/
7
+ # @private
8
+ FIND_AGGREGATE_FUNCTION = /(AVG|COUNT|COUNT_BIG|MAX|MIN|SUM|STDDEV|STDEVP|VAR|VARP)\(/i
8
9
 
9
10
  module SqlServerReplaceLimitOffset
10
11
 
11
12
  module_function
12
13
 
13
14
  def replace_limit_offset!(sql, limit, offset, order)
14
- if limit
15
- offset ||= 0
16
- start_row, end_row = offset + 1, offset + limit.to_i
15
+ offset ||= 0
17
16
 
18
- if match = FIND_SELECT.match(sql)
19
- select, distinct, rest_of_query = match[1], match[2], match[3]
20
- rest_of_query.strip!
21
- end
22
- rest_of_query[0] = '*' if rest_of_query[0...1] == '1' && rest_of_query !~ /1 AS/i
23
- if rest_of_query[0...1] == '*'
24
- from_table = Utils.get_table_name(rest_of_query, true)
25
- rest_of_query = "#{from_table}.#{rest_of_query}"
26
- end
17
+ if match = FIND_SELECT.match(sql)
18
+ select, distinct, rest_of_query = match[1], match[2], match[3]
19
+ rest_of_query.strip!
20
+ end
21
+ rest_of_query[0] = '*' if rest_of_query[0...1] == '1' && rest_of_query !~ /1 AS/i
22
+ if rest_of_query[0...1] == '*'
23
+ from_table = Utils.get_table_name(rest_of_query, true)
24
+ rest_of_query = "#{from_table}.#{rest_of_query}"
25
+ end
27
26
 
28
- # Ensure correct queries if the rest_of_query contains a 'GROUP BY'. Otherwise the following error occurs:
29
- # ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: Column 'users.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
30
- # SELECT t.* FROM ( SELECT ROW_NUMBER() OVER(ORDER BY users.id) AS _row_num, [users].[lft], COUNT([users].[lft]) FROM [users] GROUP BY [users].[lft] HAVING COUNT([users].[lft]) > 1 ) AS t WHERE t._row_num BETWEEN 1 AND 1
31
- if rest_of_query.downcase.include?('group by')
32
- if order.match(/^ORDER +BY +(#{FIND_AGGREGATE_FUNCTIONS})\(/i)
33
- # do nothing
34
- elsif order.count(',') == 0
35
- order.gsub!(/ORDER +BY +([^\s]+)(\s+ASC|\s+DESC)?/i, 'ORDER BY MIN(\1)\2')
36
- else
37
- raise('Only one order condition allowed.')
38
- end
27
+ # Ensure correct queries if the rest_of_query contains a 'GROUP BY'. Otherwise the following error occurs:
28
+ # ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: Column 'users.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
29
+ # SELECT t.* FROM ( SELECT ROW_NUMBER() OVER(ORDER BY users.id) AS _row_num, [users].[lft], COUNT([users].[lft]) FROM [users] GROUP BY [users].[lft] HAVING COUNT([users].[lft]) > 1 ) AS t WHERE t._row_num BETWEEN 1 AND 1
30
+ if rest_of_query.downcase.include?('group by')
31
+ order_start = order.strip[0, 8]; order_start.upcase!
32
+ if order_start == 'ORDER BY' && order.match(FIND_AGGREGATE_FUNCTION)
33
+ # do nothing
34
+ elsif order.count(',') == 0
35
+ order.gsub!(/ORDER +BY +([^\s]+)(\s+ASC|\s+DESC)?/i, 'ORDER BY MIN(\1)\2')
36
+ else
37
+ raise('Only one order condition allowed.')
39
38
  end
39
+ end
40
40
 
41
- if distinct # select =~ /DISTINCT/i
42
- order = order.gsub(/([a-z0-9_])+\./, 't.')
43
- new_sql = "SELECT t.* FROM "
44
- new_sql << "( SELECT ROW_NUMBER() OVER(#{order}) AS _row_num, t.* FROM (#{select} #{rest_of_query}) AS t ) AS t"
45
- new_sql << " WHERE t._row_num BETWEEN #{start_row} AND #{end_row}"
46
- else
47
- select_columns_before_from = rest_of_query.gsub(/FROM.*/, '').strip
48
- only_one_column = !select_columns_before_from.include?(',')
49
- only_one_id_column = only_one_column && (select_columns_before_from.ends_with?('.id') || select_columns_before_from.ends_with?('.[id]'))
41
+ if distinct # select =~ /DISTINCT/i
42
+ order = order.gsub(/([a-z0-9_])+\./, 't.')
43
+ new_sql = "SELECT t.* FROM "
44
+ new_sql << "( SELECT ROW_NUMBER() OVER(#{order}) AS _row_num, t.* FROM (#{select} #{rest_of_query}) AS t ) AS t"
45
+ append_limit_row_num_clause(new_sql, limit, offset)
46
+ else
47
+ select_columns_before_from = rest_of_query.gsub(/FROM.*/, '').strip
48
+ only_one_column = !select_columns_before_from.include?(',')
49
+ only_one_id_column = only_one_column && (select_columns_before_from.ends_with?('.id') || select_columns_before_from.ends_with?('.[id]'))
50
50
 
51
- if only_one_id_column
52
- # If there's only one id column a subquery will be created which only contains this column
53
- new_sql = "#{select} t.id FROM "
54
- else
55
- # All selected columns are used
56
- new_sql = "#{select} t.* FROM "
57
- end
58
- new_sql << "( SELECT ROW_NUMBER() OVER(#{order}) AS _row_num, #{rest_of_query} ) AS t"
59
- new_sql << " WHERE t._row_num BETWEEN #{start_row} AND #{end_row}"
51
+ if only_one_id_column
52
+ # If there's only one id column a subquery will be created which only contains this column
53
+ new_sql = "#{select} t.id FROM "
54
+ else
55
+ # All selected columns are used
56
+ new_sql = "#{select} t.* FROM "
60
57
  end
58
+ new_sql << "( SELECT ROW_NUMBER() OVER(#{order}) AS _row_num, #{rest_of_query} ) AS t"
59
+ append_limit_row_num_clause(new_sql, limit, offset)
60
+ end
61
61
 
62
- sql.replace(new_sql)
62
+ sql.replace new_sql
63
+ end
64
+
65
+ def append_limit_row_num_clause(sql, limit, offset)
66
+ if limit
67
+ start_row = offset + 1; end_row = offset + limit.to_i
68
+ sql << " WHERE t._row_num BETWEEN #{start_row} AND #{end_row}"
69
+ else
70
+ sql << " WHERE t._row_num > #{offset}"
63
71
  end
64
- sql
65
72
  end
66
73
 
67
74
  end
@@ -75,7 +82,7 @@ module ArJdbc
75
82
  offset ||= 0
76
83
  start_row = offset + 1
77
84
  end_row = offset + limit.to_i
78
-
85
+
79
86
  if match = FIND_SELECT.match(sql)
80
87
  select, distinct, rest_of_query = match[1], match[2], match[3]
81
88
  end
@@ -21,19 +21,6 @@ module ArJdbc
21
21
  end
22
22
  end
23
23
 
24
- # protected
25
-
26
- # See "Delimited Identifiers": http://msdn.microsoft.com/en-us/library/ms176027.aspx
27
- def remove_identifier_delimiters(keyword)
28
- if /\A(\[|")(.*)/m.match(keyword)
29
- delim, rest = $1, $2
30
- if delim == '[' && rest =~ /]\z/ || delim == '"' && rest =~ /"\z/
31
- return rest.chop
32
- end
33
- end
34
- keyword
35
- end
36
-
37
24
  def unquote_table_name(table_name)
38
25
  remove_identifier_delimiters(table_name)
39
26
  end
@@ -51,7 +38,8 @@ module ArJdbc
51
38
  end
52
39
 
53
40
  def unqualify_table_schema(table_name)
54
- remove_identifier_delimiters(table_name.to_s.split('.')[-2]) rescue nil
41
+ schema_name = table_name.to_s.split('.')[-2]
42
+ schema_name.nil? ? nil : remove_identifier_delimiters(schema_name)
55
43
  end
56
44
 
57
45
  def unqualify_db_name(table_name)
@@ -59,6 +47,13 @@ module ArJdbc
59
47
  table_names.length == 3 ? remove_identifier_delimiters(table_names.first) : nil
60
48
  end
61
49
 
50
+ # private
51
+
52
+ # See "Delimited Identifiers": http://msdn.microsoft.com/en-us/library/ms176027.aspx
53
+ def remove_identifier_delimiters(keyword)
54
+ keyword.to_s.tr("\]\[\"", '')
55
+ end
56
+
62
57
  end
63
58
  end
64
- end
59
+ end
@@ -332,7 +332,7 @@ module ArJdbc
332
332
  sql = "SHOW FULL COLUMNS FROM #{quote_table_name(table_name)}"
333
333
  columns = execute(sql, name || 'SCHEMA')
334
334
  strict = strict_mode?
335
- column = jdbc_column_class
335
+ column = ::ActiveRecord::ConnectionAdapters::MysqlAdapter::Column
336
336
  pass_cast_type = respond_to?(:lookup_cast_type)
337
337
  columns.map! do |field|
338
338
  sql_type = field['Type']
@@ -608,7 +608,7 @@ module ArJdbc
608
608
  private :next_id_value
609
609
 
610
610
  def use_insert_returning?
611
- if ( @use_insert_returning ||= nil ).nil?
611
+ if @use_insert_returning.nil?
612
612
  @use_insert_returning = false
613
613
  end
614
614
  @use_insert_returning
@@ -58,7 +58,7 @@ module ArJdbc
58
58
  end
59
59
 
60
60
  def use_insert_returning?
61
- if ( @use_insert_returning ||= nil ).nil?
61
+ if @use_insert_returning.nil?
62
62
  @use_insert_returning = supports_insert_with_returning?
63
63
  end
64
64
  @use_insert_returning
@@ -777,11 +777,13 @@ module ArJdbc
777
777
  end
778
778
 
779
779
  order_columns = orders.reject(&:blank?).map! do |column|
780
- column = column.to_sql unless column.is_a?(String) # handle AREL node
781
- column.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') # remove ASC/DESC
780
+ column = column.is_a?(String) ? column.dup : column.to_sql # AREL node
781
+ column.gsub!(/\s+(?:ASC|DESC)\s*/i, '') # remove any ASC/DESC modifiers
782
+ column.gsub!(/\s*NULLS\s+(?:FIRST|LAST)?\s*/i, '')
783
+ column
782
784
  end
783
- order_columns.reject!(&:blank?)
784
- i = -1; order_columns.map! { |c| "#{c} AS alias_#{i += 1}" }
785
+ order_columns.reject!(&:empty?)
786
+ i = -1; order_columns.map! { |column| "#{column} AS alias_#{i += 1}" }
785
787
 
786
788
  columns = [ columns ]; columns.flatten!
787
789
  columns.push( *order_columns ).join(', ')
@@ -805,7 +807,7 @@ module ArJdbc
805
807
  # @return [String]
806
808
  # @override
807
809
  def quote(value, column = nil)
808
- return super unless column
810
+ return super unless column && column.type
809
811
  return value if sql_literal?(value)
810
812
 
811
813
  case value
@@ -1065,6 +1067,10 @@ module ArJdbc
1065
1067
  execute "DROP INDEX #{quote_table_name(index_name)}"
1066
1068
  end
1067
1069
 
1070
+ def rename_index(table_name, old_name, new_name)
1071
+ execute "ALTER INDEX #{quote_column_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
1072
+ end
1073
+
1068
1074
  def index_name_length
1069
1075
  63
1070
1076
  end
@@ -327,6 +327,24 @@ module ArJdbc
327
327
  ::Float::INFINITY * (options[:negative] ? -1 : 1)
328
328
  end if AR4_COMPAT
329
329
 
330
+ private
331
+
332
+ # TODO marshaling worked in 1.3.7 ,,, got broken in 1.3.8 (due @adapter)
333
+ # but the fix introduced in 1.3.10 causes backwards (1.3) incompatibility
334
+ # ... for now should be fine - there's likely more refactoring to happen!
335
+
336
+ def marshal_dump
337
+ # NOTE: disabled oid_type ... due range warnings (maybe they're fine) :
338
+ # unknown OID 3904: failed to recognize type of 'int4_range'. It will be treated as String.
339
+ #oid_type if respond_to?(:oid_type)
340
+ @adapter = nil
341
+ instance_variables.map { |var| [ var, instance_variable_get(var) ] }
342
+ end
343
+
344
+ def marshal_load(data)
345
+ data.each { |pair| instance_variable_set( pair[0], pair[1] ) }
346
+ end
347
+
330
348
  # @note Based on *active_record/connection_adapters/postgresql/cast.rb* (4.0).
331
349
  module Cast
332
350
 
@@ -1,5 +1,5 @@
1
1
  module ArJdbc
2
- VERSION = "1.3.9"
2
+ VERSION = "1.3.10"
3
3
  # @deprecated
4
4
  module Version
5
5
  # @private 1.2.x compatibility
@@ -1,8 +1,7 @@
1
-
2
1
  namespace :'tomcat-jndi' do # contains a FS JNDI impl (for tests)
3
-
2
+
4
3
  TOMCAT_MAVEN_REPO = 'http://repo2.maven.org/maven2/org/apache/tomcat'
5
- TOMCAT_VERSION = '7.0.34'
4
+ TOMCAT_VERSION = '7.0.54'
6
5
 
7
6
  DOWNLOAD_DIR = File.expand_path('../test/jars', File.dirname(__FILE__))
8
7
 
@@ -36,7 +35,7 @@ namespace :'tomcat-jndi' do # contains a FS JNDI impl (for tests)
36
35
 
37
36
  FileUtils.rm_r temp_dir
38
37
  end
39
-
38
+
40
39
  task :check do
41
40
  jar_path = File.join(DOWNLOAD_DIR, catalina_jar)
42
41
  unless File.exist?(jar_path)
@@ -49,4 +48,4 @@ namespace :'tomcat-jndi' do # contains a FS JNDI impl (for tests)
49
48
  rm jar_path if File.exist?(jar_path)
50
49
  end
51
50
 
52
- end
51
+ end
@@ -1394,6 +1394,37 @@ public class RubyJdbcConnection extends RubyObject {
1394
1394
  return value;
1395
1395
  }
1396
1396
 
1397
+ @JRubyMethod(name = "jndi_config?", meta = true)
1398
+ public static IRubyObject jndi_config_p(final ThreadContext context,
1399
+ final IRubyObject self, final IRubyObject config) {
1400
+ // config[:jndi] || config[:data_source]
1401
+
1402
+ final Ruby runtime = context.getRuntime();
1403
+
1404
+ IRubyObject configValue;
1405
+
1406
+ if ( config.getClass() == RubyHash.class ) { // "optimized" version
1407
+ final RubyHash configHash = ((RubyHash) config);
1408
+ configValue = configHash.fastARef(runtime.newSymbol("jndi"));
1409
+ if ( configValue == null ) {
1410
+ configValue = configHash.fastARef(runtime.newSymbol("data_source"));
1411
+ }
1412
+ }
1413
+ else {
1414
+ configValue = config.callMethod(context, "[]", runtime.newSymbol("jndi"));
1415
+ if ( configValue.isNil() ) configValue = null;
1416
+ if ( configValue == null ) {
1417
+ configValue = config.callMethod(context, "[]", runtime.newSymbol("data_source"));
1418
+ }
1419
+ }
1420
+
1421
+ final IRubyObject rubyFalse = runtime.newBoolean( false );
1422
+ if ( configValue == null || configValue.isNil() || configValue == rubyFalse ) {
1423
+ return rubyFalse;
1424
+ }
1425
+ return context.getRuntime().newBoolean( true );
1426
+ }
1427
+
1397
1428
  protected final IRubyObject getConfigValue(final ThreadContext context, final String key) {
1398
1429
  final IRubyObject config = callMethod(context, "config");
1399
1430
  return config.callMethod(context, "[]", context.getRuntime().newSymbol(key));
@@ -3380,17 +3411,17 @@ public class RubyJdbcConnection extends RubyObject {
3380
3411
 
3381
3412
  final IRubyObject[] args;
3382
3413
 
3383
- final RubyArray cols = runtime.newArray(columns.length);
3414
+ final RubyArray cols = RubyArray.newArray(runtime, columns.length);
3384
3415
 
3385
3416
  if ( INIT_COLUMN_TYPES ) { // NOTE: NOT IMPLEMENTED
3386
- for ( int i=0; i<columns.length; i++ ) {
3387
- cols.add( columns[i].name );
3417
+ for ( int i = 0; i < columns.length; i++ ) {
3418
+ cols.append( columns[i].name );
3388
3419
  }
3389
3420
  args = new IRubyObject[] { cols, rows };
3390
3421
  }
3391
3422
  else {
3392
- for ( int i=0; i<columns.length; i++ ) {
3393
- cols.add( columns[i].name );
3423
+ for ( int i = 0; i < columns.length; i++ ) {
3424
+ cols.append( columns[i].name );
3394
3425
  }
3395
3426
  args = new IRubyObject[] { cols, rows };
3396
3427
  }
@@ -119,11 +119,12 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
119
119
 
120
120
  @Override
121
121
  protected IRubyObject indexes(final ThreadContext context, String tableName, final String name, String schemaName) {
122
- int i = -1;
123
- if ( tableName != null ) i = tableName.indexOf('.');
124
- if ( i > 0 && schemaName == null ) {
125
- schemaName = tableName.substring(0, i);
126
- tableName = tableName.substring(i + 1);
122
+ if ( tableName != null ) {
123
+ final int i = tableName.indexOf('.');
124
+ if ( i > 0 && schemaName == null ) {
125
+ schemaName = tableName.substring(0, i);
126
+ tableName = tableName.substring(i + 1);
127
+ }
127
128
  }
128
129
  return super.indexes(context, tableName, name, schemaName);
129
130
  }
@@ -214,7 +215,10 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
214
215
  @Override
215
216
  @JRubyMethod(name = "create_savepoint", optional = 1)
216
217
  public IRubyObject create_savepoint(final ThreadContext context, final IRubyObject[] args) {
217
- IRubyObject name = args.length > 0 ? args[0] : null;
218
+ final IRubyObject name = args.length > 0 ? args[0] : null;
219
+ if ( name == null || name.isNil() ) {
220
+ throw new IllegalArgumentException("create_savepoint (without name) not implemented!");
221
+ }
218
222
  final Connection connection = getConnection(true);
219
223
  try {
220
224
  connection.setAutoCommit(false);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbc-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.10
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: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  version: '0'
244
244
  requirements: []
245
245
  rubyforge_project: jruby-extras
246
- rubygems_version: 2.2.2
246
+ rubygems_version: 2.4.1
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: JDBC adapter for ActiveRecord, for use within JRuby on Rails.