activerecord-jdbc-adapter 51.7-java → 52.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.travis.yml +26 -51
  4. data/README.md +9 -11
  5. data/Rakefile +19 -74
  6. data/activerecord-jdbc-adapter.gemspec +2 -2
  7. data/lib/active_record/connection_adapters/mssql_adapter.rb +1 -0
  8. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +1 -0
  9. data/lib/arjdbc/abstract/core.rb +2 -12
  10. data/lib/arjdbc/abstract/database_statements.rb +24 -10
  11. data/lib/arjdbc/abstract/statement_cache.rb +4 -4
  12. data/lib/arjdbc/db2/adapter.rb +52 -2
  13. data/lib/arjdbc/jdbc.rb +4 -0
  14. data/lib/arjdbc/jdbc/column.rb +11 -5
  15. data/lib/arjdbc/jdbc/connection_methods.rb +9 -2
  16. data/lib/arjdbc/jdbc/jdbc.rake +4 -0
  17. data/lib/arjdbc/mssql.rb +7 -0
  18. data/lib/arjdbc/mssql/adapter.rb +804 -0
  19. data/lib/arjdbc/mssql/column.rb +200 -0
  20. data/lib/arjdbc/mssql/connection_methods.rb +79 -0
  21. data/lib/arjdbc/mssql/explain_support.rb +99 -0
  22. data/lib/arjdbc/mssql/limit_helpers.rb +231 -0
  23. data/lib/arjdbc/mssql/lock_methods.rb +77 -0
  24. data/lib/arjdbc/mssql/types.rb +343 -0
  25. data/lib/arjdbc/mssql/utils.rb +82 -0
  26. data/lib/arjdbc/mysql/adapter.rb +22 -14
  27. data/lib/arjdbc/mysql/connection_methods.rb +9 -18
  28. data/lib/arjdbc/postgresql/adapter.rb +102 -75
  29. data/lib/arjdbc/postgresql/column.rb +3 -6
  30. data/lib/arjdbc/postgresql/connection_methods.rb +3 -12
  31. data/lib/arjdbc/postgresql/oid_types.rb +12 -86
  32. data/lib/arjdbc/sqlite3/adapter.rb +88 -92
  33. data/lib/arjdbc/sqlite3/connection_methods.rb +0 -1
  34. data/lib/arjdbc/tasks/database_tasks.rb +36 -16
  35. data/lib/arjdbc/tasks/databases.rake +75 -32
  36. data/lib/arjdbc/tasks/databases3.rake +215 -0
  37. data/lib/arjdbc/tasks/databases4.rake +39 -0
  38. data/lib/arjdbc/version.rb +1 -1
  39. data/rakelib/01-tomcat.rake +2 -2
  40. data/rakelib/02-test.rake +3 -0
  41. data/rakelib/compile.rake +70 -0
  42. data/rakelib/db.rake +7 -21
  43. data/rakelib/rails.rake +4 -5
  44. data/src/java/arjdbc/ArJdbcModule.java +15 -5
  45. data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +2 -2
  46. data/src/java/arjdbc/jdbc/ConnectionFactory.java +87 -0
  47. data/src/java/arjdbc/jdbc/DataSourceConnectionFactory.java +1 -0
  48. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +29 -113
  49. data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +14 -259
  50. data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +2 -2
  51. data/src/java/arjdbc/postgresql/PgResultSetMetaDataWrapper.java +23 -0
  52. data/src/java/arjdbc/postgresql/PostgreSQLResult.java +13 -21
  53. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +50 -44
  54. data/src/java/arjdbc/util/DateTimeUtils.java +5 -141
  55. data/src/java/arjdbc/util/QuotingUtils.java +7 -6
  56. metadata +26 -11
  57. data/src/java/arjdbc/jdbc/RubyConnectionFactory.java +0 -61
  58. data/src/java/arjdbc/postgresql/PgDateTimeUtils.java +0 -52
@@ -1,61 +0,0 @@
1
- /***** BEGIN LICENSE BLOCK *****
2
- * Copyright (c) 2012-2014 Karol Bucek <self@kares.org>
3
- * Copyright (c) 2006-2010 Nick Sieger <nick@nicksieger.com>
4
- * Copyright (c) 2006-2007 Ola Bini <ola.bini@gmail.com>
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining
7
- * a copy of this software and associated documentation files (the
8
- * "Software"), to deal in the Software without restriction, including
9
- * without limitation the rights to use, copy, modify, merge, publish,
10
- * distribute, sublicense, and/or sell copies of the Software, and to
11
- * permit persons to whom the Software is furnished to do so, subject to
12
- * the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be
15
- * included in all copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- ***** END LICENSE BLOCK *****/
25
-
26
- package arjdbc.jdbc;
27
-
28
- import java.sql.Connection;
29
- import java.sql.SQLException;
30
-
31
- import org.jruby.RubyObject;
32
- import org.jruby.RubyString;
33
- import org.jruby.runtime.ThreadContext;
34
- import org.jruby.runtime.builtin.IRubyObject;
35
-
36
- // @legacy ActiveRecord::ConnectionAdapters::JdbcDriver
37
- class RubyConnectionFactory implements ConnectionFactory {
38
-
39
- private final IRubyObject driver;
40
- final RubyString url;
41
- final IRubyObject username, password; // null allowed
42
-
43
- private final RubyObject contextProvider;
44
-
45
- public RubyConnectionFactory(final IRubyObject driver, final RubyString url,
46
- final IRubyObject username, final IRubyObject password) {
47
- this.driver = driver; this.url = url;
48
- this.username = username; this.password = password;
49
- contextProvider = (RubyObject) driver;
50
- }
51
-
52
- @Override
53
- public Connection newConnection() throws SQLException {
54
- final ThreadContext context = contextProvider.getRuntime().getCurrentContext();
55
- final IRubyObject connection = driver.callMethod(context, "connection", new IRubyObject[] { url, username, password });
56
- return (Connection) connection.toJava(Connection.class);
57
- }
58
-
59
- IRubyObject getDriver() { return driver; } /* for tests */
60
-
61
- }
@@ -1,52 +0,0 @@
1
- package arjdbc.postgresql;
2
-
3
- import arjdbc.util.DateTimeUtils;
4
- import org.joda.time.DateTimeZone;
5
- import org.jruby.RubyArray;
6
- import org.jruby.RubyFloat;
7
- import org.jruby.runtime.ThreadContext;
8
- import org.jruby.runtime.builtin.IRubyObject;
9
-
10
- /**
11
- * PostgreSQL specific DateTime/Timestamp helpers
12
- * @author dritz
13
- */
14
- public abstract class PgDateTimeUtils extends DateTimeUtils {
15
- /**
16
- * Convert a ruby value to a PostgreSQL timestamp string
17
- * @param context
18
- * @param value Ruby value, typically a Time instance
19
- * @param zone DateTimeZone to adjust to, optional
20
- * @param withZone include timezone in string?
21
- * @return A string fit for PostgreSQL
22
- */
23
- public static String timestampValueToString(final ThreadContext context, IRubyObject value, DateTimeZone zone,
24
- boolean withZone) {
25
- if (value instanceof RubyFloat) {
26
- final double dv = ((RubyFloat) value).getValue();
27
- if (dv == Double.POSITIVE_INFINITY) {
28
- return "infinity";
29
- } else if (dv == Double.NEGATIVE_INFINITY) {
30
- return "-infinity";
31
- }
32
- }
33
- return timestampTimeToString(context, value, zone, withZone);
34
- }
35
-
36
- /**
37
- * Converts a RubyArray with timestamp values to a java array of PostgreSQL timestamp strings
38
- * @param context
39
- * @param rubyArray
40
- * @return Array of timestamp strings
41
- */
42
- public static String[] timestampStringArray(final ThreadContext context, final RubyArray rubyArray) {
43
- int size = rubyArray.size();
44
- String[] values = new String[size];
45
-
46
- for (int i = 0; i < size; i++) {
47
- IRubyObject elem = rubyArray.eltInternal(i);
48
- values[i] = timestampValueToString(context, elem, DateTimeZone.UTC, false);
49
- }
50
- return values;
51
- }
52
- }