FileDocCategorySizeDatePackage
DBVendorType.javaAPI DocGlassfish v2 API37635Fri May 04 22:35:02 BST 2007com.sun.jdo.spi.persistence.support.sqlstore.database

DBVendorType

public class DBVendorType extends Object

Fields Summary
private HashMap
dbMap
Map from property name to property value.
private com.sun.jdo.api.persistence.support.SpecialDBOperation
specialDBOperation
Instance of specialDBOperation for this vendor type. Please look at newSpecialDBOperationInstance() to find out how this member is initialized.
private static final com.sun.jdo.api.persistence.support.SpecialDBOperation
DEFAULT_SPECIAL_DB_OPERATION
private String
vendorType
VendorType as returned from {@link DBVendorTypeHelper#getDBType(java.lang.String)}
private int
enumVendorType
VendorType as returned from {@link DBVendorTypeHelper#getEnumDBType(java.lang.String)}
private static final com.sun.jdo.spi.persistence.utility.logging.Logger
logger
The logger
private static final ResourceBundle
messages
I18N message handler
private static Properties
defaultProperties
Default properties
private static final String
EXT
private static final String
SPACE
private static final String
NONE
private static final String
PATH
private static final String
PROPERTY_OVERRIDE_FILE
private static final String
FOR_UPDATE
private static final String
HOLDLOCK
private static final String
SUPPORTS_UPDATE_LOCK
private static final String
SUPPORTS_LOCK_COLUMN_LIST
private static final String
SUPPORTS_DISTINCT_WITH_UPDATE_LOCK
private static final String
NATIVE_OUTER_JOIN
private static final String
LEFT_JOIN
private static final String
LEFT_JOIN_APPEND
private static final String
RIGHT_JOIN
private static final String
RIGHT_JOIN_PRE
private static final String
IS_NULL
private static final String
IS_NOT_NULL
private static final String
ANSI_TRIM
private static final String
RTRIM
private static final String
RTRIM_POST
private static final String
TABLE_LIST_START
private static final String
TABLE_LIST_END
private static final String
STRING_CONCAT
private static final String
QUOTE_CHAR_START
private static final String
QUOTE_CHAR_END
private static final String
QUOTE_SPECIAL_ONLY
private static final String
CHAR_LENGTH
private static final String
SQRT
private static final String
ABS
private static final String
SUBSTRING
private static final String
SUBSTRING_FROM
private static final String
SUBSTRING_FOR
private static final String
POSITION
private static final String
POSITION_SEP
private static final String
POSITION_SEARCH_SOURCE
private static final String
POSITION_THREE_ARGS
private static final String
MAP_EMPTY_STRING_TO_NULL
private static final String
SPECIAL_DB_OPERATION
private static final String
SUPPORTS_LIKE_ESCAPE
private static final String
LEFT_LIKE_ESCAPE
private static final String
RIGHT_LIKE_ESCAPE
private static final String
NULL_COMPARISON_FUNCTION_NAME
private static final String
MOD_FUNCTION_NAME
private static final String
CONCAT_CAST
private static final String
PARAMETER_CAST
private static final String
INLINE_NUMERIC
private static final String[]
props
Constructors Summary
public DBVendorType(DatabaseMetaData databaseMetaData, String identifier)

param
databaseMetaData Instance of DatabaseMetaData
param
identifier identifier of the caller creating a new instance of SQLStoreManager.


            
     
        logger = LogHelperSQLStore.getLogger();
        messages = I18NHelper.loadBundle(
            "com.sun.jdo.spi.persistence.support.sqlstore.Bundle", // NOI18N
            DBVendorType.class.getClassLoader());

        defaultProperties = initializeDefaultProperties();
    

        String vendorName  = databaseMetaData.getDatabaseProductName();
        String vendorType  = DBVendorTypeHelper.getDBType(vendorName);

        if (logger.isLoggable()) {
            Object[] items = new Object[] {vendorName,vendorType};
            logger.fine("sqlstore.database.dbvendor.vendorname", items); // NOI18N
        }

        this.vendorType     = vendorType;
        enumVendorType      = DBVendorTypeHelper.getEnumDBType(vendorType);
        dbMap               = getDBPropertiesMap(vendorType,vendorName);
        specialDBOperation  = newSpecialDBOperationInstance((String)dbMap.get(SPECIAL_DB_OPERATION),
                                databaseMetaData, identifier);
    
Methods Summary
public java.lang.StringgetAbs()
Returns the string that represents prefix for "abs" clause for this database

        String s = (String)dbMap.get(ABS);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "Abs"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getabs", s); // NOI18N
        }

        return SPACE + s;
    
private static java.lang.StringgetCastType(int type)
Gets string used as parameter marker. Parameters must be casted on DB2/Derby. The cast type should match the actual JDBC call used to bind the parameter.

param
type type for which cast type is required.
return
String used as cast type for input type. null if cast type is not required.

    //
    //DB2type      length(bits)    JavaType
    //----------------------------------------------
    //SMALLINT      16             boolean, byte, short
    //INTEGER       32             int, char(16 bit unsigned)
    //BIGINT        64             long
    //REAL          32             float
    //DOUBLE        64             double
    //
        String castType = null;
        switch(type) {
            case FieldTypeEnumeration.BOOLEAN_PRIMITIVE :
            case FieldTypeEnumeration.BOOLEAN :
                castType = "SMALLINT";
                break;

            // CHARACTER_PRIMITIVE and CHARACTER are bound
            // to a PreparedStatement as String.
            case FieldTypeEnumeration.CHARACTER_PRIMITIVE :
            case FieldTypeEnumeration.CHARACTER :
            case FieldTypeEnumeration.STRING :
                castType = "VARCHAR(32672)"; //Max length of varchar col on DB2
                break;

            case FieldTypeEnumeration.BYTE_PRIMITIVE :
            case FieldTypeEnumeration.BYTE :
                castType = "SMALLINT";
                break;

            case FieldTypeEnumeration.SHORT_PRIMITIVE :
            case FieldTypeEnumeration.SHORT :
                castType = "SMALLINT";
                break;

            case FieldTypeEnumeration.INTEGER_PRIMITIVE :
            case FieldTypeEnumeration.INTEGER :
                castType = "INTEGER";
                break;

            case FieldTypeEnumeration.LONG_PRIMITIVE :
            case FieldTypeEnumeration.LONG :
                castType = "BIGINT";
                break;

            case FieldTypeEnumeration.FLOAT_PRIMITIVE :
            case FieldTypeEnumeration.FLOAT :
                castType = "REAL";
                break;

            case FieldTypeEnumeration.DOUBLE_PRIMITIVE :
            case FieldTypeEnumeration.DOUBLE :
                castType = "DOUBLE";
                break;
    /* Decide on what should this be casted to ?
            case FieldTypeEnumeration.ENUMTYPE_BIGDECIMAL :
            case FieldTypeEnumeration.ENUMTYPE_BIGINTEGER :
            break;
    */
            case FieldTypeEnumeration.UTIL_DATE :
            case FieldTypeEnumeration.SQL_TIMESTAMP :
                castType = "TIMESTAMP";
                break;

            case FieldTypeEnumeration.SQL_DATE :
                castType = "DATE";
                break;

            case FieldTypeEnumeration.SQL_TIME :
                castType = "TIME";
                break;

        }
        return castType;
    
public java.lang.StringgetCharLength()
Returns the string that represents prefix for "Char_length" clause for this database

        String s = (String)dbMap.get(CHAR_LENGTH);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getcharlength", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetConcatCast()
Returns cast name that surrounds concat operation.

        String s = (String)dbMap.get(CONCAT_CAST);
        if (s == null)
            s = NONE;
        else
            s = s.trim();
        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getConcatCast", s); // NOI18N
        }
        return s;
    
