activerecord-jdbc-adapter 1.3.25 → 5.0.pre1
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 +4 -4
- data/.travis.yml +57 -72
- data/Appraisals +7 -2
- data/Gemfile +3 -7
- data/History.md +0 -50
- data/RUNNING_TESTS.md +4 -0
- data/activerecord-jdbc-adapter.gemspec +2 -1
- data/lib/arjdbc/common_jdbc_methods.rb +89 -0
- data/lib/arjdbc/db2/adapter.rb +58 -69
- data/lib/arjdbc/db2/as400.rb +2 -13
- data/lib/arjdbc/db2/column.rb +1 -1
- data/lib/arjdbc/derby/adapter.rb +2 -6
- data/lib/arjdbc/firebird/adapter.rb +7 -16
- data/lib/arjdbc/h2/adapter.rb +4 -13
- data/lib/arjdbc/hsqldb/adapter.rb +5 -5
- data/lib/arjdbc/jdbc/adapter.rb +15 -76
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/adapter_require.rb +12 -31
- data/lib/arjdbc/jdbc/base_ext.rb +6 -25
- data/lib/arjdbc/jdbc/column.rb +15 -1
- data/lib/arjdbc/jdbc/connection_methods.rb +7 -1
- data/lib/arjdbc/jdbc/type_cast.rb +16 -4
- data/lib/arjdbc/jdbc/type_converter.rb +0 -1
- data/lib/arjdbc/mssql/adapter.rb +9 -21
- data/lib/arjdbc/mysql/adapter.rb +14 -19
- data/lib/arjdbc/mysql/connection_methods.rb +3 -5
- data/lib/arjdbc/oracle/adapter.rb +4 -38
- data/lib/arjdbc/oracle/connection_methods.rb +0 -4
- data/lib/arjdbc/postgresql/adapter.rb +18 -22
- data/lib/arjdbc/postgresql/connection_methods.rb +2 -5
- data/lib/arjdbc/postgresql/oid/bytea.rb +0 -1
- data/lib/arjdbc/postgresql/oid_types.rb +6 -6
- data/lib/arjdbc/sqlite3/adapter.rb +493 -404
- data/lib/arjdbc/tasks/database_tasks.rb +1 -1
- data/lib/arjdbc/tasks/databases3.rake +1 -1
- data/lib/arjdbc/tasks/databases4.rake +3 -8
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/db.rake +5 -8
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +102 -37
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +0 -7
- metadata +10 -17
- data/lib/arjdbc/jdbc/arel_support.rb +0 -133
- data/lib/arjdbc/mssql/attributes_for_update.rb +0 -22
- data/lib/arjdbc/sqlite3/explain_support.rb +0 -29
| @@ -39,7 +39,7 @@ module ArJdbc | |
| 39 39 | 
             
                register_tasks(/(oci|oracle)/, OracleDatabaseTasks)
         | 
| 40 40 | 
             
                register_tasks(/mssql/, MSSQLDatabaseTasks) # (built-in) alias
         | 
| 41 41 | 
             
                # tasks for custom (JDBC) adapters :
         | 
| 42 | 
            -
                register_tasks(/ | 
| 42 | 
            +
                register_tasks(/db2/, DB2DatabaseTasks)
         | 
| 43 43 | 
             
                register_tasks(/derby/, DerbyDatabaseTasks)
         | 
| 44 44 | 
             
                register_tasks(/h2/, H2DatabaseTasks)
         | 
| 45 45 | 
             
                register_tasks(/hsqldb/, HSQLDBDatabaseTasks)
         | 
| @@ -112,7 +112,7 @@ namespace :db do | |
| 112 112 | 
             
                    unless search_path.blank?
         | 
| 113 113 | 
             
                      search_path = search_path.split(",").map{ |part| "--schema=#{Shellwords.escape(part.strip)}" }.join(" ")
         | 
| 114 114 | 
             
                    end
         | 
| 115 | 
            -
                    sh "pg_dump -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}"
         | 
| 115 | 
            +
                    sh "pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}"
         | 
| 116 116 |  | 
| 117 117 | 
             
                    File.open(filename, 'a') { |f| f << "SET search_path TO #{ActiveRecord::Base.connection.schema_search_path};\n\n" }
         | 
| 118 118 | 
             
                  when /sqlite/
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            module ActiveRecord::Tasks
         | 
| 2 2 |  | 
| 3 3 | 
             
              DatabaseTasks.module_eval do
         | 
| 4 | 
            -
             | 
| 4 | 
            +
                
         | 
| 5 5 | 
             
                # patched to adapt jdbc configuration
         | 
| 6 6 | 
             
                def each_current_configuration(environment)
         | 
| 7 7 | 
             
                  environments = [environment]
         | 
| @@ -31,14 +31,9 @@ module ActiveRecord::Tasks | |
| 31 31 | 
             
              MySQLDatabaseTasks.class_eval do
         | 
| 32 32 |  | 
| 33 33 | 
             
                def error_class
         | 
| 34 | 
            -
                   | 
| 35 | 
            -
                    unless ActiveRecord::JDBCError.instance_methods.include?(:error)
         | 
| 36 | 
            -
                      ActiveRecord::JDBCError.send :alias_method, :error, :sql_exception
         | 
| 37 | 
            -
                    end
         | 
| 38 | 
            -
                    ActiveRecord::JDBCError
         | 
| 39 | 
            -
                  end
         | 
| 34 | 
            +
                  ActiveRecord::JDBCError
         | 
| 40 35 | 
             
                end
         | 
| 41 36 |  | 
| 42 37 | 
             
              end
         | 
| 43 | 
            -
             | 
| 38 | 
            +
              
         | 
| 44 39 | 
             
            end
         | 
    
        data/lib/arjdbc/version.rb
    CHANGED
    
    
    
        data/rakelib/db.rake
    CHANGED
    
    | @@ -6,8 +6,6 @@ namespace :db do | |
| 6 6 | 
             
              task :mysql do
         | 
| 7 7 | 
             
                fail "could not create test database: mysql executable not found" unless mysql = which('mysql')
         | 
| 8 8 | 
             
                load 'test/db/mysql_config.rb' # rescue nil
         | 
| 9 | 
            -
                puts MYSQL_CONFIG.inspect if $VERBOSE
         | 
| 10 | 
            -
                # DROP USER arjdbc@localhost; __ERROR 1396 (HY000): Operation CREATE USER failed__
         | 
| 11 9 | 
             
                script = sql_script <<-SQL, 'mysql'
         | 
| 12 10 | 
             
            DROP DATABASE IF EXISTS `#{MYSQL_CONFIG[:database]}`;
         | 
| 13 11 | 
             
            CREATE USER #{MYSQL_CONFIG[:username]}@localhost;
         | 
| @@ -17,13 +15,13 @@ GRANT ALL PRIVILEGES ON `test\_%`.* TO #{MYSQL_CONFIG[:username]}@localhost; | |
| 17 15 | 
             
            SET PASSWORD FOR #{MYSQL_CONFIG[:username]}@localhost = PASSWORD('#{MYSQL_CONFIG[:password]}');
         | 
| 18 16 | 
             
            SQL
         | 
| 19 17 | 
             
                params = { '-u' => 'root' }
         | 
| 20 | 
            -
                if ENV['DATABASE_YML'] | 
| 21 | 
            -
                   | 
| 18 | 
            +
                if ENV['DATABASE_YML']
         | 
| 19 | 
            +
                  require 'yaml'
         | 
| 20 | 
            +
                  password = YAML.load(File.new(ENV['DATABASE_YML']))["production"]["password"]
         | 
| 21 | 
            +
                  params['--password'] = password
         | 
| 22 22 | 
             
                end
         | 
| 23 | 
            -
                params['-u'] = ENV['MY_USER'] if ENV['MY_USER']
         | 
| 24 | 
            -
                params['-p'] = ENV['MY_PASSWORD'] if ENV['MY_PASSWORD']
         | 
| 25 23 | 
             
                puts "Creating MySQL (test) database: #{MYSQL_CONFIG[:database]}"
         | 
| 26 | 
            -
                sh "cat #{script.path} | #{mysql} -f #{params. | 
| 24 | 
            +
                sh "cat #{script.path} | #{mysql} -f #{params.to_a.join(' ')}", :verbose => $VERBOSE # so password is not echoed
         | 
| 27 25 | 
             
              end
         | 
| 28 26 |  | 
| 29 27 | 
             
              desc "Creates the test database for PostgreSQL"
         | 
| @@ -31,7 +29,6 @@ SQL | |
| 31 29 | 
             
                fail 'could not create test database: psql executable not found' unless psql = which('psql')
         | 
| 32 30 | 
             
                fail 'could not create test database: missing "postgres" role' unless PostgresHelper.postgres_role?
         | 
| 33 31 | 
             
                load 'test/db/postgres_config.rb' # rescue nil
         | 
| 34 | 
            -
                puts POSTGRES_CONFIG.inspect if $VERBOSE
         | 
| 35 32 | 
             
                script = sql_script <<-SQL, 'psql'
         | 
| 36 33 | 
             
            DROP DATABASE IF EXISTS #{POSTGRES_CONFIG[:database]};
         | 
| 37 34 | 
             
            DROP USER IF EXISTS #{POSTGRES_CONFIG[:username]};
         | 
| @@ -244,7 +244,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 244 244 | 
             
                    });
         | 
