Package org.postgresql

Examples of org.postgresql.PGResultSetMetaData


  /** Retrieves database-specific table name used in SQL statements. */
  @Override
  protected String getQualifiedTableName(final SqlResourceDefinition definition,
      final ResultSetMetaData resultSetMetaData, final int colNumber) throws SQLException {
    final PGResultSetMetaData pgMetaData = (PGResultSetMetaData) resultSetMetaData;
    return SqlResourceDefinitionUtils.getDefaultDatabase(definition) + "."
        + pgMetaData.getBaseSchemaName(colNumber) + "." + pgMetaData.getBaseTableName(colNumber);
  }
View Full Code Here


        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("", 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));
View Full Code Here

        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("", 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));
View Full Code Here

            return ;

        StringBuffer selectSQL = new StringBuffer( "select ");

        ResultSetMetaData rsmd = getMetaData();
        PGResultSetMetaData pgmd = (PGResultSetMetaData)rsmd;
        for (int i=1; i <= rsmd.getColumnCount(); i++) {
            if (i > 1) {
                selectSQL.append(", ");
            }
            selectSQL.append( pgmd.getBaseColumnName(i) );
        }
        selectSQL.append(" from " ).append(onlyTable).append(tableName).append(" where ");

        int numKeys = primaryKeys.size();
View Full Code Here

        doingUpdates = !onInsertRow;
        if (value == null) {
            updateNull(columnIndex);
        } else {
            PGResultSetMetaData md = (PGResultSetMetaData)getMetaData();
            updateValues.put(md.getBaseColumnName(columnIndex), value);
        }
    }
View Full Code Here

        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));
View Full Code Here

TOP

Related Classes of org.postgresql.PGResultSetMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.