Skip to content

Commit e1faef5

Browse files
committed
[core] compat fix
1 parent c68df3f commit e1faef5

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

lib/arjdbc/abstract/database_statements.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ def exec_insert(sql, name = nil, binds = NO_BINDS, pk = nil, sequence_name = nil
1313
binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
1414

1515
if without_prepared_statement?(binds)
16-
log(sql, name) { @connection.execute_insert(sql, pk) }
16+
log(sql, name) { @connection.execute_insert_pk(sql, pk) }
1717
else
1818
log(sql, name, binds) do
19-
@connection.execute_insert(sql, binds, pk)
19+
@connection.execute_insert_pk(sql, binds, pk)
2020
end
2121
end
2222
end

src/java/arjdbc/jdbc/RubyJdbcConnection.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,8 @@ private static String[] createStatementPk(IRubyObject pk) {
911911
* @return ActiveRecord::Result
912912
* @throws SQLException
913913
*/
914-
@JRubyMethod(name = "execute_insert", required = 2)
915-
public IRubyObject execute_insert(final ThreadContext context, final IRubyObject sql, final IRubyObject pk) {
914+
@JRubyMethod(name = "execute_insert_pk", required = 2)
915+
public IRubyObject execute_insert_pk(final ThreadContext context, final IRubyObject sql, final IRubyObject pk) {
916916
return withConnection(context, new Callable<IRubyObject>() {
917917
public IRubyObject call(final Connection connection) throws SQLException {
918918
Statement statement = null;
@@ -939,6 +939,12 @@ public IRubyObject call(final Connection connection) throws SQLException {
939939
});
940940
}
941941

942+
@Deprecated
943+
@JRubyMethod(name = "execute_insert", required = 1)
944+
public IRubyObject execute_insert(final ThreadContext context, final IRubyObject sql) {
945+
return execute_insert_pk(context, sql, context.nil);
946+
}
947+
942948
/**
943949
* Executes an INSERT SQL statement using a prepared statement
944950
* @param context
@@ -948,9 +954,9 @@ public IRubyObject call(final Connection connection) throws SQLException {
948954
* @return ActiveRecord::Result
949955
* @throws SQLException
950956
*/
951-
@JRubyMethod(name = "execute_insert", required = 3)
952-
public IRubyObject execute_insert(final ThreadContext context, final IRubyObject sql, final IRubyObject binds,
953-
final IRubyObject pk) {
957+
@JRubyMethod(name = "execute_insert_pk", required = 3)
958+
public IRubyObject execute_insert_pk(final ThreadContext context, final IRubyObject sql, final IRubyObject binds,
959+
final IRubyObject pk) {
954960
return withConnection(context, new Callable<IRubyObject>() {
955961
public IRubyObject call(final Connection connection) throws SQLException {
956962
PreparedStatement statement = null;
@@ -976,6 +982,12 @@ public IRubyObject call(final Connection connection) throws SQLException {
976982
});
977983
}
978984

985+
@Deprecated
986+
@JRubyMethod(name = "execute_insert", required = 2)
987+
public IRubyObject execute_insert(final ThreadContext context, final IRubyObject binds, final IRubyObject sql) {
988+
return execute_insert_pk(context, sql, binds, context.nil);
989+
}
990+
979991
/**
980992
* Executes an UPDATE (DELETE) SQL statement
981993
* @param context

0 commit comments

Comments
 (0)