runStandardTests(pstmt.getMetaData());
pstmt.close();
}
private void runStandardTests(ResultSetMetaData rsmd) throws SQLException {
PGResultSetMetaData pgrsmd = (PGResultSetMetaData)rsmd;
assertEquals(6, rsmd.getColumnCount());
assertEquals("a", rsmd.getColumnLabel(1));
assertEquals("total", rsmd.getColumnLabel(4));
assertEquals("a", rsmd.getColumnName(1));
assertEquals("oid", rsmd.getColumnName(5));
if (TestUtil.isProtocolVersion(conn, 3))
{
assertEquals("", pgrsmd.getBaseColumnName(4));
assertEquals("b", pgrsmd.getBaseColumnName(6));
}
assertEquals(Types.INTEGER, rsmd.getColumnType(1));
assertEquals(Types.VARCHAR, rsmd.getColumnType(2));
assertEquals("int4", rsmd.getColumnTypeName(1));
assertEquals("text", rsmd.getColumnTypeName(2));
assertEquals(10, rsmd.getPrecision(3));
assertEquals(2, rsmd.getScale(3));
assertEquals("", rsmd.getSchemaName(1));
assertEquals("", rsmd.getSchemaName(4));
if (TestUtil.isProtocolVersion(conn, 3))
{
assertEquals("public", pgrsmd.getBaseSchemaName(1));
assertEquals("", pgrsmd.getBaseSchemaName(4));
}
assertEquals("rsmd1", rsmd.getTableName(1));
assertEquals("", rsmd.getTableName(4));
if (TestUtil.isProtocolVersion(conn, 3))
{
assertEquals("rsmd1", pgrsmd.getBaseTableName(1));
assertEquals("", pgrsmd.getBaseTableName(4));
}
if (TestUtil.isProtocolVersion(conn, 3))
{
assertEquals(ResultSetMetaData.columnNoNulls, rsmd.isNullable(1));