use of java.sql.SQLFeatureNotSupportedException in project jdk8u_jdk by JetBrains.
the class SQLFeatureNotSupportedExceptionTests method test7.
/**
* Create SQLFeatureNotSupportedException with message, and Throwable
*/
@Test
public void test7() {
SQLFeatureNotSupportedException ex = new SQLFeatureNotSupportedException(reason, t);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
use of java.sql.SQLFeatureNotSupportedException in project jdk8u_jdk by JetBrains.
the class SQLFeatureNotSupportedExceptionTests method test13.
/**
* Create SQLFeatureNotSupportedException and validate it is an instance of
* SQLNonTransientException
*/
@Test
public void test13() {
Exception ex = new SQLFeatureNotSupportedException();
assertTrue(ex instanceof SQLNonTransientException);
}
use of java.sql.SQLFeatureNotSupportedException in project jdk8u_jdk by JetBrains.
the class SQLFeatureNotSupportedExceptionTests method test.
/**
* Create SQLFeatureNotSupportedException and setting all objects to null
*/
@Test
public void test() {
SQLFeatureNotSupportedException e = new SQLFeatureNotSupportedException(null, null, errorCode, null);
assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == errorCode);
}
use of java.sql.SQLFeatureNotSupportedException in project jdk8u_jdk by JetBrains.
the class SQLFeatureNotSupportedExceptionTests method test3.
/**
* Create SQLFeatureNotSupportedException with message, and SQLState
*/
@Test
public void test3() {
SQLFeatureNotSupportedException ex = new SQLFeatureNotSupportedException(reason, state);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLFeatureNotSupportedException in project jena by apache.
the class SelectResultsMetadata method makeColumns.
/**
* Makes column information for SELECT results
*
* @param results
* Result Set
* @param rset
* Underlying SPARQL results
* @return Column information
* @throws SQLException
* Thrown if the column information cannot be created
*/
private static ColumnInfo[] makeColumns(JenaResultSet results, ResultSetPeekable rset) throws SQLException {
List<String> vars = rset.getResultVars();
ColumnInfo[] columns = new ColumnInfo[vars.size()];
int level = JdbcCompatibility.normalizeLevel(results.getJdbcCompatibilityLevel());
boolean columnsAsStrings = JdbcCompatibility.shouldTypeColumnsAsString(level);
boolean columnsDetected = JdbcCompatibility.shouldDetectColumnTypes(level);
Binding b = null;
if (columnsDetected) {
if (rset.hasNext()) {
b = rset.peekBinding();
} else {
// If we were supposed to detect columns but there is no data
// available then we will just fallback to typing everything as
// strings
columnsAsStrings = true;
columnsDetected = false;
}
}
for (int i = 0; i < columns.length; i++) {
if (!columnsAsStrings && !columnsDetected) {
// Low compatibility, report columns as being typed as
// JAVA_OBJECT with ARQ Node as the column class
columns[i] = new SparqlColumnInfo(vars.get(i), Types.JAVA_OBJECT, columnNullable);
LOGGER.info("Low JDBC compatibility, column " + vars.get(i) + " is being typed as Node");
} else if (columnsAsStrings) {
// Medium compatibility, report columns as being typed as
// NVARCHAR with String as the column class
columns[i] = new StringColumn(vars.get(i), columnNullable);
LOGGER.info("Medium JDBC compatibility, column " + vars.get(i) + " is being typed as String");
} else if (columnsDetected) {
// High compatibility, detect columns types based on first row
// of results
columns[i] = JdbcCompatibility.detectColumnType(vars.get(i), b.get(Var.alloc(vars.get(i))), true);
LOGGER.info("High compatibility, column " + vars.get(i) + " was detected as being of type " + columns[i].getClassName());
} else {
throw new SQLFeatureNotSupportedException("Unknown JDBC compatibility level was set");
}
}
return columns;
}
Aggregations