Examples of SQLTypeInfo


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

                    colmd.setLength(storeMgr.getIntProperty("datanucleus.rdbms.stringDefaultLength"));
                }
                IdentifierFactory idFactory = getStoreManager().getIdentifierFactory();
                DatastoreIdentifier colIdentifier = idFactory.newIdentifier(IdentifierType.COLUMN, colmd.getName());
                Column col = (Column)addDatastoreField(null, colIdentifier, null, colmd);
                SQLTypeInfo sqlTypeInfo = storeMgr.getSQLTypeInfoForJDBCType(
                    JDBCUtils.getJDBCTypeForName(colmd.getJdbcType()));
                col.setTypeInfo(sqlTypeInfo);

                if (unmappedColumns == null)
                {
View Full Code Here

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

    public void initialiseTypes(StoreSchemaHandler handler, ManagedConnection mconn)
    {
        super.initialiseTypes(handler, mconn);

        // Add on any missing JDBC types
        SQLTypeInfo sqlType = new org.datanucleus.store.rdbms.schema.MySQLTypeInfo(
            "MEDIUMBLOB", (short)Types.BLOB, 2147483647, null, null, null, 1, false, (short)1,
            false, false, false, "MEDIUMBLOB", (short)0, (short)0, 0);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.BLOB, sqlType, true);

        sqlType = new org.datanucleus.store.rdbms.schema.MySQLTypeInfo(
View Full Code Here

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

        return info;
    }

    public SQLTypeInfo newSQLTypeInfo(ResultSet rs)
    {
        SQLTypeInfo info = new org.datanucleus.store.rdbms.schema.MySQLTypeInfo(rs);

        // The following block originated in TJDO, and was carried across up to DataNucleus 3.0-m4
        // It is now commented out so people can use BINARY/VARBINARY. What is it trying to achieve?
/*        // Exclude BINARY and VARBINARY since these equate to CHAR(M) BINARY
        // and VARCHAR(M) BINARY respectively, which aren't true binary
View Full Code Here

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

    {
        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(
View Full Code Here

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

        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.datanucleus.store.rdbms.schema.SQLTypeInfo

    public void initialiseTypes(StoreSchemaHandler handler, ManagedConnection mconn)
    {
        super.initialiseTypes(handler, mconn);

        // Add on any missing JDBC types
        SQLTypeInfo sqlType = new org.datanucleus.store.rdbms.schema.OracleTypeInfo(
            "CLOB", (short)Types.CLOB, 1073741823, "'", "'", null, 1, true, (short)0,
            false, false, false, "CLOB", (short)0, (short)0, 10);
        sqlType.setAllowsPrecisionSpec(false); // Can't add precision on a CLOB
        addSQLTypeForJDBCType(handler, mconn, (short)Types.CLOB, sqlType, true);

        sqlType = new org.datanucleus.store.rdbms.schema.OracleTypeInfo(
            "DATE", (short)Types.DATE, 7, null, null, null, 1, false, (short)3,
            false, false, false, "DATE", (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.DATE, sqlType, true);

        sqlType = new org.datanucleus.store.rdbms.schema.OracleTypeInfo(
            "DECIMAL", (short)Types.DECIMAL, 38, null, null, null, 1, false, (short)3,
            false, true, false, "NUMBER", (short)-84, (short)127, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.DECIMAL, sqlType, true);

        // Oracle has a synonym "DOUBLE PRECISION" (can't specify precision/scale) mapping to sql type of "FLOAT"
        sqlType = new org.datanucleus.store.rdbms.schema.OracleTypeInfo(
            "DOUBLE PRECISION", (short)Types.DOUBLE, 38, null, null, null, 1, false, (short)3,
            false, true, false, "NUMBER", (short)-84, (short)127, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.DOUBLE, sqlType, true);

        sqlType = new org.datanucleus.store.rdbms.schema.OracleTypeInfo(
            "SDO_GEOMETRY", (short)Types.STRUCT, 0, null, null, null, 1, false, (short)0,
            false, false, false, "SDO_GEOMETRY", (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)OracleTypeInfo.TYPES_SDO_GEOMETRY, sqlType, true);

        sqlType = new org.datanucleus.store.rdbms.schema.OracleTypeInfo(
            OracleTypeInfo.TYPES_NAME_SYS_XMLTYPE, (short)OracleTypeInfo.TYPES_SYS_XMLTYPE,
            1073741823, "'", "'", null, 1, true, (short)0,
            false, false, false, OracleTypeInfo.TYPES_NAME_SYS_XMLTYPE, (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)OracleTypeInfo.TYPES_SYS_XMLTYPE, sqlType, true);

        // Update any types that need extra info relative to the JDBC info
        Collection<SQLTypeInfo> sqlTypes = getSQLTypeInfoForJdbcType(handler, mconn, (short)Types.BLOB);
        if (sqlTypes != null)
        {
            Iterator<SQLTypeInfo> iter = sqlTypes.iterator();
            while (iter.hasNext())
            {
                sqlType = iter.next();
                sqlType.setAllowsPrecisionSpec(false); // Can't add precision on a BLOB
            }
        }
        sqlTypes = getSQLTypeInfoForJdbcType(handler, mconn, (short)Types.CLOB);
        if (sqlType != null)
        {
            Iterator<SQLTypeInfo> iter = sqlTypes.iterator();
            while (iter.hasNext())
            {
                sqlType = iter.next();
                sqlType.setAllowsPrecisionSpec(false); // Can't add precision on a CLOB
            }
        }
    }
View Full Code Here

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

                    String typeStr = "JDBC Type=" + JDBCUtils.getNameForJDBCType(jdbcTypeNumber) +
                        " sqlTypes=" + StringUtils.collectionToString(sqlTypeNames);
                    ps.println(typeStr);

                    // Default SQL type details
                    SQLTypeInfo sqlType = (SQLTypeInfo)jdbcType.getChild("DEFAULT");
                    ps.println(sqlType);
                }
            }
            ps.println("");
View Full Code Here

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

     * overwrite this method to appropriate set the TypeInfo (SQL type) for
     * all the columns
     */
    protected void initTypeInfo()
    {
        SQLTypeInfo typeInfo = getTypeInfo();
        if (typeInfo == null)
        {
            throw new UnsupportedDataTypeException(LOCALISER_RDBMS.msg("055000",column));
        }
   
View Full Code Here

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

        return new RDBMSColumnInfo(rs);
    }

    public SQLTypeInfo newSQLTypeInfo(ResultSet rs)
    {
        return new SQLTypeInfo(rs);
    }
View Full Code Here

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

        super.initialiseTypes(handler, mconn);

        // Add on any missing JDBC types not provided by JDBC driver (SQLite only provides NULL, REAL, BLOB, INTEGER, TEXT)

        // DOUBLE -> "double"
        SQLTypeInfo sqlType = new org.datanucleus.store.rdbms.schema.SQLiteTypeInfo(
            "double", (short)Types.DOUBLE, 0, null, null, null, 1, true, (short)3,
            false, false, false, "double", (short)0, (short)0, 10);
        addSQLTypeForJDBCType(handler, mconn, (short)Types.DOUBLE, sqlType, true);

        // FLOAT -> "float"
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.