Examples of PostgresqlTypeInfo


Examples of org.datanucleus.store.rdbms.schema.PostgresqlTypeInfo

    {
        super.initialiseTypes(handler, mconn);

        // Add on any missing JDBC types
        // If PostgreSQL JDBC driver doesn't provide info for CHAR type we fake it as "char" (e.g PSQL 8.1.405)
        SQLTypeInfo sqlType = new PostgresqlTypeInfo(
            "char", (short)Types.CHAR, 65000, null, null, null, 0, false, (short)3,
            false, false, false, "char", (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.CHAR, sqlType, true);

        sqlType = new PostgresqlTypeInfo(
            "text", (short)Types.CLOB, 9, null, null, null, 0, false, (short)3,
            false, false, false, null, (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.CLOB, sqlType, true);

        sqlType = new PostgresqlTypeInfo(
            "BYTEA", (short)Types.BLOB, 9, null, null, null, 0, false, (short)3,
            false, false, false, null, (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.BLOB, sqlType, true);
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.schema.PostgresqlTypeInfo

        return "postgresql";
    }

    public SQLTypeInfo newSQLTypeInfo(ResultSet rs)
    {
        SQLTypeInfo info = new PostgresqlTypeInfo(rs);

        // Since PostgreSQL supports many user defined data types and uses many type aliases the
        // default methods have trouble finding the right associations between JDBC and PostgreSQL
        // data types.  We filter the returned type info to be sure we use the appropriate base
        // PostgreSQL types for the important JDBC types.*/
        if (psqlTypes == null)
        {
            psqlTypes = new Hashtable();
            psqlTypes.put("" + Types.BIT, "bool");
            psqlTypes.put("" + Types.TIMESTAMP, "timestamptz");
            psqlTypes.put("" + Types.BIGINT, "int8");
            psqlTypes.put("" + Types.CHAR, "char");
            psqlTypes.put("" + Types.DATE, "date");
            psqlTypes.put("" + Types.DOUBLE, "float8");
            psqlTypes.put("" + Types.INTEGER, "int4");
            psqlTypes.put("" + Types.LONGVARCHAR, "text");
            psqlTypes.put("" + Types.CLOB, "text");
            psqlTypes.put("" + Types.BLOB, "bytea");
            psqlTypes.put("" + Types.NUMERIC, "numeric");
            psqlTypes.put("" + Types.REAL, "float4");
            psqlTypes.put("" + Types.SMALLINT, "int2");
            psqlTypes.put("" + Types.TIME, "time");
            psqlTypes.put("" + Types.VARCHAR, "varchar");
            psqlTypes.put("" + Types.OTHER, "***TOTALRUBBISH***");

            // PostgreSQL provides 2 types for "char" mappings - "char" and "bpchar". PostgreSQL recommend
            // bpchar for default usage, but sadly you cannot say "bpchar(200)" in an SQL statement. Due to
            // this we use "char" since you can say "char(100)" (and internally in PostgreSQL it becomes bpchar)
            // PostgreSQL 8.1 JDBC driver somehow puts "char" as Types.OTHER rather than Types.CHAR ! so this is
            // faked in createTypeInfo() above.

            // PostgreSQL (7.3, 7.4) doesn't provide a SQL type to map to JDBC types FLOAT, DECIMAL, BLOB, BOOLEAN
        }
        Object obj = psqlTypes.get("" + info.getDataType());
        if (obj != null)
        {
            String  psql_type_name = (String)obj;
            if (!info.getTypeName().equalsIgnoreCase(psql_type_name))
            {
                // We don't support this JDBC type using *this* PostgreSQL SQL type
                NucleusLogger.DATASTORE.debug(LOCALISER.msg("051007", info.getTypeName(),
                    JDBCUtils.getNameForJDBCType(info.getDataType())));
                return null;
            }
        }
        return info;
    }
View Full Code Here

Examples of org.jpox.store.rdbms.typeinfo.PostgreSQLTypeInfo

       
        reservedKeywords.addAll(parseKeywordList(POSTGRESQL_RESERVED_WORDS));

        // Add on any missing JDBC types
        // If the PostgreSQL JDBC driver does not provide info for the CHAR type we fake it as "char" (e.g PSQL 8.1.405)
        TypeInfo ti = new PostgreSQLTypeInfo("char",
            (short)Types.CHAR,
            65000,
            null,
            null,
            null,
            0,
            false,
            (short)3,
            false,
            false,
            false,
            "char",
            (short)0,
            (short)0,
            10);
        addTypeInfo((short)Types.CHAR, ti, true);

        ti = new PostgreSQLTypeInfo("text",
            (short)Types.CLOB,
            9,
            null,
            null,
            null,
            0,
            false,
            (short)3,
            false,
            false,
            false,
            null,
            (short)0,
            (short)0,
            10);
        addTypeInfo((short)Types.CLOB, ti, true);

        ti = new PostgreSQLTypeInfo("BYTEA",
            (short)Types.BLOB,
            9,
            null,
            null,
            null,
View Full Code Here

Examples of org.jpox.store.rdbms.typeinfo.PostgreSQLTypeInfo

        return "postgresql";
    }

    public TypeInfo newTypeInfo(ResultSet rs)
    {
        TypeInfo ti = new PostgreSQLTypeInfo(rs);

        /*
         * Since PostgreSQL supports many user defined data types and uses
         * many type aliases the default methods have trouble finding the
         * right associations between JDBC and PostgreSQL data types.  We
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.