private static java.util.HashMapgetDBPropertiesMap(java.lang.String vendorType, java.lang.String vendorName)
get properties map for given vendorType and vendorName

        //Initialize returned map to default
        HashMap dbHashMap = new HashMap(defaultProperties);
        Properties dbProperties = loadDBProperties(vendorType, vendorName);
        dbHashMap.putAll(dbProperties);

        return dbHashMap;
    
public java.lang.StringgetForUpdate()
Returns the string that represents "for update" clause for this database

        String s = (String)dbMap.get(FOR_UPDATE);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getforupdate", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetHoldlock()
Returns the string that represents "holdlock" clause for this database

        String s = (String)dbMap.get(HOLDLOCK);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getholdlock", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetIsNotNull()
Returns the string that represents "is not NULL" clause for this database

        String s = (String)dbMap.get(IS_NOT_NULL);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getisnotnull", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetIsNull()
Returns the string that represents "is NULL" clause for this database

        String s = (String)dbMap.get(IS_NULL);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getisnull", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetLeftJoin()
Returns the string that represents "left join" clause for this database

        String s = (String)dbMap.get(LEFT_JOIN);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getleftjoin", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetLeftJoinPost()
Returns the string that represents postfix for "left join" clause for this database

        String s = (String)dbMap.get(LEFT_JOIN_APPEND);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getleftjoinpost", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetLeftLikeEscape()
