activerecord-jdbc-adapter 1.3.7 → 1.3.8

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +33 -3
  3. data/Appraisals +11 -5
  4. data/Gemfile +21 -15
  5. data/History.md +31 -1
  6. data/lib/active_record/connection_adapters/mariadb_adapter.rb +1 -0
  7. data/lib/arel/visitors/firebird.rb +7 -10
  8. data/lib/arel/visitors/h2.rb +9 -0
  9. data/lib/arel/visitors/sql_server.rb +21 -2
  10. data/lib/arjdbc/h2/adapter.rb +31 -2
  11. data/lib/arjdbc/h2/connection_methods.rb +1 -1
  12. data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
  13. data/lib/arjdbc/jdbc/column.rb +2 -1
  14. data/lib/arjdbc/mssql/adapter.rb +40 -23
  15. data/lib/arjdbc/mssql/column.rb +4 -4
  16. data/lib/arjdbc/mysql/adapter.rb +36 -10
  17. data/lib/arjdbc/mysql/column.rb +12 -7
  18. data/lib/arjdbc/mysql/connection_methods.rb +53 -21
  19. data/lib/arjdbc/oracle/adapter.rb +22 -5
  20. data/lib/arjdbc/postgresql/adapter.rb +54 -18
  21. data/lib/arjdbc/postgresql/base/array_parser.rb +95 -0
  22. data/lib/arjdbc/postgresql/base/oid.rb +460 -0
  23. data/lib/arjdbc/postgresql/column.rb +50 -15
  24. data/lib/arjdbc/postgresql/oid_types.rb +126 -0
  25. data/lib/arjdbc/tasks/h2_database_tasks.rb +4 -2
  26. data/lib/arjdbc/version.rb +1 -1
  27. data/rakelib/02-test.rake +3 -30
  28. data/src/java/arjdbc/derby/DerbyModule.java +0 -8
  29. data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +1 -0
  30. data/src/java/arjdbc/h2/H2RubyJdbcConnection.java +2 -0
  31. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +8 -8
  32. data/src/java/arjdbc/mssql/MSSQLModule.java +50 -19
  33. data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +1 -0
  34. data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +6 -6
  35. data/src/java/arjdbc/oracle/OracleModule.java +1 -1
  36. data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +66 -2
  37. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +23 -10
  38. data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +1 -0
  39. data/src/java/arjdbc/util/CallResultSet.java +826 -0
  40. data/src/java/arjdbc/util/QuotingUtils.java +14 -7
  41. metadata +8 -3
  42. data/lib/arjdbc/postgresql/array_parser.rb +0 -89
@@ -23,7 +23,6 @@
23
23
  */
24
24
  package arjdbc.util;
25
25
 
26
- import org.jruby.Ruby;
27
26
  import org.jruby.RubyString;
28
27
  import org.jruby.runtime.ThreadContext;
29
28
  import org.jruby.runtime.builtin.IRubyObject;
