ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-4175: JdbcResultSet.wasNull() method now returns null if column value is NULL. This closes #1235.
Date Tue, 22 Nov 2016 09:01:10 GMT
Repository: ignite
Updated Branches:
  refs/heads/master ca97f8736 -> a884db53f


IGNITE-4175: JdbcResultSet.wasNull() method now returns null if column value is NULL. This
closes #1235.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a884db53
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a884db53
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a884db53

Branch: refs/heads/master
Commit: a884db53fc66e2d557595fa8a7de88071cccf56a
Parents: ca97f87
Author: Andrey V. Mashenkov <andrey.mashenkov@gmail.com>
Authored: Tue Nov 22 12:00:54 2016 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Tue Nov 22 12:00:54 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/internal/jdbc/JdbcResultSet.java    | 10 ++++++++--
 .../org/apache/ignite/internal/jdbc2/JdbcResultSet.java   |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a884db53/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
index 5961279..ee15471 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
@@ -1502,16 +1502,22 @@ public class JdbcResultSet implements ResultSet {
      * @return Casted field value.
      * @throws SQLException In case of error.
      */
+    @SuppressWarnings("unchecked")
     private <T> T getTypedValue(int colIdx, Class<T> cls) throws SQLException
{
         ensureNotClosed();
         ensureHasCurrentRow();
 
         try {
-            T val = cls == String.class ? (T)String.valueOf(curr.get(colIdx - 1)) : (T)curr.get(colIdx
- 1);
+            Object val = curr.get(colIdx - 1);
 
             wasNull = val == null;
 
-            return val;
+            if (val == null)
+                return null;
+            else if (cls == String.class)
+                return (T)String.valueOf(val);
+            else
+                return (T)val;
         }
         catch (IndexOutOfBoundsException ignored) {
             throw new SQLException("Invalid column index: " + colIdx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/a884db53/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
index 8e0e9d0..1bf5223 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
@@ -1484,11 +1484,16 @@ public class JdbcResultSet implements ResultSet {
         ensureHasCurrentRow();
 
         try {
-            T val = cls == String.class ? (T)String.valueOf(curr.get(colIdx - 1)) : (T)curr.get(colIdx
- 1);
+            Object val = curr.get(colIdx - 1);
 
             wasNull = val == null;
 
-            return val;
+            if (val == null)
+                return null;
+            else if (cls == String.class)
+                return (T)String.valueOf(val);
+            else
+                return (T)val;
         }
         catch (IndexOutOfBoundsException ignored) {
             throw new SQLException("Invalid column index: " + colIdx);


Mime
View raw message