Returns left string that represents "LIKE ESCAPE" clause for this database

        String s = (String)dbMap.get(LEFT_LIKE_ESCAPE);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getleftlikeescape", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetModFunctionName()
Returns function name for MOD.

        String s = (String)dbMap.get(MOD_FUNCTION_NAME);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               " % "));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getModFunctionName", s); // NOI18N
        }

        return s;
    
public java.lang.StringgetName()
Returns database vendor type

        return vendorType;
    
public java.lang.StringgetNullComparisonFunctionName()
Returns function name for comparing null value for this database

        String s = (String)dbMap.get(NULL_COMPARISON_FUNCTION_NAME);
        if (s == null)
            s = NONE;
        else
            s = s.trim();
        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getNullComparisonFunctionName", s); // NOI18N
        }
        return s;
    
public java.lang.StringgetParameterMarker(int type)
Gets string used as parameter marker. Parameters must be casted on DB2/Derby.

param
type type for which parameter marker is required.
return
parameter marker for type.

        String paramMarker = "?"; // NOI18N
        if (isParameterCast()) {
            String castType = getCastType(type);
            if (castType != null) {
                paramMarker = "CAST (? AS " + castType + ")"; // NOI18N
            }
        }

        return paramMarker;
    
public java.lang.StringgetPosition()
Returns the string that represents "Position" clause for this database

        String s = (String)dbMap.get(POSITION);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "position"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getposition", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetPositionSep()
Returns the string that represents separator part of "Position" clause for this database

        String s = (String)dbMap.get(POSITION_SEP);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "in part of position"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getpositionin", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetQuoteCharEnd()
Returns the end identifier quote character for this database, or an empty string, if there is none.

        String s = (String)dbMap.get(QUOTE_CHAR_END);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getquotecharend", s); // NOI18N
        }

        return s;
    
public java.lang.StringgetQuoteCharStart()
Returns the start identifier quote character for this database, or an empty string, if there is none.

        String s = (String)dbMap.get(QUOTE_CHAR_START);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getquotecharstart", s); // NOI18N
        }

        return s;
    
public booleangetQuoteSpecialOnly()
Returns true if only identifiers with special characters should be quoted for this database

        String s = (String)dbMap.get(QUOTE_SPECIAL_ONLY);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getquotespecialonly", b); // NOI18N
        }

        return b.booleanValue();
    
public java.lang.StringgetRightJoin()
Returns the string that represents "right join" clause for this database

        String s = (String)dbMap.get(RIGHT_JOIN);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getrightjoin", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetRightJoinPre()
Returns the string that represents prefix for "right join" clause for this database

        String s = (String)dbMap.get(RIGHT_JOIN_PRE);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getrightjoinipre", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetRightLikeEscape()
Returns right string that represents "LIKE ESCAPE" clause for this database

        String s = (String)dbMap.get(RIGHT_LIKE_ESCAPE);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getrightlikeescape", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetRtrim()
Returns the string that represents "RTRIM" clause for this database

        String s = (String)dbMap.get(RTRIM);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getrtrim", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetRtrimPost()
Returns the string that represents postfix for "RTRIM" clause for this database

        String s = (String)dbMap.get(RTRIM_POST);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getrtrimpost", s); // NOI18N
        }

        return SPACE + s;
    
public com.sun.jdo.api.persistence.support.SpecialDBOperationgetSpecialDBOperation()
Returns a SpecialDBOperation object

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getSpecialDBOperation", specialDBOperation); // NOI18N
        }

        return specialDBOperation;
    
public java.lang.StringgetSqrt()
Returns the string that represents prefix for "Sqrt" clause for this database

        String s = (String)dbMap.get(SQRT);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "Sqrt"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getsqrt", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetStringConcat()
Returns the string that represents concatenation operation for this database

        String s = (String)dbMap.get(STRING_CONCAT);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getstringconcat", s); // NOI18N
        }

        return SPACE + s + SPACE;
    
public java.lang.StringgetSubstring()
Returns the string that represents prefix for "Substring" clause for this database

        String s = (String)dbMap.get(SUBSTRING);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "substring"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getsubstring", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetSubstringFor()
Returns the string that represents for part for "Substr" clause for this database

        String s = (String)dbMap.get(SUBSTRING_FOR);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "for part of substring"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getsubstringfor", s); // NOI18N
        }

        return SPACE + s + SPACE;
    
public java.lang.StringgetSubstringFrom()
Returns the string that represents from part for "Substring" clause for this database

        String s = (String)dbMap.get(SUBSTRING_FROM);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "from part of substring"));
        }

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getsubstringfrom", s); // NOI18N
        }

        return SPACE + s + SPACE;
    
public java.lang.StringgetTableListEnd()
Returns the string that represents end of table list for this database

        String s = (String)dbMap.get(TABLE_LIST_END);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.gettablelistend", s); // NOI18N
        }

        return SPACE + s;
    
public java.lang.StringgetTableListStart()
Returns the string that represents start of table list for this database

        String s = (String)dbMap.get(TABLE_LIST_START);
        if (s == null)
            s = NONE;

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.gettableliststart", s); // NOI18N
        }

        return SPACE + s;
    
private static java.util.PropertiesinitializeDefaultProperties()
Initialize default properties.

        //Load default properties if not already loaded
        if (defaultProperties == null) {
            // Load default (sql92) Properties
            defaultProperties = new Properties();
            try {
                loadFromResource(DBVendorTypeHelper.DEFAULT_DB, defaultProperties);
            } catch (IOException e) {
                throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
                                "sqlstore.database.dbvendor.cantloadDefaultProperties"), // NOI18N
                                 e);
            }
        }

        return defaultProperties;
     
public booleanisAnsiTrim()
Returns true if this database need ansi style rtrim semantics.

        String s = (String)dbMap.get(ANSI_TRIM);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.isAnsiTrim", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisDistinctSupportedWithUpdateLock()
Returns true if this database supports distinct clause with update lock

        String s = (String)dbMap.get(SUPPORTS_DISTINCT_WITH_UPDATE_LOCK);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.isdistinctupdatelocksupported", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisInlineNumeric()
Returns true if numeric parameters are inlined for this database

        String s = (String)dbMap.get(INLINE_NUMERIC);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.isInlineNumeric", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisLockColumnListSupported()
Returns true if this database supports update 'of column list'

        String s = (String)dbMap.get(SUPPORTS_LOCK_COLUMN_LIST);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.islockcolumnlistsupported", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisModOperationUsingFunction()
Returns true if modulo operation uses function, false otherwise.

        return getModFunctionName().length() != 0;
    
public booleanisNativeOuterJoin()
Returns true if the this database needs native outer join semantics.

        String s = (String)dbMap.get(NATIVE_OUTER_JOIN);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.isNativeOuterJoin", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisParameterCast()
Returns true if parameters need to be casted for this database

        String s = (String)dbMap.get(PARAMETER_CAST);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.isParameterCast", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisPositionSearchSource()
Returns true if first position argument is Search String and second argument is Source String for this database

        String s = (String)dbMap.get(POSITION_SEARCH_SOURCE);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getpositionsrchsrc", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisPositionThreeArgs()
Returns true if position has three argument for this database

        String s = (String)dbMap.get(POSITION_THREE_ARGS);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.getposition3args", b); // NOI18N
        }

        return b.booleanValue();
    
public booleanisUpdateLockSupported()
Returns true if this database supports update lock

        String s = (String)dbMap.get(SUPPORTS_UPDATE_LOCK);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.isupdatelocksupported", b); // NOI18N
        }

        return b.booleanValue();
    
private static java.util.PropertiesloadDBProperties(java.lang.String vendorType, java.lang.String vendorName)
Load properties for database specified by vendorType and vendorName

        // Load actual Properties. Even if it is unknown db,
        Properties dbProperties = new Properties();
        if (!vendorType.equals(DBVendorTypeHelper.DEFAULT_DB)) {
            try {
                loadFromResource(vendorType, dbProperties);
            } catch (IOException e) {
                // else ignore
                if (logger.isLoggable()) {
                    logger.fine("sqlstore.database.dbvendor.init.default", vendorType); // NOI18N
                }
            }
        }
        overrideProperties(dbProperties, vendorName);
        return dbProperties;
    
