use of java.sql.SQLWarning in project voltdb by VoltDB.
the class JDBCConnection method xlateRSType.
/**
* Translates <code>ResultSet</code> type, adding to the warning
* chain if the requested type is downgraded. <p>
*
* Up to and including HSQLDB 1.7.2, <code>TYPE_FORWARD_ONLY</code> and
* <code>TYPE_SCROLL_INSENSITIVE</code> are passed through. <p>
*
* Starting with 1.7.2, while <code>TYPE_SCROLL_SENSITIVE</code> is
* downgraded to <code>TYPE_SCROLL_INSENSITIVE</code> and an SQLWarning is
* issued. <p>
*
* @param type of <code>ResultSet</code>; one of
* <code>JDBCResultSet.TYPE_XXX</code>
* @return the actual type that will be used
* @throws SQLException if type is not one of the defined values
*/
int xlateRSType(int type) throws SQLException {
SQLWarning w;
String msg;
switch(type) {
case JDBCResultSet.TYPE_FORWARD_ONLY:
case JDBCResultSet.TYPE_SCROLL_INSENSITIVE:
{
return type;
}
case JDBCResultSet.TYPE_SCROLL_SENSITIVE:
{
msg = "TYPE_SCROLL_SENSITIVE => TYPE_SCROLL_SENSITIVE";
w = new SQLWarning(msg, "SOO10", ErrorCode.JDBC_INVALID_ARGUMENT);
addWarning(w);
return JDBCResultSet.TYPE_SCROLL_INSENSITIVE;
}
default:
{
msg = "ResultSet type: " + type;
throw Util.invalidArgument(msg);
}
}
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test9.
/**
* Create SQLWarning with Throwable
*/
@Test
public void test9() {
SQLWarning ex = new SQLWarning(t);
assertTrue(ex.getMessage().equals(cause) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test10.
/**
* Serialize a SQLWarning and make sure you can read it back properly
*/
@Test
public void test10() throws Exception {
SQLWarning e = new SQLWarning(reason, state, errorCode, t);
SQLWarning ex1 = createSerializedException(e);
assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test1.
/**
* Create SQLWarning with no-arg constructor
*/
@Test
public void test1() {
SQLWarning ex = new SQLWarning();
assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test8.
/**
* Create SQLWarning with null Throwable
*/
@Test
public void test8() {
SQLWarning ex = new SQLWarning((Throwable) null);
assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Aggregations