@@ -49,6 +48,15 @@ public abstract class QuotingUtils {
49
48
  final ThreadContext context,
50
49
  final RubyString string,
51
50
  final char value, final char quote) {
51
+ return quoteCharWith(context, string, value, quote, 0, 8);
52
+ }
53
+
54
+ @SuppressWarnings("deprecation")
55
+ public static RubyString quoteCharWith(
56
+ final ThreadContext context,
57
+ final RubyString string,
58
+ final char value, final char quote,
59
+ final int newOffset, final int newSizeDiff) {
52
60
 
53
61
  final ByteList stringBytes = string.getByteList();
54
62
  final byte[] bytes = stringBytes.unsafeBytes();
@@ -60,11 +68,11 @@ public abstract class QuotingUtils {
60
68
  if ( bytes[i] == value ) {
61
69
  if ( quotedBytes == null ) {
62
70
  quotedBytes = new ByteList(
63
- new byte[realSize + 8],
64
- stringBytes.getEncoding()
71
+ new byte[realSize + newOffset + newSizeDiff],
72
+ stringBytes.getEncoding(), false
65
73
  );
66
- quotedBytes.setBegin(0);
67
- quotedBytes.setRealSize(0);
74
+ quotedBytes.begin = newOffset;
75
+ quotedBytes.realSize = 0;
68
76
  }
69
77
  quotedBytes.append(bytes, appendFrom, i - appendFrom);
70
78
  quotedBytes.append(quote).append(value); // e.g. "'" => "''"
@@ -76,8 +84,7 @@ public abstract class QuotingUtils {
76
84
  }
77
85
  else return string; // nothing changed, can return original
78
86
 
79
- final Ruby runtime = context.getRuntime();
80
- return runtime.newString(quotedBytes);
87
+ return context.getRuntime().newString(quotedBytes);
81
88
  }
82
89
 
83
90
  public static final ByteList BYTES_SINGLE_Q = new ByteList(new byte[] { '\'' }, 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.7
4
+ version: 1.3.8
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-04-14 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -60,6 +60,7 @@ files:
60
60
  - lib/active_record/connection_adapters/informix_adapter.rb
61
61
  - lib/active_record/connection_adapters/jdbc_adapter.rb
62
62
  - lib/active_record/connection_adapters/jndi_adapter.rb
63
+ - lib/active_record/connection_adapters/mariadb_adapter.rb
63
64
  - lib/active_record/connection_adapters/mssql_adapter.rb
64
65
  - lib/active_record/connection_adapters/mysql2_adapter.rb
65
66
  - lib/active_record/connection_adapters/mysql_adapter.rb
@@ -72,6 +73,7 @@ files:
72
73
  - lib/arel/visitors/db2.rb
73
74
  - lib/arel/visitors/derby.rb
74
75
  - lib/arel/visitors/firebird.rb
76
+ - lib/arel/visitors/h2.rb
75
77
  - lib/arel/visitors/hsqldb.rb
76
78
  - lib/arel/visitors/sql_server.rb
77
79
  - lib/arjdbc.rb
@@ -142,10 +144,12 @@ files:
142
144
  - lib/arjdbc/oracle/connection_methods.rb
143
145
  - lib/arjdbc/postgresql.rb
144
146
  - lib/arjdbc/postgresql/adapter.rb
145
- - lib/arjdbc/postgresql/array_parser.rb
147
+ - lib/arjdbc/postgresql/base/array_parser.rb
148
+ - lib/arjdbc/postgresql/base/oid.rb
146
149
  - lib/arjdbc/postgresql/column.rb
147
150
  - lib/arjdbc/postgresql/connection_methods.rb
148
151
  - lib/arjdbc/postgresql/explain_support.rb
152
+ - lib/arjdbc/postgresql/oid_types.rb
149
153
  - lib/arjdbc/postgresql/schema_creation.rb
150
154
  - lib/arjdbc/railtie.rb
151
155
  - lib/arjdbc/sqlite3.rb
@@ -212,6 +216,7 @@ files:
212
216
  - src/java/arjdbc/sqlite3/SQLite3Module.java
213
217
  - src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java
214
218
  - src/java/arjdbc/sqlite3/Sqlite3RubyJdbcConnection.java
219
+ - src/java/arjdbc/util/CallResultSet.java
215
220
  - src/java/arjdbc/util/QuotingUtils.java
216
221
  homepage: https://github.com/jruby/activerecord-jdbc-adapter
217
222
  licenses:
@@ -1,89 +0,0 @@
1
- module ArJdbc
2
- module PostgreSQL
3
- module ArrayParser
4
-
5
- def parse_pg_array(string)
6
- parse_data(string, 0)
7
- end
8
-
9
- private
10
-
11
- def parse_data(string, index)
12
- local_index = index
13
- array = []
14
- while(local_index < string.length)
15
- case string[local_index]
16
- when '{'
17
- local_index,array = parse_array_contents(array, string, local_index + 1)
18
- when '}'
19
- return array
20
- end
21
- local_index += 1
22
- end
23
-
24
- array
25
- end
26
-
27
- def parse_array_contents(array, string, index)
28
- is_escaping = false
29
- is_quoted = false
30
- was_quoted = false
31
- current_item = ''
32
-
33
- local_index = index
34
- while local_index
35
- token = string[local_index]
36
- if is_escaping
37
- current_item << token
38
- is_escaping = false
39
- else
40
- if is_quoted
41
- case token
42
- when '"'
43
- is_quoted = false
44
- was_quoted = true
45
- when "\\"
46
- is_escaping = true
47
- else
48
- current_item << token
49
- end
50
- else
51
- case token
52
- when "\\"
53
- is_escaping = true
54
- when ','
55
- add_item_to_array(array, current_item, was_quoted)
56
- current_item = ''
57
- was_quoted = false
58
- when '"'
59
- is_quoted = true
60
- when '{'
61
- internal_items = []
62
- local_index,internal_items = parse_array_contents(internal_items, string, local_index + 1)
63
- array.push(internal_items)
64
- when '}'
65
- add_item_to_array(array, current_item, was_quoted)
66
- return local_index,array
67
- else
68
- current_item << token
69
- end
70
- end
71
- end
72
-
73
- local_index += 1
74
- end
75
- return local_index,array
76
- end
77
-
78
- def add_item_to_array(array, current_item, quoted)
79
- if current_item.length == 0
80
- elsif !quoted && current_item == 'NULL'
81
- array.push nil
82
- else
83
- array.push current_item
84
- end
85
- end
86
-
87
- end
88
- end
89
- end