Search in sources :

Example 11 with RDBMSColumnInfo

use of org.datanucleus.store.rdbms.schema.RDBMSColumnInfo in project datanucleus-rdbms by datanucleus.

the class SQLServerAdapter method newRDBMSColumnInfo.

/**
 * Method to create a column info for the current row.
 * Overrides the dataType/columnSize/decimalDigits to cater for SQLServer particularities.
 * @param rs ResultSet from DatabaseMetaData.getColumns()
 * @return column info
 */
public RDBMSColumnInfo newRDBMSColumnInfo(ResultSet rs) {
    RDBMSColumnInfo info = new RDBMSColumnInfo(rs);
    short dataType = info.getDataType();
    switch(dataType) {
        case Types.DATE:
        case Types.TIME:
        case Types.TIMESTAMP:
            // Values > 0 inexplicably get returned here.
            info.setDecimalDigits(0);
            break;
        default:
            break;
    }
    return info;
}
Also used : RDBMSColumnInfo(org.datanucleus.store.rdbms.schema.RDBMSColumnInfo)

Example 12 with RDBMSColumnInfo

use of org.datanucleus.store.rdbms.schema.RDBMSColumnInfo in project datanucleus-rdbms by datanucleus.

the class SybaseAdapter method newRDBMSColumnInfo.

/**
 * Method to create a column info for the current row.
 * Overrides the dataType/columnSize/decimalDigits to cater for Sybase particularities.
 * @param rs ResultSet from DatabaseMetaData.getColumns()
 * @return column info
 */
public RDBMSColumnInfo newRDBMSColumnInfo(ResultSet rs) {
    RDBMSColumnInfo info = new RDBMSColumnInfo(rs);
    short dataType = info.getDataType();
    switch(dataType) {
        case Types.DATE:
        case Types.TIME:
        case Types.TIMESTAMP:
            // Values > 0 inexplicably get returned here.
            info.setDecimalDigits(0);
            break;
        default:
            break;
    }
    return info;
}
Also used : RDBMSColumnInfo(org.datanucleus.store.rdbms.schema.RDBMSColumnInfo)

Aggregations

RDBMSColumnInfo (org.datanucleus.store.rdbms.schema.RDBMSColumnInfo)12 Iterator (java.util.Iterator)5 HashMap (java.util.HashMap)3 DatastoreIdentifier (org.datanucleus.store.rdbms.identifier.DatastoreIdentifier)3 Connection (java.sql.Connection)2 MissingColumnException (org.datanucleus.store.rdbms.exceptions.MissingColumnException)2 RDBMSTableInfo (org.datanucleus.store.rdbms.schema.RDBMSTableInfo)2 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 ListIterator (java.util.ListIterator)1 Map (java.util.Map)1 PersistenceManager (javax.jdo.PersistenceManager)1 ClassLoaderResolver (org.datanucleus.ClassLoaderResolver)1 JDOPersistenceManager (org.datanucleus.api.jdo.JDOPersistenceManager)1 NucleusConnection (org.datanucleus.store.NucleusConnection)1 ManagedConnection (org.datanucleus.store.connection.ManagedConnection)1 RDBMSStoreManager (org.datanucleus.store.rdbms.RDBMSStoreManager)1 DatastoreAdapter (org.datanucleus.store.rdbms.adapter.DatastoreAdapter)1