Java Code Examples for java.sql.DatabaseMetaData#getSuperTypes()
The following examples show how to use
java.sql.DatabaseMetaData#getSuperTypes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaDataRegressionTest.java From r-course with MIT License | 5 votes |
public void testBug44508() throws Exception { DatabaseMetaData dbmd = this.conn.getMetaData(); this.rs = dbmd.getSuperTypes("", "", ""); ResultSetMetaData rsmd = this.rs.getMetaData(); assertEquals("TYPE_CAT", rsmd.getColumnName(1)); // Gives TABLE_CAT assertEquals("TYPE_SCHEM", rsmd.getColumnName(2)); // Gives TABLE_SCHEM }
Example 2
Source File: MetaResultSetTest.java From calcite-avatica with Apache License 2.0 | 5 votes |
@Test public void testGetSuperTypes() throws SQLException { DatabaseMetaData metadata = getDatabaseMetadata(); try (ResultSet rs = metadata.getSuperTypes(null, null, null)) { ResultSetMetaData rsMeta = rs.getMetaData(); assertEquals(6, rsMeta.getColumnCount()); assertColumn(rsMeta, 1, "TYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable); assertColumn(rsMeta, 2, "TYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable); assertColumn(rsMeta, 3, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls); assertColumn(rsMeta, 4, "SUPERTYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable); assertColumn(rsMeta, 5, "SUPERTYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable); assertColumn(rsMeta, 6, "SUPERTYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls); } }
Example 3
Source File: MetaDataRegressionTest.java From Komondor with GNU General Public License v3.0 | 5 votes |
public void testBug44508() throws Exception { DatabaseMetaData dbmd = this.conn.getMetaData(); this.rs = dbmd.getSuperTypes("", "", ""); ResultSetMetaData rsmd = this.rs.getMetaData(); assertEquals("TYPE_CAT", rsmd.getColumnName(1)); // Gives TABLE_CAT assertEquals("TYPE_SCHEM", rsmd.getColumnName(2)); // Gives TABLE_SCHEM }
Example 4
Source File: DatabaseMetaDataJDBC3Test.java From jTDS with GNU Lesser General Public License v2.1 | 5 votes |
/** * Test meta data functions that return result sets. */ public void testResultSets() throws Exception { DatabaseMetaData dbmd = con.getMetaData(); ResultSet rs; // // JDBC3 Methods // rs = dbmd.getAttributes(null, null, null, null); assertTrue(checkColumnNames(rs, new String[]{"TYPE_CAT", "TYPE_SCHEM","TYPE_NAME","ATTR_NAME", "DATA_TYPE","ATTR_TYPE_NAME","ATTR_SIZE","DECIMAL_DIGITS","NUM_PREC_RADIX","NULLABLE", "REMARKS","ATTR_DEF","SQL_DATA_TYPE","SQL_DATETIME_SUB","CHAR_OCTET_LENGTH", "ORDINAL_POSITION","IS_NULLABLE","SCOPE_CATALOG","SCOPE_SCHEMA","SCOPE_TABLE","SOURCE_DATA_TYPE"})); assertFalse(rs.next()); rs.close(); // rs = dbmd.getSuperTables(null, null, "%"); assertTrue(checkColumnNames(rs, new String[]{"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME","SUPERTABLE_NAME"})); assertFalse(rs.next()); rs.close(); // rs = dbmd.getSuperTypes(null, null, "%"); assertTrue(checkColumnNames(rs, new String[]{"TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "SUPERTYPE_CAT", "SUPERTYPE_SCHEM", "SUPERTYPE_NAME"})); assertFalse(rs.next()); rs.close(); }
Example 5
Source File: DatabaseMetaDataTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Test methods that describe attributes of SQL Objects * that are not supported by derby. In each case the * metadata should return an empty ResultSet of the * correct shape, and with correct names, datatypes and * nullability for the columns in the ResultSet. * */ public void testUnimplementedSQLObjectAttributes() throws SQLException { DatabaseMetaData dmd = getDMD(); ResultSet rs; rs = dmd.getAttributes(null,null,null,null); String [] columnNames = { "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "ATTR_NAME", "DATA_TYPE", "ATTR_TYPE_NAME", "ATTR_SIZE", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "ATTR_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE" }; int [] columnTypes = { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.SMALLINT }; // DERBY-3171; we get a different value back for nullability for // a number of the columns with networkserver/client vs. embedded boolean nullval = true; if (usingDerbyNetClient()) nullval = false; boolean [] nullability = { true, true, false, nullval, nullval, nullval, nullval, nullval, nullval, nullval, true, true, nullval, nullval, nullval, nullval, nullval, true, true, true, true }; assertMetaDataResultSet(rs, columnNames, columnTypes, nullability); JDBC.assertEmpty(rs); rs = dmd.getCatalogs(); checkCatalogsShape(rs); JDBC.assertEmpty(rs); rs = dmd.getSuperTables(null,null,null); columnNames = new String[] { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "SUPERTABLE_NAME"}; columnTypes = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; nullability = new boolean[] { true, true, false, false}; assertMetaDataResultSet(rs, columnNames, columnTypes, nullability); JDBC.assertEmpty(rs); rs = dmd.getSuperTypes(null,null,null); columnNames = new String[] { "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "SUPERTYPE_CAT", "SUPERTYPE_SCHEM", "SUPERTYPE_NAME"}; columnTypes = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; nullability = new boolean[] { true, true, false, true, true, false}; assertMetaDataResultSet(rs, columnNames, columnTypes, nullability); JDBC.assertEmpty(rs); ResultSet rss[] = getVersionColumns(null,null, "No_such_table"); checkVersionColumnsShape(rss); JDBC.assertEmpty(rss[0]); JDBC.assertEmpty(rss[1]); rs.close(); rss[0].close(); rss[1].close(); }
Example 6
Source File: DatabaseMetaDataTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Test methods that describe attributes of SQL Objects * that are not supported by derby. In each case the * metadata should return an empty ResultSet of the * correct shape, and with correct names, datatypes and * nullability for the columns in the ResultSet. * */ public void testUnimplementedSQLObjectAttributes() throws SQLException { DatabaseMetaData dmd = getDMD(); ResultSet rs; rs = dmd.getAttributes(null,null,null,null); String [] columnNames = { "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "ATTR_NAME", "DATA_TYPE", "ATTR_TYPE_NAME", "ATTR_SIZE", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "ATTR_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE" }; int [] columnTypes = { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.SMALLINT }; // DERBY-3171; we get a different value back for nullability for // a number of the columns with networkserver/client vs. embedded boolean nullval = true; if (usingDerbyNetClient()) nullval = false; boolean [] nullability = { true, true, false, nullval, nullval, nullval, nullval, nullval, nullval, nullval, true, true, nullval, nullval, nullval, nullval, nullval, true, true, true, true }; assertMetaDataResultSet(rs, columnNames, columnTypes, nullability); JDBC.assertEmpty(rs); rs = dmd.getCatalogs(); checkCatalogsShape(rs); JDBC.assertEmpty(rs); rs = dmd.getSuperTables(null,null,null); columnNames = new String[] { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "SUPERTABLE_NAME"}; columnTypes = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; nullability = new boolean[] { true, true, false, false}; assertMetaDataResultSet(rs, columnNames, columnTypes, nullability); JDBC.assertEmpty(rs); rs = dmd.getSuperTypes(null,null,null); columnNames = new String[] { "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "SUPERTYPE_CAT", "SUPERTYPE_SCHEM", "SUPERTYPE_NAME"}; columnTypes = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; nullability = new boolean[] { true, true, false, true, true, false}; assertMetaDataResultSet(rs, columnNames, columnTypes, nullability); JDBC.assertEmpty(rs); ResultSet rss[] = getVersionColumns(null,null, "No_such_table"); checkVersionColumnsShape(rss); JDBC.assertEmpty(rss[0]); JDBC.assertEmpty(rss[1]); rs.close(); rss[0].close(); rss[1].close(); }