use of java.sql.SQLFeatureNotSupportedException in project robovm by robovm.
the class OldStatementTest method testExecuteUpdate_String_StringArray.
// TODO executeUpdate(String sql, String[] columnNames) is not supported
public void testExecuteUpdate_String_StringArray() throws SQLException {
Statement st = null;
try {
String[] queries = { "update zoo set name='Masha', family='cat' where id=2;", "drop table if exists hutch", "create table hutch (id integer not null, animal_id integer, address char(20), primary key (id));", "insert into hutch (id, animal_id, address) values (1, 2, 'Birds-house, 1');", "insert into hutch (id, animal_id, address) values (2, 1, 'Horse-house, 5');", "create view address as select address from hutch where animal_id=2", "drop view address;", "drop table hutch;" };
Vector<String[]> array = new Vector<String[]>();
array.addElement(null);
array.addElement(new String[] { "", "", "", "", "", "", "", "" });
array.addElement(new String[] { "field 1", "", "field2" });
array.addElement(new String[] { "id", "family", "name" });
array.addElement(new String[] { "id", null, "family", null, "name" });
array.addElement(new String[] { "id", " ", "name" });
array.addElement(new String[] { null, null, null, null });
array.addElement(new String[] { " ", "123 21", "~!@#$%^&*()_+ ", null });
st = conn.createStatement();
for (int i = 0; i < queries.length; i++) {
st.executeUpdate(queries[i], (String[]) array.elementAt(i));
fail("Revise test implemenation for feature impl. has changed");
}
} catch (SQLFeatureNotSupportedException e) {
// expected
} finally {
try {
st.close();
} catch (SQLException ee) {
}
}
}
use of java.sql.SQLFeatureNotSupportedException in project robovm by robovm.
the class OldStatementTest method testSetCursorName.
// TODO setCursorName() is not supported
public void testSetCursorName() throws SQLException {
Statement st = null;
try {
String select = "select * from zoo";
st = conn.createStatement();
st.setCursorName("test");
fail("Fail: statement does not fail");
} catch (SQLFeatureNotSupportedException e) {
// expected
}
}
use of java.sql.SQLFeatureNotSupportedException in project robovm by robovm.
the class OldStatementTest method testGeneratedKeys.
public void testGeneratedKeys() throws SQLException {
Statement st = null;
try {
String insert = "insert into zoo (id, name, family) values (8, 'Tuzik', 'dog');";
st = conn.createStatement();
assertNull(st.getGeneratedKeys());
fail("Fail: statement does not fail");
} catch (SQLFeatureNotSupportedException e) {
// expected
}
}
use of java.sql.SQLFeatureNotSupportedException in project jdk8u_jdk by JetBrains.
the class SQLFeatureNotSupportedExceptionTests method test5.
/**
* Create SQLFeatureNotSupportedException with message, SQLState, errorCode, and Throwable
*/
@Test
public void test5() {
SQLFeatureNotSupportedException ex = new SQLFeatureNotSupportedException(reason, state, errorCode, t);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == errorCode);
}
use of java.sql.SQLFeatureNotSupportedException in project jdk8u_jdk by JetBrains.
the class SQLFeatureNotSupportedExceptionTests method test9.
/**
* Create SQLFeatureNotSupportedException with Throwable
*/
@Test
public void test9() {
SQLFeatureNotSupportedException ex = new SQLFeatureNotSupportedException(t);
assertTrue(ex.getMessage().equals(cause) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
Aggregations