提交 d0b002ea 编写于 作者: Z zyyang

change

上级 b47de8a0
package com.taosdata.jdbc; package com.taosdata.jdbc;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import javax.sql.rowset.serial.SerialBlob; import javax.sql.rowset.serial.SerialBlob;
import javax.sql.rowset.serial.SerialClob; import javax.sql.rowset.serial.SerialClob;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.sql.*; import java.sql.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Properties; import java.util.Properties;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
public class ResultSetTest { public class ResultSetTest {
static Connection connection; static Connection connection;
static Statement statement; static Statement statement;
...@@ -18,6 +22,7 @@ public class ResultSetTest { ...@@ -18,6 +22,7 @@ public class ResultSetTest {
static String tName = "t0"; static String tName = "t0";
static String host = "localhost"; static String host = "localhost";
static ResultSet resSet; static ResultSet resSet;
@BeforeClass @BeforeClass
public static void createDatabaseAndTable() { public static void createDatabaseAndTable() {
try { try {
...@@ -36,6 +41,7 @@ public class ResultSetTest { ...@@ -36,6 +41,7 @@ public class ResultSetTest {
return; return;
} }
} }
@Test @Test
public void testResultSet() { public void testResultSet() {
String sql; String sql;
...@@ -91,13 +97,13 @@ public class ResultSetTest { ...@@ -91,13 +97,13 @@ public class ResultSetTest {
assert false : "insert error " + e.getMessage(); assert false : "insert error " + e.getMessage();
} }
} }
@Test
@Test(expected = SQLFeatureNotSupportedException.class)
public void testUnsupport() throws SQLException, UnsupportedEncodingException { public void testUnsupport() throws SQLException, UnsupportedEncodingException {
statement.execute("show databases"); statement.execute("show databases");
resSet = statement.getResultSet(); resSet = statement.getResultSet();
Assert.assertNotNull(resSet.unwrap(TSDBResultSet.class)); Assert.assertNotNull(resSet.unwrap(TSDBResultSet.class));
Assert.assertTrue(resSet.isWrapperFor(TSDBResultSet.class)); Assert.assertTrue(resSet.isWrapperFor(TSDBResultSet.class));
resSet.getAsciiStream(0);
resSet.getUnicodeStream(null); resSet.getUnicodeStream(null);
resSet.getBinaryStream(null); resSet.getBinaryStream(null);
resSet.getAsciiStream(""); resSet.getAsciiStream("");
...@@ -232,6 +238,7 @@ public class ResultSetTest { ...@@ -232,6 +238,7 @@ public class ResultSetTest {
resSet.updateBinaryStream(null, null); resSet.updateBinaryStream(null, null);
resSet.updateCharacterStream(null, null); resSet.updateCharacterStream(null, null);
} }
@Test @Test
public void testBatch() throws SQLException { public void testBatch() throws SQLException {
String[] sqls = new String[]{"insert into test.t0 values (1496732686001,2147483600,1496732687000,3.1415925,3.1415926535897," + String[] sqls = new String[]{"insert into test.t0 values (1496732686001,2147483600,1496732687000,3.1415925,3.1415926535897," +
...@@ -244,6 +251,7 @@ public class ResultSetTest { ...@@ -244,6 +251,7 @@ public class ResultSetTest {
assertEquals(res.length, 2); assertEquals(res.length, 2);
statement.clearBatch(); statement.clearBatch();
} }
@AfterClass @AfterClass
public static void close() { public static void close() {
try { try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册