private static voidloadFromResource(java.lang.String resourceName, java.util.Properties properties)
loads database properties list from the specified resource into specified Properties object.

param
resourceName Name of resource.
param
properties Properties object to load

        String fullResourceName = PATH + resourceName + EXT;
        PropertyHelper.loadFromResource(properties, fullResourceName, DBVendorType.class.getClassLoader());
    
public booleanmapEmptyStringToNull()
Returns true if this database maps empty Strings to NULL

        String s = (String)dbMap.get(MAP_EMPTY_STRING_TO_NULL);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.mapemptystrtonull", b); // NOI18N
        }

        return b.booleanValue();
    
private com.sun.jdo.api.persistence.support.SpecialDBOperationnewSpecialDBOperationInstance(java.lang.String specialDBOpClassName, java.sql.DatabaseMetaData databaseMetaData, java.lang.String identifier)
Returns new instance of class specified by specialDBOpClassName. The class is required to implement interface SpecialDBOperation. If specialDBOpClassName is null or cannot be loaded, then an instance of BaseSpecialDBOperation is returned.

param
specialDBOpClassName Name of a class that implements SpecialDBOperation
param
databaseMetaData DatabaseMetaData for the connection for which this SpecialDBOperation is created
param
identifier Identifier of pmf used to obtain databaseMetaData. This can be null in non managed environment.
return
An instance of SpecialDBOperation specified by specialDBOpClassName.

        SpecialDBOperation retInstance = null;
        if (specialDBOpClassName != null) {
            final ClassLoader loader = DBVendorType.class.getClassLoader();
            Class clz = (Class)java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction() {
                    public Object run() {
                        try {
                            if (loader != null) {
                                return Class.forName(specialDBOpClassName,
                                    true, loader);
                            } else {
                                return Class.forName(specialDBOpClassName);
                            }
                        } catch(Exception ex) {
                            if (logger.isLoggable()) {
                                logger.log(Logger.INFO,
                                    "core.configuration.cantloadclass", // NOI18N
                                    specialDBOpClassName);
                            }
                            return null;
                        }
                    }
                }
            );

            if (clz != null) {
                try {
                    retInstance = (SpecialDBOperation)clz.newInstance();
                    retInstance.initialize(databaseMetaData, identifier);
                } catch(Exception ex) {
                    throw new JDOFatalUserException(
                        I18NHelper.getMessage(messages,
                        "sqlstore.database.dbvendor.cantinstantiateclass", // NOI18N
                        specialDBOpClassName), ex);
                }
            }
        }
        return (retInstance != null)? retInstance : DEFAULT_SPECIAL_DB_OPERATION;
    
private static voidoverrideProperties(java.util.Properties dbProperties, java.lang.String vendorName)
Overrides default properties with the ones provided by the user

        boolean debug = logger.isLoggable();

        Properties overridingProperties = new Properties();
        try {
            PropertyHelper.loadFromFile(overridingProperties, PROPERTY_OVERRIDE_FILE);
        } catch (Exception e) {
            if (debug) {
                logger.fine("sqlstore.database.dbvendor.overrideproperties"); // NOI18N
            }
            return; 	// nothing to override
        }

        //Prepare a clean vendor name by replacing all ' '  and '/' with underscores.
        String cleanVendorName = vendorName.toLowerCase().replace(' ", '_");
        cleanVendorName = cleanVendorName.replace('/", '_");

        String propertyPrefix = "database." + cleanVendorName + "."; // prefix // NOI18N

        for (int i = 0; i < props.length; i++) {
            String o = overridingProperties.getProperty(propertyPrefix + props[i]);
            if (o != null) {
                if (debug) {
                    Object[] items = new Object[] {props[i],o};
                    logger.fine("sqlstore.database.dbvendor.overrideproperties.with", items); // NOI18N
                }
                dbProperties.setProperty(props[i], o);
            }
        }
    
public booleansupportsLikeEscape()
Returns true if this database supports "LIKE ESCAPE" clause

        String s = (String)dbMap.get(SUPPORTS_LIKE_ESCAPE);
        Boolean b = Boolean.valueOf(s);

        if (logger.isLoggable()) {
            logger.fine("sqlstore.database.dbvendor.supportslikeescape", b); // NOI18N
        }

        return b.booleanValue();