activerecord-jdbc-alt-adapter 51.3.0-java → 51.3.1-java

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
  SHA256:
3
- metadata.gz: a685f3d4b7d4a927785b4c4e6d0617967552c297e87a65cf1f66ea7e0fdd5c83
4
- data.tar.gz: ca34ee0b1f3bb347e54815af6272f6eb4e183daa9f35dc739e8d60bc3630cfd2
3
+ metadata.gz: 14951fdf9a0e78502d04e2121a0d9375a7df2f2c2799f68900f90bd35faf7e11
4
+ data.tar.gz: de5abde7fda2e40f717246a69978ea0bf9b485368e9da5415211e84a136803b4
5
5
  SHA512:
6
- metadata.gz: 2a83701ef6268570ede2d819b1f2296eede75f30d9a75c7ae21ce87cd6eea95584bd096019d7e80149476f7107e7310dbd0c701f8eadc0c28fbd87cde2155568
7
- data.tar.gz: 4764519a0791450964dd35136ec81584934bfc08ab81fd1d1cd8bbe912aa602d55ed3525cec59c45dd863c64e94a6da506c9cd10932b755a76e8d31d05ee3188
6
+ metadata.gz: f0bc89c6ebbad713b42e3ed992594f691a72faeabfc9cc5873881f145f081782c134d1615c8c2bd351306209a0ef872908180b0c1c0976957e428b1ff67eed59
7
+ data.tar.gz: 2cd4047462b8bcb01e16ba0b319c95ec6a6e12c746268564c868ed43a245da5a462e8f316ac5778021d684cb5fc40fb12b5c8f923adb05baa098d86aebd6d2d2
@@ -1,3 +1,3 @@
1
1
  module ArJdbc
2
- VERSION = '51.3.0'
2
+ VERSION = '51.3.1'
3
3
  end
@@ -36,6 +36,7 @@ import java.sql.ResultSet;
36
36
  import java.sql.Savepoint;
37
37
  import java.sql.SQLException;
38
38
  import java.sql.Types;
39
+ import java.sql.Date;
39
40
  import java.sql.Timestamp;
40
41
  import java.util.Locale;
41
42
 
@@ -305,6 +306,21 @@ public class MSSQLRubyJdbcConnection extends RubyJdbcConnection {
305
306
  statement.setObject(index, timeStr, Types.NVARCHAR);
306
307
  }
307
308
 
309
+ @Override
310
+ protected void setDateParameter(final ThreadContext context,
311
+ final Connection connection, final PreparedStatement statement,
312
+ final int index, IRubyObject value,
313
+ final IRubyObject attribute, final int type) throws SQLException {
314
+
315
+ if ( ! "Date".equals(value.getMetaClass().getName()) && value.respondsTo("to_date") ) {
316
+ value = value.callMethod(context, "to_date");
317
+ }
318
+
319
+ // NOTE: Here we relay in ActiveRecord (ActiveSupport) to get
320
+ // the date as a string in the database format.
321
+ statement.setDate(index, Date.valueOf(value.callMethod(context, "to_s", context.runtime.newSymbol("db")).toString()));
322
+ }
323
+
308
324
  // Overrides the method in parent, we only remove the savepoint
309
325
  // from the getSavepoints Map
310
326
  @JRubyMethod(name = "release_savepoint", required = 1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-jdbc-alt-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 51.3.0
4
+ version: 51.3.1
5
5
  platform: java
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: 2019-06-16 00:00:00.000000000 Z
11
+ date: 2019-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement