ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [04/33] ignite git commit: IGNITE-6396: JDBC thin driver: added test for error code for NOT NULL violation. This closes #2681.
Date Wed, 20 Sep 2017 12:48:02 GMT
IGNITE-6396: JDBC thin driver: added test for error code for NOT NULL violation. This closes
#2681.


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

Branch: refs/heads/ignite-3478
Commit: 8f3c5097b5732d10ec19a1de3d346754befa10a2
Parents: 2d848c9
Author: Sergey Kalashnikov <skalashnikov@gridgain.com>
Authored: Mon Sep 18 14:54:40 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Mon Sep 18 14:54:40 2017 +0300

----------------------------------------------------------------------
 .../jdbc/thin/JdbcThinErrorsSelfTest.java       | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8f3c5097/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinErrorsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinErrorsSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinErrorsSelfTest.java
index 706be27..7796948 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinErrorsSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinErrorsSelfTest.java
@@ -25,6 +25,7 @@ import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Statement;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.List;
@@ -464,4 +465,30 @@ public class JdbcThinErrorsSelfTest extends JdbcErrorsAbstractSelfTest
{
             }
         }, "0700B");
     }
+
+    /**
+     * Check error code for the case null value is inserted into table field declared as
NOT NULL.
+     *
+     * @throws SQLException if failed.
+     */
+    public void testNotNullViolation() throws SQLException {
+        try (Connection conn = getConnection()) {
+            try (Statement stmt = conn.createStatement()) {
+                stmt.execute("CREATE TABLE nulltest(id INT PRIMARY KEY, name CHAR NOT NULL)");
+
+                try {
+                    checkErrorState(new IgniteCallable<Void>() {
+                        @Override public Void call() throws Exception {
+                            stmt.execute("INSERT INTO nulltest(id, name) VALUES (1, NULLIF('a',
'a'))");
+
+                            return null;
+                        }
+                    }, "22004");
+                }
+                finally {
+                    stmt.execute("DROP TABLE nulltest");
+                }
+            }
+        }
+    }
 }


Mime
View raw message