| 245 245 | 
             
                }
         | 
| 246 246 |  | 
| 247 | 
            -
                @JRubyMethod(name = "begin", optional = 1) // optional isolation argument for AR-4.0
         | 
| 247 | 
            +
                @JRubyMethod(name = {"begin", "transaction"}, optional = 1) // optional isolation argument for AR-4.0
         | 
| 248 248 | 
             
                public IRubyObject begin(final ThreadContext context, final IRubyObject[] args) {
         | 
| 249 249 | 
             
                    final IRubyObject isolation = args.length > 0 ? args[0] : null;
         | 
| 250 250 | 
             
                    try { // handleException == false so we can handle setTXIsolation
         | 
| @@ -588,19 +588,25 @@ public class RubyJdbcConnection extends RubyObject { | |
| 588 588 | 
             
                        public IRubyObject call(final Connection connection) throws SQLException {
         | 
| 589 589 | 
             
                            Statement statement = null;
         | 
| 590 590 | 
             
                            final String query = sql.convertToString().getUnicodeValue();
         | 
| 591 | 
            +
             | 
| 591 592 | 
             
                            try {
         | 
| 592 593 | 
             
                                statement = createStatement(context, connection);
         | 
| 593 594 | 
             
                                if ( doExecute(statement, query) ) {
         | 
| 594 | 
            -
                                     | 
| 595 | 
            +
                                    ResultSet resultSet = statement.getResultSet();
         | 
| 596 | 
            +
                                    ColumnData[] columns = extractColumns(context.runtime, connection, resultSet, false);
         | 
| 597 | 
            +
             | 
| 598 | 
            +
                                    return mapToResult(context, context.runtime, connection, resultSet, columns);
         | 
| 595 599 | 
             
                                } else {
         | 
| 596 | 
            -
                                    return  | 
| 600 | 
            +
                                    //return context.runtime.newFixnum( statement.getUpdateCount());
         | 
| 601 | 
            +
                                    return context.runtime.newEmptyArray();
         | 
| 602 | 
            +
                                    //return mapGeneratedKeysOrUpdateCount(context, connection, statement);
         | 
| 597 603 | 
             
                                }
         | 
| 598 | 
            -
                            }
         | 
| 599 | 
            -
                            catch (final SQLException e) {
         | 
| 604 | 
            +
                            } catch (final SQLException e) {
         | 
| 600 605 | 
             
                                debugErrorSQL(context, query);
         | 
| 601 606 | 
             
                                throw e;
         | 
| 607 | 
            +
                            } finally {
         | 
| 608 | 
            +
                                close(statement);
         | 
| 602 609 | 
             
                            }
         | 
| 603 | 
            -
                            finally { close(statement); }
         | 
| 604 610 | 
             
                        }
         | 
| 605 611 | 
             
                    });
         | 
| 606 612 | 
             
                }
         | 
| @@ -695,6 +701,14 @@ public class RubyJdbcConnection extends RubyObject { | |
| 695 701 | 
             
                    }
         | 
| 696 702 | 
             
                }
         | 
| 697 703 |  | 
| 704 | 
            +
                @JRubyMethod(name = {"execute_prepared_update"}, required = 2)
         | 
| 705 | 
            +
                public IRubyObject execute_prepared_update(final ThreadContext context,
         | 
| 706 | 
            +
                                                           final IRubyObject sql, final IRubyObject binds) throws SQLException {
         | 
| 707 | 
            +
             | 
| 708 | 
            +
                    final String query = sql.convertToString().getUnicodeValue();
         | 
| 709 | 
            +
                    return executePreparedUpdate(context, query, (List) binds, false);
         | 
| 710 | 
            +
                }
         | 
| 711 | 
            +
             | 
| 698 712 | 
             
                /**
         | 
| 699 713 | 
             
                 * @param context
         | 
| 700 714 | 
             
                 * @param query
         | 
| @@ -879,7 +893,6 @@ public class RubyJdbcConnection extends RubyObject { | |
| 879 893 | 
             
                 * @param sql
         | 
| 880 894 | 
             
                 * @return raw query result as a name => value Hash (unless block given)
         | 
| 881 895 | 
             
                 * @throws SQLException
         | 
| 882 | 
            -
                 * @see #execute_query(ThreadContext, IRubyObject[], Block)
         | 
| 883 896 | 
             
                 */
         | 
| 884 897 | 
             
                @JRubyMethod(name = "execute_query", required = 1)
         | 
| 885 898 | 
             
                public IRubyObject execute_query(final ThreadContext context,
         | 
| @@ -895,7 +908,6 @@ public class RubyJdbcConnection extends RubyObject { | |
| 895 908 | 
             
                 * @return and <code>ActiveRecord::Result</code>
         | 
| 896 909 | 
             
                 * @throws SQLException
         | 
| 897 910 | 
             
                 *
         | 
| 898 | 
            -
                 * @see #execute_query(ThreadContext, IRubyObject, IRubyObject, Block)
         | 
| 899 911 | 
             
                 */
         | 
| 900 912 | 
             
                @JRubyMethod(name = "execute_query", required = 2, optional = 1)
         | 
| 901 913 | 
             
                // @JRubyMethod(name = "execute_query", required = 1, optional = 2)
         | 
| @@ -930,6 +942,18 @@ public class RubyJdbcConnection extends RubyObject { | |
| 930 942 | 
             
                    }
         | 
| 931 943 | 
             
                }
         | 
| 932 944 |  | 
| 945 | 
            +
                @JRubyMethod(name = "execute_prepared_query")
         | 
| 946 | 
            +
                public IRubyObject execute_prepared_query(final ThreadContext context,
         | 
| 947 | 
            +
                                                          final IRubyObject sql, final IRubyObject binds) throws SQLException {
         | 
| 948 | 
            +
                    final String query = sql.convertToString().getUnicodeValue();
         | 
| 949 | 
            +
             | 
| 950 | 
            +
                    if (binds == null || !(binds instanceof RubyArray)) {
         | 
| 951 | 
            +
                        throw context.runtime.newArgumentError("binds exptected to an instance of Array");
         | 
| 952 | 
            +
                    }
         | 
| 953 | 
            +
             | 
| 954 | 
            +
                    return executePreparedQuery(context, query, (List) binds, 0);
         | 
| 955 | 
            +
                }
         | 
| 956 | 
            +
             | 
| 933 957 | 
             
                /**
         | 
| 934 958 | 
             
                 * NOTE: This methods behavior changed in AR-JDBC 1.3 the old behavior is
         | 
| 935 959 | 
             
                 * achievable using {@link #executeQueryRaw(ThreadContext, String, int, Block)}.
         | 
| @@ -939,25 +963,59 @@ public class RubyJdbcConnection extends RubyObject { | |
| 939 963 | 
             
                 * @param maxRows
         | 
| 940 964 | 
             
                 * @return AR (mapped) query result
         | 
| 941 965 | 
             
                 *
         | 
| 942 | 
            -
                 * @see #execute_query(ThreadContext, IRubyObject)
         | 
| 943 | 
            -
                 * @see #execute_query(ThreadContext, IRubyObject, IRubyObject)
         | 
| 944 | 
            -
                 * @see #mapToResult(ThreadContext, Ruby, DatabaseMetaData, ResultSet, RubyJdbcConnection.ColumnData[])
         | 
| 945 966 | 
             
                 */
         | 
| 946 967 | 
             
                protected IRubyObject executeQuery(final ThreadContext context, final String query, final int maxRows) {
         | 
| 947 968 | 
             
                    return withConnection(context, new Callable<IRubyObject>() {
         | 
| 948 969 | 
             
                        public IRubyObject call(final Connection connection) throws SQLException {
         | 
| 949 | 
            -
                            Statement statement = null; | 
| 970 | 
            +
                            Statement statement = null;
         | 
| 971 | 
            +
                            ResultSet resultSet = null;
         | 
| 972 | 
            +
             | 
| 950 973 | 
             
                            try {
         | 
| 951 974 | 
             
                                statement = createStatement(context, connection);
         | 
| 952 975 | 
             
                                statement.setMaxRows(maxRows); // zero means there is no limit
         | 
| 953 976 | 
             
                                resultSet = statement.executeQuery(query);
         | 
| 954 977 | 
             
                                return mapQueryResult(context, connection, resultSet);
         | 
| 978 | 
            +
                            } catch (final SQLException e) {
         | 
| 979 | 
            +
                                debugErrorSQL(context, query);
         | 
| 980 | 
            +
                                throw e;
         | 
| 981 | 
            +
                            } finally {
         | 
| 982 | 
            +
                                close(resultSet);
         | 
| 983 | 
            +
                                close(statement);
         | 
| 955 984 | 
             
                            }
         | 
| 956 | 
            -
             | 
| 985 | 
            +
                        }
         | 
| 986 | 
            +
                    });
         | 
| 987 | 
            +
                }
         | 
| 988 | 
            +
             | 
| 989 | 
            +
                @JRubyMethod
         | 
| 990 | 
            +
                public IRubyObject execute_prepared(final ThreadContext context, final IRubyObject sql, final IRubyObject binds) {
         | 
| 991 | 
            +
                    return withConnection(context, new Callable<IRubyObject>() {
         | 
| 992 | 
            +
                        public IRubyObject call(final Connection connection) throws SQLException {
         | 
| 993 | 
            +
                            PreparedStatement statement = null;
         | 
| 994 | 
            +
                            final String query = sql.convertToString().getUnicodeValue();
         | 
| 995 | 
            +
             | 
| 996 | 
            +
                            // FIXME: array type check for binds
         | 
| 997 | 
            +
             | 
| 998 | 
            +
                            try {
         | 
| 999 | 
            +
                                statement = connection.prepareStatement(query);
         | 
| 1000 | 
            +
                                setStatementParameters(context, connection, statement, (List) binds);
         | 
| 1001 | 
            +
                                boolean hasResultSet = statement.execute();
         | 
| 1002 | 
            +
             | 
| 1003 | 
            +
                                if (hasResultSet) {
         | 
| 1004 | 
            +
                                    ResultSet resultSet = statement.getResultSet();
         | 
| 1005 | 
            +
                                    ColumnData[] columns = extractColumns(context.runtime, connection, resultSet, false);
         | 
| 1006 | 
            +
             | 
| 1007 | 
            +
                                    return mapToResult(context, context.runtime, connection, resultSet, columns);
         | 
| 1008 | 
            +
                                } else {
         | 
| 1009 | 
            +
                                    return context.runtime.newEmptyArray();
         | 
| 1010 | 
            +
                                    //return context.runtime.newFixnum( statement.getUpdateCount());
         | 
| 1011 | 
            +
            //                        return mapGeneratedKeysOrUpdateCount(context, connection, statement);
         | 
| 1012 | 
            +
                                }
         | 
| 1013 | 
            +
                            } catch (final SQLException e) {
         | 
| 957 1014 | 
             
                                debugErrorSQL(context, query);
         | 
| 958 1015 | 
             
                                throw e;
         | 
| 1016 | 
            +
                            } finally {
         | 
| 1017 | 
            +
                                close(statement);
         | 
| 959 1018 | 
             
                            }
         | 
| 960 | 
            -
                            finally { close(resultSet); close(statement); }
         | 
| 961 1019 | 
             
                        }
         | 
| 962 1020 | 
             
                    });
         | 
| 963 1021 | 
             
                }
         | 
| @@ -1473,8 +1531,8 @@ public class RubyJdbcConnection extends RubyObject { | |
| 1473 1531 | 
             
                    final IRubyObject record, final IRubyObject column, final IRubyObject value)
         | 
| 1474 1532 | 
             
                    throws SQLException {
         | 
| 1475 1533 |  | 
| 1476 | 
            -
                    // column.type == :binary
         | 
| 1477 | 
            -
             | 
| 1534 | 
            +
                    final boolean binary = // column.type == :binary
         | 
| 1535 | 
            +
                        column.callMethod(context, "type").toString() == (Object) "binary";
         | 
| 1478 1536 |  | 
| 1479 1537 | 
             
                    final IRubyObject recordClass = record.callMethod(context, "class");
         | 
| 1480 1538 | 
             
                    final IRubyObject adapter = recordClass.callMethod(context, "connection");
         | 
| @@ -1671,7 +1729,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 1671 1729 |  | 
| 1672 1730 | 
             
                /**
         | 
| 1673 1731 | 
             
                 * @deprecated this method is no longer used, instead consider overriding
         | 
| 1674 | 
            -
                 * {@link #mapToResult(ThreadContext, Ruby,  | 
| 1732 | 
            +
                 * {@link #mapToResult(ThreadContext, Ruby, Connection, ResultSet, RubyJdbcConnection.ColumnData[])}
         | 
| 1675 1733 | 
             
                 */
         | 
| 1676 1734 | 
             
                @Deprecated
         | 
| 1677 1735 | 
             
                protected void populateFromResultSet(
         | 
| @@ -1688,7 +1746,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 1688 1746 | 
             
                 * Maps a query result into a <code>ActiveRecord</code> result.
         | 
| 1689 1747 | 
             
                 * @param context
         | 
| 1690 1748 | 
             
                 * @param runtime
         | 
| 1691 | 
            -
                 * @param  | 
| 1749 | 
            +
                 * @param connection
         | 
| 1692 1750 | 
             
                 * @param resultSet
         | 
| 1693 1751 | 
             
                 * @param columns
         | 
| 1694 1752 | 
             
                 * @return since 3.1 expected to return a <code>ActiveRecord::Result</code>
         | 
| @@ -2163,20 +2221,26 @@ public class RubyJdbcConnection extends RubyObject { | |
| 2163 2221 | 
             
                    }
         | 
| 2164 2222 | 
             
                }
         | 
| 2165 2223 |  | 
| 2166 | 
            -
                 | 
| 2167 | 
            -
             | 
| 2168 | 
            -
             | 
| 2169 | 
            -
             | 
| 2170 | 
            -
                     | 
| 2224 | 
            +
                // So far we have only examined the needs to Sqlite3 but for that adapter (and it is old JDBC adapter)
         | 
| 2225 | 
            +
                // we can pass all tests but binary column types with just the supplied value.  So we will leave it
         | 
| 2226 | 
            +
                // this way until we upgrade Sqlite adapter and get some more databases supported.
         | 
| 2227 | 
            +
                protected int typeHack(ThreadContext context, IRubyObject column, Object value) throws SQLException {
         | 
| 2228 | 
            +
                    if (column != null) {
         | 
| 2229 | 
            +
                        String columnType = column.asString().toString();
         | 
| 2171 2230 |  | 
| 2172 | 
            -
             | 
| 2173 | 
            -
             | 
| 2174 | 
            -
                         | 
| 2175 | 
            -
                    } else {
         | 
| 2176 | 
            -
                        value = rawValue;
         | 
| 2231 | 
            +
                        if (columnType.equals("binary")) return jdbcTypeFor(context, context.runtime, column, value);
         | 
| 2232 | 
            +
             | 
| 2233 | 
            +
                        column = null;
         | 
| 2177 2234 | 
             
                    }
         | 
| 2178 2235 |  | 
| 2179 | 
            -
                     | 
| 2236 | 
            +
                    return jdbcTypeFor(context, context.runtime, column, value);
         | 
| 2237 | 
            +
                }
         | 
| 2238 | 
            +
             | 
| 2239 | 
            +
                protected void setStatementParameter(final ThreadContext context,
         | 
| 2240 | 
            +
                        final Ruby runtime, final Connection connection,
         | 
| 2241 | 
            +
                        final PreparedStatement statement, final int index,
         | 
| 2242 | 
            +
                        final Object value, IRubyObject column) throws SQLException {
         | 
| 2243 | 
            +
                    int type = typeHack(context, column, value);
         | 
| 2180 2244 |  | 
| 2181 2245 | 
             
                    switch (type) {
         | 
| 2182 2246 | 
             
                        case Types.TINYINT:
         | 
| @@ -2218,7 +2282,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 2218 2282 | 
             
                            setXmlParameter(context, connection, statement, index, value, column, type);
         | 
| 2219 2283 | 
             
                            break;
         | 
| 2220 2284 | 
             
                        case Types.ARRAY:
         | 
| 2221 | 
            -
                            setArrayParameter(context, connection, statement, index,  | 
| 2285 | 
            +
                            setArrayParameter(context, connection, statement, index, value, column, type);
         | 
| 2222 2286 | 
             
                            break;
         | 
| 2223 2287 | 
             
                        case Types.JAVA_OBJECT:
         | 
| 2224 2288 | 
             
                        case Types.OTHER:
         | 
| @@ -2878,10 +2942,11 @@ public class RubyJdbcConnection extends RubyObject { | |
| 2878 2942 | 
             
                        }
         | 
| 2879 2943 | 
             
                        else { // should be a RubyString
         | 
| 2880 2944 | 
             
                            final ByteList blob = value.asString().getByteList();
         | 
| 2881 | 
            -
                            statement. | 
| 2882 | 
            -
             | 
| 2883 | 
            -
                                blob. | 
| 2884 | 
            -
             | 
| 2945 | 
            +
                            statement.setBytes(index, blob.bytes());
         | 
| 2946 | 
            +
                            //statement.setBinaryStream(index,
         | 
| 2947 | 
            +
            //                    new ByteArrayInputStream(blob.unsafeBytes(), blob.getBegin(), blob.getRealSize()),
         | 
| 2948 | 
            +
            //                    blob.getRealSize() // length
         | 
| 2949 | 
            +
            //                );
         | 
| 2885 2950 | 
             
                            // JDBC 4.0 :
         | 
| 2886 2951 | 
             
                            //statement.setBlob(index,
         | 
| 2887 2952 | 
             
                            //    new ByteArrayInputStream(bytes.unsafeBytes(), bytes.getBegin(), bytes.getRealSize())
         | 
| @@ -3117,7 +3182,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 3117 3182 | 
             
                /**
         | 
| 3118 3183 | 
             
                 * Create a string which represents a SQL type usable by Rails from the
         | 
| 3119 3184 | 
             
                 * resultSet column meta-data
         | 
| 3120 | 
            -
                 * @param resultSet | 
| 3185 | 
            +
                 * @param resultSet
         | 
| 3121 3186 | 
             
                 */
         | 
| 3122 3187 | 
             
                protected String typeFromResultSet(final ResultSet resultSet) throws SQLException {
         | 
| 3123 3188 | 
             
                    final int precision = intFromResultSet(resultSet, COLUMN_SIZE);
         | 
| @@ -3432,7 +3497,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 3432 3497 | 
             
                /**
         | 
| 3433 3498 | 
             
                 * Extract columns from result set.
         | 
| 3434 3499 | 
             
                 * @param runtime
         | 
| 3435 | 
            -
                 * @param  | 
| 3500 | 
            +
                 * @param connection
         | 
| 3436 3501 | 
             
                 * @param resultSet
         | 
| 3437 3502 | 
             
                 * @param downCase
         | 
| 3438 3503 | 
             
                 * @return columns data
         | 
| @@ -3452,7 +3517,7 @@ public class RubyJdbcConnection extends RubyObject { | |
| 3452 3517 | 
             
                }
         | 
| 3453 3518 |  | 
| 3454 3519 | 
             
                /**
         | 
| 3455 | 
            -
                 * @deprecated renamed and parameterized to {@link #withConnection(ThreadContext,  | 
| 3520 | 
            +
                 * @deprecated renamed and parameterized to {@link #withConnection(ThreadContext, boolean, Callable)}
         | 
| 3456 3521 | 
             
                 */
         | 
| 3457 3522 | 
             
                @Deprecated
         | 
| 3458 3523 | 
             
                @SuppressWarnings("unchecked")
         | 
| @@ -54,7 +54,6 @@ import org.jruby.exceptions.RaiseException; | |
| 54 54 | 
             
            import org.jruby.runtime.ObjectAllocator;
         | 
| 55 55 | 
             
            import org.jruby.runtime.ThreadContext;
         | 
| 56 56 | 
             
            import org.jruby.runtime.builtin.IRubyObject;
         | 
| 57 | 
            -
            import org.jruby.util.ByteList;
         | 
| 58 57 |  | 
| 59 58 | 
             
            /**
         | 
| 60 59 | 
             
             *
         | 
| @@ -103,12 +102,6 @@ public class MySQLRubyJdbcConnection extends RubyJdbcConnection { | |
| 103 102 | 
             
                        final int value = resultSet.getInt(column);
         | 
| 104 103 | 
             
                        return resultSet.wasNull() ? runtime.getNil() : runtime.newFixnum(value);
         | 
| 105 104 | 
             
                    }
         | 
| 106 | 
            -
                    else if ( type == Types.BINARY || type == Types.VARBINARY) {
         | 
| 107 | 
            -
                        final byte[] bytes = resultSet.getBytes(column);
         | 
| 108 | 
            -
                        if ( bytes == null || resultSet.wasNull() ) return runtime.getNil();
         | 
| 109 | 
            -
                        final ByteList byteList = new ByteList(bytes, false);
         | 
| 110 | 
            -
                        return new RubyString(runtime, runtime.getString(), byteList);
         | 
| 111 | 
            -
                    }
         | 
| 112 105 | 
             
                    return super.jdbcToRuby(context, runtime, column, type, resultSet);
         | 
| 113 106 | 
             
                }
         | 
| 114 107 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,35 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: activerecord-jdbc-adapter
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 5.0.pre1
         | 
| 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:  | 
| 11 | 
            +
            date: 2016-11-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: activerecord
         | 
| 14 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 15 16 | 
             
                requirements:
         | 
| 16 17 | 
             
                - - ">="
         | 
| 17 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 18 19 | 
             
                    version: '2.2'
         | 
| 19 | 
            -
                - - "<"
         | 
| 20 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: '5.0'
         | 
| 22 | 
            -
              name: activerecord
         | 
| 23 | 
            -
              prerelease: false
         | 
| 24 | 
            -
              type: :runtime
         | 
| 25 20 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 26 21 | 
             
                requirements:
         | 
| 27 22 | 
             
                - - ">="
         | 
| 28 23 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 24 | 
             
                    version: '2.2'
         | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
                    version: '5.0'
         | 
| 25 | 
            +
              prerelease: false
         | 
| 26 | 
            +
              type: :runtime
         | 
| 33 27 | 
             
            description: 'AR-JDBC is a database adapter for Rails'' ActiveRecord component designed
         | 
| 34 28 | 
             
              to be used with JRuby built upon Java''s JDBC API for database access. Provides
         | 
| 35 29 | 
             
              (ActiveRecord) built-in adapters: MySQL, PostgreSQL and SQLite3 as well as adapters
         | 
| @@ -85,6 +79,7 @@ files: | |
| 85 79 | 
             
            - lib/arel/visitors/sql_server.rb
         | 
| 86 80 | 
             
            - lib/arel/visitors/sql_server/ng42.rb
         | 
| 87 81 | 
             
            - lib/arjdbc.rb
         | 
| 82 | 
            +
            - lib/arjdbc/common_jdbc_methods.rb
         | 
| 88 83 | 
             
            - lib/arjdbc/db2.rb
         | 
| 89 84 | 
             
            - lib/arjdbc/db2/adapter.rb
         | 
| 90 85 | 
             
            - lib/arjdbc/db2/as400.rb
         | 
| @@ -114,7 +109,6 @@ files: | |
| 114 109 | 
             
            - lib/arjdbc/jdbc/adapter.rb
         | 
| 115 110 | 
             
            - lib/arjdbc/jdbc/adapter_java.jar
         | 
| 116 111 | 
             
            - lib/arjdbc/jdbc/adapter_require.rb
         | 
| 117 | 
            -
            - lib/arjdbc/jdbc/arel_support.rb
         | 
| 118 112 | 
             
            - lib/arjdbc/jdbc/base_ext.rb
         | 
| 119 113 | 
             
            - lib/arjdbc/jdbc/callbacks.rb
         | 
| 120 114 | 
             
            - lib/arjdbc/jdbc/column.rb
         | 
| @@ -134,7 +128,6 @@ files: | |
| 134 128 | 
             
            - lib/arjdbc/mimer/adapter.rb
         | 
| 135 129 | 
             
            - lib/arjdbc/mssql.rb
         | 
| 136 130 | 
             
            - lib/arjdbc/mssql/adapter.rb
         | 
| 137 | 
            -
            - lib/arjdbc/mssql/attributes_for_update.rb
         | 
| 138 131 | 
             
            - lib/arjdbc/mssql/column.rb
         | 
| 139 132 | 
             
            - lib/arjdbc/mssql/connection_methods.rb
         | 
| 140 133 | 
             
            - lib/arjdbc/mssql/explain_support.rb
         | 
| @@ -170,7 +163,6 @@ files: | |
| 170 163 | 
             
            - lib/arjdbc/sqlite3.rb
         | 
| 171 164 | 
             
            - lib/arjdbc/sqlite3/adapter.rb
         | 
| 172 165 | 
             
            - lib/arjdbc/sqlite3/connection_methods.rb
         | 
| 173 | 
            -
            - lib/arjdbc/sqlite3/explain_support.rb
         | 
| 174 166 | 
             
            - lib/arjdbc/sybase.rb
         | 
| 175 167 | 
             
            - lib/arjdbc/sybase/adapter.rb
         | 
| 176 168 | 
             
            - lib/arjdbc/tasks.rb
         | 
| @@ -251,13 +243,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 251 243 | 
             
                  version: '0'
         | 
| 252 244 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 253 245 | 
             
              requirements:
         | 
| 254 | 
            -
              - - " | 
| 246 | 
            +
              - - ">"
         | 
| 255 247 | 
             
                - !ruby/object:Gem::Version
         | 
| 256 | 
            -
                  version:  | 
| 248 | 
            +
                  version: 1.3.1
         | 
| 257 249 | 
             
            requirements: []
         | 
| 258 250 | 
             
            rubyforge_project: jruby-extras
         | 
| 259 | 
            -
            rubygems_version: 2.6. | 
| 251 | 
            +
            rubygems_version: 2.6.8
         | 
| 260 252 | 
             
            signing_key:
         | 
| 261 253 | 
             
            specification_version: 4
         | 
| 262 254 | 
             
            summary: JDBC adapter for ActiveRecord, for use within JRuby on Rails.
         | 
| 263 255 | 
             
            test_files: []
         | 
| 256 | 
            +
            has_rdoc:
         |