This commit is contained in:
zyyang 2021-02-06 16:32:40 +08:00
parent 8acc6df455
commit b47de8a0d1
1 changed files with 136 additions and 698 deletions

View File

@ -1,19 +1,16 @@
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.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;
@ -21,7 +18,6 @@ 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 {
@ -39,9 +35,7 @@ public class ResultSetTest {
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
return; return;
} }
} }
@Test @Test
public void testResultSet() { public void testResultSet() {
String sql; String sql;
@ -54,17 +48,14 @@ public class ResultSetTest {
short v6 = 12; short v6 = 12;
boolean v7 = false; boolean v7 = false;
String v8 = "TDengine is powerful"; String v8 = "TDengine is powerful";
sql = "insert into " + dbName + "." + tName + " values (" + ts + "," + v1 + "," + v2 + "," + v3 + "," + v4 sql = "insert into " + dbName + "." + tName + " values (" + ts + "," + v1 + "," + v2 + "," + v3 + "," + v4
+ ",\"" + v5 + "\"," + v6 + "," + v7 + ",\"" + v8 + "\")"; + ",\"" + v5 + "\"," + v6 + "," + v7 + ",\"" + v8 + "\")";
try { try {
statement.executeUpdate(sql); statement.executeUpdate(sql);
assertEquals(1, statement.getUpdateCount()); assertEquals(1, statement.getUpdateCount());
} catch (SQLException e) { } catch (SQLException e) {
assert false : "insert error " + e.getMessage(); assert false : "insert error " + e.getMessage();
} }
try { try {
statement.execute("select * from " + dbName + "." + tName + " where ts = " + ts); statement.execute("select * from " + dbName + "." + tName + " where ts = " + ts);
resSet = statement.getResultSet(); resSet = statement.getResultSet();
@ -72,33 +63,23 @@ public class ResultSetTest {
while (resSet.next()) { while (resSet.next()) {
assertEquals(ts, resSet.getLong(1)); assertEquals(ts, resSet.getLong(1));
assertEquals(ts, resSet.getLong("ts")); assertEquals(ts, resSet.getLong("ts"));
System.out.println(resSet.getTimestamp(1)); System.out.println(resSet.getTimestamp(1));
assertEquals(v1, resSet.getInt(2)); assertEquals(v1, resSet.getInt(2));
assertEquals(v1, resSet.getInt("k1")); assertEquals(v1, resSet.getInt("k1"));
assertEquals(v2, resSet.getLong(3)); assertEquals(v2, resSet.getLong(3));
assertEquals(v2, resSet.getLong("k2")); assertEquals(v2, resSet.getLong("k2"));
assertEquals(v3, resSet.getFloat(4), 7); assertEquals(v3, resSet.getFloat(4), 7);
assertEquals(v3, resSet.getFloat("k3"), 7); assertEquals(v3, resSet.getFloat("k3"), 7);
assertEquals(v4, resSet.getDouble(5), 13); assertEquals(v4, resSet.getDouble(5), 13);
assertEquals(v4, resSet.getDouble("k4"), 13); assertEquals(v4, resSet.getDouble("k4"), 13);
assertEquals(v5, resSet.getString(6)); assertEquals(v5, resSet.getString(6));
assertEquals(v5, resSet.getString("k5")); assertEquals(v5, resSet.getString("k5"));
assertEquals(v6, resSet.getShort(7)); assertEquals(v6, resSet.getShort(7));
assertEquals(v6, resSet.getShort("k6")); assertEquals(v6, resSet.getShort("k6"));
assertEquals(v7, resSet.getBoolean(8)); assertEquals(v7, resSet.getBoolean(8));
assertEquals(v7, resSet.getBoolean("k7")); assertEquals(v7, resSet.getBoolean("k7"));
assertEquals(v8, resSet.getString(9)); assertEquals(v8, resSet.getString(9));
assertEquals(v8, resSet.getString("k8")); assertEquals(v8, resSet.getString("k8"));
resSet.getBytes(9); resSet.getBytes(9);
resSet.getObject(6); resSet.getObject(6);
resSet.getObject("k8"); resSet.getObject("k8");
@ -110,688 +91,147 @@ public class ResultSetTest {
assert false : "insert error " + e.getMessage(); assert false : "insert error " + e.getMessage();
} }
} }
@Test @Test
public void testUnsupport() throws SQLException { 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));
try { resSet.getAsciiStream(0);
resSet.getAsciiStream(0); resSet.getUnicodeStream(null);
} catch (SQLException e) { resSet.getBinaryStream(null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getAsciiStream("");
} resSet.getUnicodeStream(null);
try { resSet.getBinaryStream(null);
resSet.getUnicodeStream(null); resSet.getWarnings();
} catch (SQLException e) { resSet.clearWarnings();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getCursorName();
} resSet.getCharacterStream(null);
try { resSet.getCharacterStream(null);
resSet.getBinaryStream(null); resSet.isBeforeFirst();
} catch (SQLException e) { resSet.isAfterLast();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.isFirst();
} resSet.isLast();
try { resSet.beforeFirst();
resSet.getAsciiStream(""); resSet.afterLast();
} catch (SQLException e) { resSet.first();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.last();
} resSet.getRow();
try { resSet.absolute(1);
resSet.getUnicodeStream(null); resSet.relative(1);
} catch (SQLException e) { resSet.previous();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.setFetchDirection(0);
} resSet.getFetchDirection();
try { resSet.setFetchSize(0);
resSet.getBinaryStream(null); resSet.getFetchSize();
} catch (SQLException e) { resSet.getConcurrency();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.rowUpdated();
} resSet.rowInserted();
try { resSet.rowDeleted();
resSet.getWarnings(); resSet.updateNull(null);
} catch (SQLException e) { resSet.updateBoolean(0, true);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateByte(0, (byte) 2);
} resSet.updateShort(0, (short) 1);
try { resSet.updateInt(0, 0);
resSet.clearWarnings(); resSet.updateLong(0, 0l);
} catch (SQLException e) { resSet.updateFloat(0, 3.14f);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateDouble(0, 3.1415);
} resSet.updateBigDecimal(null, null);
try { resSet.updateString(null, null);
resSet.getCursorName(); resSet.updateBytes(null, null);
} catch (SQLException e) { resSet.updateDate(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateTime(null, null);
} resSet.updateTimestamp(null, null);
try { resSet.updateAsciiStream(null, null);
resSet.getCharacterStream(null); resSet.updateBinaryStream(null, null);
} catch (SQLException e) { resSet.updateCharacterStream(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateObject(null, null);
} resSet.updateObject(null, null);
try { resSet.updateNull(null);
resSet.getCharacterStream(null); resSet.updateBoolean("", false);
} catch (SQLException e) { resSet.updateByte("", (byte) 1);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateShort("", (short) 1);
} resSet.updateInt("", 0);
try { resSet.updateLong("", 0l);
resSet.isBeforeFirst(); resSet.updateFloat("", 3.14f);
} catch (SQLException e) { resSet.updateDouble("", 3.1415);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateBigDecimal(null, null);
} resSet.updateString(null, null);
try { resSet.updateBytes(null, null);
resSet.isAfterLast(); resSet.updateDate(null, null);
} catch (SQLException e) { resSet.updateTime(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateTimestamp(null, null);
} resSet.updateAsciiStream(null, null);
try { resSet.updateBinaryStream(null, null);
resSet.isFirst(); resSet.updateCharacterStream(null, null);
} catch (SQLException e) { resSet.updateObject(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateObject(null, null);
} resSet.insertRow();
try { resSet.updateRow();
resSet.isLast(); resSet.deleteRow();
} catch (SQLException e) { resSet.refreshRow();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.cancelRowUpdates();
} resSet.moveToInsertRow();
try { resSet.moveToCurrentRow();
resSet.beforeFirst(); resSet.getStatement();
} catch (SQLException e) { resSet.getObject(0, new HashMap<>());
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getRef(null);
} resSet.getBlob(null);
try { resSet.getClob(null);
resSet.afterLast(); resSet.getArray(null);
} catch (SQLException e) { resSet.getObject("", new HashMap<>());
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getRef(null);
} resSet.getBlob(null);
try { resSet.getClob(null);
resSet.first(); resSet.getArray(null);
} catch (SQLException e) { resSet.getDate(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getDate(null, null);
} resSet.getTime(null, null);
try { resSet.getTime(null, null);
resSet.last(); resSet.getTimestamp(null, null);
} catch (SQLException e) { resSet.getTimestamp(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getURL(null);
} resSet.getURL(null);
try { resSet.updateRef(null, null);
resSet.getRow(); resSet.updateRef(null, null);
} catch (SQLException e) { resSet.updateBlob(0, new SerialBlob("".getBytes("UTF8")));
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateBlob("", new SerialBlob("".getBytes("UTF8")));
} resSet.updateClob("", new SerialClob("".toCharArray()));
try { resSet.updateClob(0, new SerialClob("".toCharArray()));
resSet.absolute(1); resSet.updateArray(null, null);
} catch (SQLException e) { resSet.updateArray(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getRowId(null);
} resSet.getRowId(null);
try { resSet.updateRowId(null, null);
resSet.relative(1); resSet.updateRowId(null, null);
} catch (SQLException e) { resSet.getHoldability();
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateNString(null, null);
} resSet.updateNString(null, null);
try { resSet.getNClob(null);
resSet.previous(); resSet.getNClob(null);
} catch (SQLException e) { resSet.getSQLXML(null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.getSQLXML(null);
} resSet.updateSQLXML(null, null);
try { resSet.updateSQLXML(null, null);
resSet.setFetchDirection(0); resSet.getNCharacterStream(null);
} catch (SQLException e) { resSet.getNCharacterStream(null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateNCharacterStream(null, null);
} resSet.updateNCharacterStream(null, null);
try { resSet.updateAsciiStream(null, null);
resSet.getFetchDirection(); resSet.updateBinaryStream(null, null);
} catch (SQLException e) { resSet.updateCharacterStream(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateAsciiStream(null, null);
} resSet.updateBinaryStream(null, null);
try { resSet.updateCharacterStream(null, null);
resSet.setFetchSize(0); resSet.updateNCharacterStream(null, null);
} catch (SQLException e) { resSet.updateNCharacterStream(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateAsciiStream(null, null);
} resSet.updateBinaryStream(null, null);
try { resSet.updateCharacterStream(null, null);
resSet.getFetchSize(); resSet.updateAsciiStream(null, null);
} catch (SQLException e) { resSet.updateBinaryStream(null, null);
assertTrue(e.getMessage().contains("this operation is NOT supported currently!")); resSet.updateCharacterStream(null, null);
}
try {
resSet.getConcurrency();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.rowUpdated();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.rowInserted();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.rowDeleted();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNull(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBoolean(0, true);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateByte(0, (byte) 2);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateShort(0, (short) 1);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateInt(0, 0);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateLong(0, 0l);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateFloat(0, 3.14f);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateDouble(0, 3.1415);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBigDecimal(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateString(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBytes(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateDate(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateTime(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateTimestamp(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateAsciiStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBinaryStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateObject(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateObject(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNull(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBoolean("", false);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateByte("", (byte) 1);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateShort("", (short) 1);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateInt("", 0);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateLong("", 0l);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateFloat("", 3.14f);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateDouble("", 3.1415);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBigDecimal(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateString(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBytes(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateDate(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateTime(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateTimestamp(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateAsciiStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBinaryStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateObject(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateObject(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.insertRow();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateRow();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.deleteRow();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.refreshRow();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.cancelRowUpdates();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.moveToInsertRow();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.moveToCurrentRow();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getStatement();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getObject(0, new HashMap<>());
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getRef(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getBlob(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getClob(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getArray(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getObject("", new HashMap<>());
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getRef(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getBlob(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getClob(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getArray(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getDate(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getDate(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getTime(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getTime(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getTimestamp(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getTimestamp(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getURL(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getURL(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateRef(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateRef(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBlob(0, new SerialBlob("".getBytes("UTF8")));
} catch (Exception e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBlob("", new SerialBlob("".getBytes("UTF8")));
} catch (Exception e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateClob("", new SerialClob("".toCharArray()));
} catch (Exception e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateClob(0, new SerialClob("".toCharArray()));
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateArray(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateArray(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getRowId(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getRowId(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateRowId(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateRowId(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getHoldability();
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNString(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNString(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getNClob(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getNClob(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getSQLXML(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getSQLXML(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateSQLXML(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateSQLXML(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getNCharacterStream(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.getNCharacterStream(null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateAsciiStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBinaryStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateAsciiStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBinaryStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateNCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateAsciiStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBinaryStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateAsciiStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateBinaryStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
try {
resSet.updateCharacterStream(null, null);
} catch (SQLException e) {
assertTrue(e.getMessage().contains("this operation is NOT supported currently!"));
}
} }
@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," +
@ -804,7 +244,6 @@ 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 {
@ -817,5 +256,4 @@ public class ResultSetTest {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }