Search in sources :

Example 1 with DatabaseContext

use of org.apache.derby.iapi.db.DatabaseContext in project derby by apache.

the class SQLDate method setValue.

public void setValue(String theValue) throws StandardException {
    restoreToNull();
    if (theValue != null) {
        DatabaseContext databaseContext = (DatabaseContext) DataValueFactoryImpl.getContext(DatabaseContext.CONTEXT_ID);
        parseDate(theValue, false, (databaseContext == null) ? null : databaseContext.getDatabase(), (Calendar) null);
    }
}
Also used : DatabaseContext(org.apache.derby.iapi.db.DatabaseContext)

Example 2 with DatabaseContext

use of org.apache.derby.iapi.db.DatabaseContext in project derby by apache.

the class SQLTime method setValue.

public void setValue(String theValue) throws StandardException {
    restoreToNull();
    if (theValue != null) {
        DatabaseContext databaseContext = (DatabaseContext) DataValueFactoryImpl.getContext(DatabaseContext.CONTEXT_ID);
        parseTime(theValue, false, (databaseContext == null) ? null : databaseContext.getDatabase(), (Calendar) null);
    }
}
Also used : DatabaseContext(org.apache.derby.iapi.db.DatabaseContext)

Example 3 with DatabaseContext

use of org.apache.derby.iapi.db.DatabaseContext in project derby by apache.

the class SQLTimestamp method setValue.

public void setValue(String theValue) throws StandardException {
    restoreToNull();
    if (theValue != null) {
        DatabaseContext databaseContext = (DatabaseContext) DataValueFactoryImpl.getContext(DatabaseContext.CONTEXT_ID);
        parseTimestamp(theValue, false, (databaseContext == null) ? null : databaseContext.getDatabase(), (Calendar) null);
    }
/* restoreToNull will have already set the encoded date to 0 (null value) */
}
Also used : DatabaseContext(org.apache.derby.iapi.db.DatabaseContext)

Example 4 with DatabaseContext

use of org.apache.derby.iapi.db.DatabaseContext in project derby by apache.

the class ClobStreamHeaderGenerator method determineHeaderFormat.

/**
 * Determines which header format to use.
 * <p>
 * <em>Implementation note:</em> The header format is determined by
 * consulting the data dictionary throught the context service. If there is
 * no context, the operation will fail.
 *
 * @throws IllegalStateException if there is no context
 */
private void determineHeaderFormat() {
    DatabaseContext dbCtx = (DatabaseContext) getContext(DatabaseContext.CONTEXT_ID);
    if (dbCtx == null) {
        throw new IllegalStateException("No context, unable to determine " + "which stream header format to generate");
    } else {
        DataDictionary dd = dbCtx.getDatabase().getDataDictionary();
        try {
            isPreDerbyTenFive = Boolean.valueOf(!dd.checkVersion(DataDictionary.DD_VERSION_DERBY_10_5, null));
        } catch (StandardException se) {
            // This should never happen as long as the second argument
            // above is null. If it happens, just bomb out.
            IllegalStateException ise = new IllegalStateException(se.getMessage());
            ise.initCause(se);
            throw ise;
        }
        // Update the DVD with information about the mode the database is
        // being accessed in. It is assumed that a DVD is only shared
        // within a single database, i.e. the mode doesn't change during
        // the lifetime of the DVD.
        callbackDVD.setStreamHeaderFormat(isPreDerbyTenFive);
    }
}
Also used : DatabaseContext(org.apache.derby.iapi.db.DatabaseContext) StandardException(org.apache.derby.shared.common.error.StandardException) DataDictionary(org.apache.derby.iapi.sql.dictionary.DataDictionary)

Aggregations

DatabaseContext (org.apache.derby.iapi.db.DatabaseContext)4 DataDictionary (org.apache.derby.iapi.sql.dictionary.DataDictionary)1 StandardException (org.apache.derby.shared.common.error.StandardException)1