|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.dbtools.DBProvider
public class DBProvider
DBProvider
specifies SQL database provider specific attributes.
Field Summary | |
---|---|
static int[] |
DATATYPE_ARRAY
|
static int |
DATATYPE_BINARY
|
static int |
DATATYPE_BOOLEAN
|
static int |
DATATYPE_DATETIME
|
static int |
DATATYPE_DECIMAL
|
static int |
DATATYPE_NONE
|
static int |
DATATYPE_NUMERIC
|
static int |
DATATYPE_SIGNED
|
static int |
DATATYPE_STRING
|
static int |
DATATYPE_UNSIGNED
|
static int |
DB_DERBY
|
static int |
DB_MARIADB
|
static int |
DB_MYSQL
|
static int |
DB_ORACLEXE
|
static int |
DB_POSTGRESQL
|
static int |
DB_SQLSERVER
|
static java.lang.String |
DEFAULT_ALT_INDEX_NAME
|
static java.lang.String |
Derby_Name
|
protected static DBProvider |
Derby_Provider
|
static long |
FLAGS_LIMIT
|
static long |
FLAGS_NONE
|
static long |
FLAGS_OFFSET
|
static java.lang.String |
LIKE_WILDCARD
|
static java.lang.String |
MariaDB_Name
|
protected static DBProvider |
MariaDB_Provider
|
static java.lang.String |
MS_SQLServer_Name
|
protected static DBProvider |
MS_SQLServer_Provider
|
static java.lang.String |
MySQL_InnoDB_Name
|
protected static DBProvider |
MySQL_InnoDB_Provider
|
static java.lang.String |
MySQL_MyISAM_Name
|
protected static DBProvider |
MySQL_MyISAM_Provider
|
static java.lang.String |
MySQL_Old_Name
|
protected static DBProvider |
MySQL_Old_Provider
|
static java.lang.String |
Oracle_XE_Name
|
protected static DBProvider |
Oracle_XE_Provider
|
static java.lang.String |
PostgreSQL_Name
|
static java.lang.String |
PostgreSQL_Name_old
|
protected static DBProvider |
PostgreSQL_Provider
|
protected static DBProvider |
PostgreSQL_Provider_old
|
static java.lang.String |
PRIMARY_INDEX_NAME
|
static int |
SQL_BLOB
|
static int |
SQL_BOOLEAN
|
static int |
SQL_DATETIME
|
static int |
SQL_DOUBLE
|
static int |
SQL_FLOAT
|
static int |
SQL_INT16
|
static int |
SQL_INT32
|
static int |
SQL_INT64
|
static int |
SQL_INT8
|
static int |
SQL_MBLOB
|
static int |
SQL_SBLOB
|
static int |
SQL_TEXT
|
static int |
SQL_UINT16
|
static int |
SQL_UINT32
|
static int |
SQL_UINT64
|
static int |
SQL_UINT8
|
static int |
SQL_UNKNOWN
|
static int |
SQL_VARCHAR
|
static java.lang.String[] |
TYPE_ARRAY
|
static java.lang.String |
TYPE_BLOB
|
static java.lang.String |
TYPE_BOOLEAN
|
static java.lang.String |
TYPE_DATETIME
|
static java.lang.String |
TYPE_DOUBLE
|
static java.lang.String |
TYPE_FLOAT
|
static java.lang.String |
TYPE_INT16
|
static java.lang.String |
TYPE_INT32
|
static java.lang.String |
TYPE_INT64
|
static java.lang.String |
TYPE_INT8
|
static java.lang.String |
TYPE_MBLOB
|
static java.lang.String |
TYPE_SBLOB
|
static java.lang.String |
TYPE_STRING
|
static java.lang.String |
TYPE_TEXT
|
static java.lang.String |
TYPE_UINT16
|
static java.lang.String |
TYPE_UINT32
|
static java.lang.String |
TYPE_UINT64
|
static java.lang.String |
TYPE_UINT8
|
static java.lang.String |
TYPE_UNKNOWN
|
static java.lang.String |
UNIQUE_INDEX_NAME
|
Constructor Summary | |
---|---|
DBProvider(java.lang.String name,
int id,
int dftPort,
java.lang.String[] drivers,
org.opengts.dbtools.DBProvider.NameFilter colNameFlt,
org.opengts.dbtools.DBProvider.NameFilter ndxNameFlt,
org.opengts.dbtools.DBProvider.NameFilter tblNameFlt,
java.lang.String tblNdxType,
long flags,
java.lang.String[] dataTypes)
Constructor |
Method Summary | |
---|---|
protected static int |
_getTypeIndex(java.lang.String localType,
boolean isDefinedType)
Returns the index of the specified SQL SQL datatype |
static java.lang.String |
_preTranslateTableName(java.lang.String tn)
Pre-translates table name for DB provider (used only in calls to "TABLE_NAME()") |
static boolean |
areTypesEquivalent(java.lang.String defType,
java.lang.String actType)
Returns 'true' is the specified types are equivalent |
static void |
createAlternateIndex(java.lang.String utableName,
DBAlternateIndex altIndex)
Create an alternate Index |
static void |
createDatabase(java.lang.String rootUser,
java.lang.String rootPass)
Create the database specified by the Runtime config (needed for initialization only) |
static void |
createPrimaryIndex(DBFactory dbFact)
Create primary key Index (see createTable) |
static void |
createTable(DBFactory factory)
Create the backing table for the specified DBFactory |
static void |
createTable(java.lang.String utableName,
DBField[] flds,
DBField[] priKeys,
java.lang.String keyType,
DBAlternateIndex[] altIndexes)
Create the specified SQL table |
static void |
dropTable(java.lang.String utableName)
Drop (delete) the specified table |
static java.lang.String |
FLD_COUNT()
|
static java.lang.String |
FLD_SUM(java.lang.String col)
|
static DBField[] |
getActualTableFields(java.lang.String utableName)
Returns the existing fields in the specified table |
static DBTableIndexMap |
getActualTableIndexMap(java.lang.String utableName)
Returns a map of column names to index names |
org.opengts.dbtools.DBProvider.NameFilter |
getColumnNameFilter()
Gets the column name filter |
static java.lang.String |
getDataTypeFromSqlType(java.lang.String sqlType)
Returns the defined local type for the specified SQL type |
static int |
getDataTypeMask(java.lang.String localType)
Get data type mask for type |
static java.lang.String |
getDBHost()
Returns the host name for the DBProvider server |
static java.lang.String |
getDBName()
Returns the database name |
static java.lang.String |
getDBPassword()
Returns the DB user password |
static int |
getDBPort()
Returns the port number for the DBProvider server |
static java.lang.String |
getDBUri(boolean inclDBName)
Returns the database access URI |
static java.lang.String |
getDBUsername()
Returns the DB user name |
static java.lang.String |
getDefaultCharacterSet()
Gets the database provider default character encoding. |
int |
getDefaultPort()
Gets the default connection port. |
java.lang.String[] |
getDrivers()
Gets the JDBC drivers |
long |
getFlags()
Gets the JDBC flags |
int |
getID()
Gets the JDBC ID |
java.lang.String |
getJDBCName()
Gets the JDBC name |
static int |
getLockLevel()
Returns the current recursive lock level |
static DBProvider |
getProvider()
Returns the current DBProvider as defined in the Runtime configuration file (property "RTKey.DB_PROVIDER") |
static DBProvider |
getProvider(java.lang.String dbpName)
Returns the DBProvider forthe specified name |
static java.lang.String |
getProviderIndexType()
Returns the index type of the current DBProvider |
static java.lang.String |
getProviderName()
Returns the name of the current DBProvider |
static java.lang.String |
getSQLType(int dataTypeNdx)
Returns the local data type for the specified index |
static java.lang.String |
getSqlTypeFromDataType(java.lang.String localType)
Returns the SQL type for the defined specified local type |
java.lang.String[] |
getSQLTypes()
Gets an array of the SQL datatypes |
java.lang.String |
getTableIndexType()
Gets the table index type |
org.opengts.dbtools.DBProvider.NameFilter |
getTableNameFilter()
Gets the table name filter |
static void |
grantDBUser(java.lang.String rootUser,
java.lang.String rootPass)
Execute an SQL statement granting access to the DB user (needed for initialization only) |
static boolean |
insertRecordIntoTable(DBRecord rec)
Insert record into table |
static boolean |
isDataTypeBinary(int typeNdx)
Returns true if the specified data type is a Binary type |
static boolean |
isDataTypeBinary(java.lang.String localType)
Returns true if the specified data type is a Binary type |
static boolean |
isDataTypeBoolean(int typeNdx)
Returns true if the specified data type is a Boolean type |
static boolean |
isDataTypeBoolean(java.lang.String localType)
|
static boolean |
isDataTypeDecimal(int typeNdx)
Returns true if the specified data type is a floating point type |
static boolean |
isDataTypeDecimal(java.lang.String localType)
|
static boolean |
isDataTypeNumeric(int typeNdx)
Returns true if the specified data type is numeric |
static boolean |
isDataTypeNumeric(java.lang.String localType)
|
static boolean |
isDataTypeString(int typeNdx)
Returns true if the specified data type is a String type |
static boolean |
isDataTypeString(java.lang.String localType)
Returns true if the specified data type is a String type |
static boolean |
isDataTypeUnsigned(int typeNdx)
Returns true if the specified data type is unsigned |
static boolean |
isDataTypeUnsigned(java.lang.String localType)
Returns true if the specified data type is unsigned |
static boolean |
isMySqlInnoDB()
Returns true if the index type of the current DBProvider if MySQL "InnoDB" |
static boolean |
isTableLockingEnabled()
Returns true if table locking is enabled |
static java.lang.String |
loadJDBCDriver()
Loads the current DBProvider class drivers |
static boolean |
lockTableForRead(java.lang.String utableName,
boolean forceLock)
Lock specified tables for read |
static boolean |
lockTables(java.lang.String[] writeTables,
java.lang.String[] readTables)
Lock specified tables for write/read |
java.lang.String |
quoteColumnName(java.lang.String colName)
Quotes the column name based on the requirements of the DBProvider |
java.lang.String |
quoteTableName(java.lang.String tblName)
Quotes the table name based on the requirements of the DBProvider |
static void |
removeAlternateIndex(java.lang.String utableName,
java.lang.String indexName)
Removes an alternate Index |
static void |
removePrimaryIndex(java.lang.String utableName)
Remove primary key Index |
static boolean |
sendJdbcCommunicationExceptionNotification(java.lang.Throwable th)
Sends a notification for CommunicationException errors |
static java.lang.String |
SQL_VARCHAR(int size)
|
boolean |
supportsLimit()
Returns true if the DBProvider supports limits |
boolean |
supportsOffset()
Returns true if the DBProvider supports offsets |
static java.lang.String |
translateColumnName(java.lang.String cn)
Translates column name for DB provider |
static java.lang.String |
translateTableName(DBProvider dbprov,
java.lang.String tn)
Translates table name for DB provider |
static java.lang.String |
translateTableName(java.lang.String tn)
Translates table name for DB provider |
static java.lang.String |
TYPE_INT(java.lang.String val)
|
static java.lang.String |
TYPE_STRING(int size)
|
static boolean |
unlockTables()
Unlock locked tables |
static boolean |
updateRecordInTable(DBRecord rec,
java.util.Set<java.lang.String> updFldSet)
Assemble an update statement (and execute) for the specified record and set of fields to update |
static boolean |
updateRecordInTable(DBRecord rec,
java.lang.String[] updFldArray)
Assemble an update statement (and execute) for the specified record and array of fields to update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PRIMARY_INDEX_NAME
public static final java.lang.String UNIQUE_INDEX_NAME
public static final java.lang.String DEFAULT_ALT_INDEX_NAME
public static final java.lang.String LIKE_WILDCARD
public static final java.lang.String TYPE_UNKNOWN
public static final java.lang.String TYPE_BOOLEAN
public static final java.lang.String TYPE_INT8
public static final java.lang.String TYPE_UINT8
public static final java.lang.String TYPE_INT16
public static final java.lang.String TYPE_UINT16
public static final java.lang.String TYPE_INT32
public static final java.lang.String TYPE_UINT32
public static final java.lang.String TYPE_INT64
public static final java.lang.String TYPE_UINT64
public static final java.lang.String TYPE_FLOAT
public static final java.lang.String TYPE_DOUBLE
public static final java.lang.String TYPE_SBLOB
public static final java.lang.String TYPE_BLOB
public static final java.lang.String TYPE_MBLOB
public static final java.lang.String TYPE_TEXT
public static final java.lang.String TYPE_STRING
public static final java.lang.String TYPE_DATETIME
public static final java.lang.String[] TYPE_ARRAY
public static final int SQL_UNKNOWN
public static final int SQL_BOOLEAN
public static final int SQL_INT8
public static final int SQL_UINT8
public static final int SQL_INT16
public static final int SQL_UINT16
public static final int SQL_INT32
public static final int SQL_UINT32
public static final int SQL_INT64
public static final int SQL_UINT64
public static final int SQL_FLOAT
public static final int SQL_DOUBLE
public static final int SQL_SBLOB
public static final int SQL_BLOB
public static final int SQL_MBLOB
public static final int SQL_TEXT
public static final int SQL_VARCHAR
public static final int SQL_DATETIME
public static final int DATATYPE_NONE
public static final int DATATYPE_BOOLEAN
public static final int DATATYPE_UNSIGNED
public static final int DATATYPE_SIGNED
public static final int DATATYPE_DECIMAL
public static final int DATATYPE_STRING
public static final int DATATYPE_BINARY
public static final int DATATYPE_DATETIME
public static final int DATATYPE_NUMERIC
public static final int[] DATATYPE_ARRAY
public static final int DB_MYSQL
public static final int DB_POSTGRESQL
public static final int DB_DERBY
public static final int DB_SQLSERVER
public static final int DB_ORACLEXE
public static final int DB_MARIADB
public static final long FLAGS_NONE
public static final long FLAGS_LIMIT
public static final long FLAGS_OFFSET
public static final java.lang.String MySQL_Old_Name
protected static DBProvider MySQL_Old_Provider
public static final java.lang.String MySQL_MyISAM_Name
protected static DBProvider MySQL_MyISAM_Provider
public static final java.lang.String MySQL_InnoDB_Name
protected static DBProvider MySQL_InnoDB_Provider
public static final java.lang.String MariaDB_Name
protected static DBProvider MariaDB_Provider
public static final java.lang.String Oracle_XE_Name
protected static DBProvider Oracle_XE_Provider
public static final java.lang.String PostgreSQL_Name
protected static DBProvider PostgreSQL_Provider
public static final java.lang.String PostgreSQL_Name_old
protected static DBProvider PostgreSQL_Provider_old
public static final java.lang.String Derby_Name
protected static DBProvider Derby_Provider
public static final java.lang.String MS_SQLServer_Name
protected static DBProvider MS_SQLServer_Provider
Constructor Detail |
---|
public DBProvider(java.lang.String name, int id, int dftPort, java.lang.String[] drivers, org.opengts.dbtools.DBProvider.NameFilter colNameFlt, org.opengts.dbtools.DBProvider.NameFilter ndxNameFlt, org.opengts.dbtools.DBProvider.NameFilter tblNameFlt, java.lang.String tblNdxType, long flags, java.lang.String[] dataTypes)
name
- The JDBC nameid
- The JDBC IDdftPort
- The default connection portdrivers
- The JDBC driverscolNameFlt
- The column name filterndxNameFlt
- The index name filtertblNameFlt
- The table name filtertblNdxType
- The table idex type ("CREATE TABLE" prefix)flags
- The JDBC flagsdataTypes
- The array of data type names
java.lang.RuntimeException
- If dataTypes
is not the correct
lengthMethod Detail |
---|
public static java.lang.String FLD_COUNT()
public static java.lang.String FLD_SUM(java.lang.String col)
public static java.lang.String TYPE_STRING(int size)
public static java.lang.String TYPE_INT(java.lang.String val)
public static java.lang.String SQL_VARCHAR(int size)
public static DBProvider getProvider(java.lang.String dbpName)
public static DBProvider getProvider()
public static java.lang.String getProviderName()
public static java.lang.String getProviderIndexType()
public static boolean isMySqlInnoDB()
public static java.lang.String loadJDBCDriver()
public static boolean sendJdbcCommunicationExceptionNotification(java.lang.Throwable th)
public static java.lang.String getDBHost()
public static int getDBPort()
public static java.lang.String getDBName()
public static java.lang.String getDBUsername()
public static java.lang.String getDBPassword()
public static java.lang.String getDBUri(boolean inclDBName)
inclDBName
- True to include the name of the database in the URI
protected static int _getTypeIndex(java.lang.String localType, boolean isDefinedType)
localType
- The local typeisDefinedType
- Is a 'defined' type
public static boolean areTypesEquivalent(java.lang.String defType, java.lang.String actType)
defType
- The defined typeactType
- The actual tupe
public static java.lang.String getSqlTypeFromDataType(java.lang.String localType)
localType
- The local type
public static java.lang.String getDataTypeFromSqlType(java.lang.String sqlType)
sqlType
- The SQL type
public static java.lang.String getSQLType(int dataTypeNdx)
dataTypeNdx
- The data type index (Note: NO BOUNDS CHEKCING IS PERFORMED!)
public static DBField[] getActualTableFields(java.lang.String utableName) throws DBException
utableName
- The table name
DBException
- if an error occured fetching the fieldspublic static DBTableIndexMap getActualTableIndexMap(java.lang.String utableName) throws DBException
utableName
- The untranslated table name
DBException
- if an error occured fetching the indexespublic static int getDataTypeMask(java.lang.String localType)
localType
- The nocal type name
public static boolean isDataTypeBoolean(int typeNdx)
typeNdx
- The data type mask for type
public static boolean isDataTypeBoolean(java.lang.String localType)
public static boolean isDataTypeNumeric(int typeNdx)
typeNdx
- The data type mask for type
public static boolean isDataTypeNumeric(java.lang.String localType)
public static boolean isDataTypeDecimal(int typeNdx)
typeNdx
- The data type mask for type
public static boolean isDataTypeDecimal(java.lang.String localType)
public static boolean isDataTypeUnsigned(int typeNdx)
typeNdx
- The data type mask for type
public static boolean isDataTypeUnsigned(java.lang.String localType)
localType
- The local data type name
public static boolean isDataTypeString(int typeNdx)
typeNdx
- The data type mask for type
public static boolean isDataTypeString(java.lang.String localType)
localType
- The local data type name
public static boolean isDataTypeBinary(int typeNdx)
typeNdx
- The data type mask for type mask for type
public static boolean isDataTypeBinary(java.lang.String localType)
localType
- The local data type name
public static void createDatabase(java.lang.String rootUser, java.lang.String rootPass) throws DBException, java.sql.SQLException
rootUser
- The database root user account namerootPass
- The database root user password
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static java.lang.String translateTableName(DBProvider dbprov, java.lang.String tn)
dbprov
- The DBProvider instancetn
- The base table name
public static java.lang.String translateTableName(java.lang.String tn)
tn
- The base table name
public static java.lang.String _preTranslateTableName(java.lang.String tn)
tn
- The base (untranslated) table name
public static java.lang.String translateColumnName(java.lang.String cn)
cn
- The base column name
public static void createTable(DBFactory factory) throws java.sql.SQLException, DBException
factory
- The DBFactory
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void createTable(java.lang.String utableName, DBField[] flds, DBField[] priKeys, java.lang.String keyType, DBAlternateIndex[] altIndexes) throws java.sql.SQLException, DBException
utableName
- The untranslated table nameflds
- The table columnspriKeys
- The table primary keyskeyType
- The key typealtIndexes
- The table alternate indexes
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void createAlternateIndex(java.lang.String utableName, DBAlternateIndex altIndex) throws java.sql.SQLException, DBException
utableName
- The untranslated table namealtIndex
- The alternate index
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void removeAlternateIndex(java.lang.String utableName, java.lang.String indexName) throws java.sql.SQLException, DBException
utableName
- The untranslated table nameindexName
- The alternate index name
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void createPrimaryIndex(DBFactory dbFact) throws java.sql.SQLException, DBException
dbFact
- The DBFactory
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void removePrimaryIndex(java.lang.String utableName) throws java.sql.SQLException, DBException
utableName
- The untranslated table name
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void dropTable(java.lang.String utableName) throws java.sql.SQLException, DBException
utableName
- The untranslated table name
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static boolean insertRecordIntoTable(DBRecord rec) throws java.sql.SQLException, DBException
rec
- The record to insert
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static boolean updateRecordInTable(DBRecord rec, java.lang.String[] updFldArray) throws java.sql.SQLException, DBException
rec
- The record to updateupdFldArray
- The array of fields to update
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static boolean updateRecordInTable(DBRecord rec, java.util.Set<java.lang.String> updFldSet) throws java.sql.SQLException, DBException
rec
- The record to updateupdFldSet
- The set of fields to update
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static void grantDBUser(java.lang.String rootUser, java.lang.String rootPass) throws DBException, java.sql.SQLException
rootUser
- The root user accoountrootPass
- The root user password
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static java.lang.String getDefaultCharacterSet() throws DBException, java.sql.SQLException
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic static boolean isTableLockingEnabled()
public static int getLockLevel()
public static boolean lockTables(java.lang.String[] writeTables, java.lang.String[] readTables) throws DBException
writeTables
- The array of tables to lock for writingreadTables
- The array of tables to lock for reading
DBException
- If a database error occurspublic static boolean lockTableForRead(java.lang.String utableName, boolean forceLock) throws DBException
utableName
- The untranslated table to lock for readingforceLock
- If the lock query should be attemped whether or not
locking is enabled
DBException
- If a database error occurspublic static boolean unlockTables() throws DBException
DBException
- If a database error occurspublic int getID()
public java.lang.String getJDBCName()
public java.lang.String[] getDrivers()
public int getDefaultPort()
public org.opengts.dbtools.DBProvider.NameFilter getColumnNameFilter()
public org.opengts.dbtools.DBProvider.NameFilter getTableNameFilter()
public java.lang.String getTableIndexType()
public java.lang.String[] getSQLTypes()
public long getFlags()
public boolean supportsLimit()
public boolean supportsOffset()
public java.lang.String quoteColumnName(java.lang.String colName)
colName
- The column name
public java.lang.String quoteTableName(java.lang.String tblName)
tblName
- The column name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |