Package org.apache.empire.dbms.sqlite
Class DBMSHandlerSQLite
java.lang.Object
org.apache.empire.dbms.DBMSHandlerBase
org.apache.empire.dbms.sqlite.DBMSHandlerSQLite
- All Implemented Interfaces:
DBMSHandler
This class provides support for the SQLite database system.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefines the SQLite command type.Nested classes/interfaces inherited from class org.apache.empire.dbms.DBMSHandlerBase
DBMSHandlerBase.DBMSBuilder, DBMSHandlerBase.DBMSCommand, DBMSHandlerBase.DBSeqTableNested classes/interfaces inherited from interface org.apache.empire.dbms.DBMSHandler
DBMSHandler.DBSetGenKeys -
Field Summary
FieldsFields inherited from class org.apache.empire.dbms.DBMSHandlerBase
GENERAL_SQL_KEYWORDS, ILLEGAL_NAME_CHARS, reservedSQLKeywords, SEQUENCE_NAME_SUFFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCommand(boolean autoPrepareStmt) Creates a new SQLite command object.intexecuteSQL(String sqlCmd, Object[] sqlParams, Connection conn, DBMSHandler.DBSetGenKeys genKeys) Override since conn.prepareStatement(sqlCmd, Statement.RETURN_GENERATED_KEYS) is not supported by SQLLite dbmsgetConvertPhrase(DataType destType, DataType srcType, Object format) Returns a data type convertion phrase template for this dbms
The returned template must contain a '?'voidgetDDLScript(DBDDLGenerator.DDLActionType type, DBObject dbo, DBSQLScript script) Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.getNextSequenceValue(DBDatabase db, String SeqName, int minValue, Connection conn) Returns the next value of a named sequence The numbers are used for fields of type DBExpr.DT_AUTOINC.
If a dbms supports this function it must return true for isSupported(DBMSFeature.SEQUENCES).Returns an expression for creating a sequence value.getResultValue(ResultSet rset, int columnIndex, DataType dataType) Reads a single column value from the given JDBC ResultSet and returns a value object of desired data type.
This gives the dbms the opportunity to change the value i.e. to simulate missing data types with other types.getSQLPhrase(DBSqlPhrase phrase) Gets an sql phrase template for this database system.getUpdateTimestamp(Connection conn) Overridden.booleanisSupported(DBMSFeature type) Returns whether or not a particular feature is supported by this dbmsMethods inherited from class org.apache.empire.dbms.DBMSHandlerBase
addSQLKeyword, addStatementParam, appendEnableRelationStmt, appendObjectName, attachDatabase, checkExists, closeResultSet, closeStatement, createCombinedCommand, createModelChecker, createModelParser, createSQLBuilder, detachDatabase, detectQuoteName, executeBatch, executeQuery, extractErrorMessage, getColumnAutoValue, getColumnSequenceName, getIgnoreCaseExpr, prepareStatement, querySingleValue
-
Field Details
-
SQLITE_KEYWORDS
-
-
Constructor Details
-
DBMSHandlerSQLite
public DBMSHandlerSQLite()Constructor for the SQLite database dbms.
-
-
Method Details
-
createCommand
Creates a new SQLite command object.- Specified by:
createCommandin interfaceDBMSHandler- Overrides:
createCommandin classDBMSHandlerBase- Parameters:
autoPrepareStmt- flag whether to automatically provide literal values as prepared statement params- Returns:
- the new DBCommandSQLite object
-
isSupported
Returns whether or not a particular feature is supported by this dbms- Specified by:
isSupportedin interfaceDBMSHandler- Specified by:
isSupportedin classDBMSHandlerBase- Parameters:
type- type of requested feature. @see DBMSFeature- Returns:
- true if the features is supported or false otherwise
-
getSQLPhrase
Gets an sql phrase template for this database system.- Parameters:
phrase- the identifier of the phrase- Returns:
- the phrase template
- See Also:
-
getConvertPhrase
Description copied from interface:DBMSHandlerReturns a data type convertion phrase template for this dbms
The returned template must contain a '?' which will be replaced by a column expression.- Parameters:
destType- the target data typesrcType- the source data typeformat- additional formatting information (optional)- Returns:
- the data conversion phrase template
- See Also:
-
executeSQL
public int executeSQL(String sqlCmd, Object[] sqlParams, Connection conn, DBMSHandler.DBSetGenKeys genKeys) throws SQLException Override since conn.prepareStatement(sqlCmd, Statement.RETURN_GENERATED_KEYS) is not supported by SQLLite dbms- Specified by:
executeSQLin interfaceDBMSHandler- Overrides:
executeSQLin classDBMSHandlerBase- Parameters:
sqlCmd- the SQL-CommandsqlParams- array of sql command parameters used for prepared statements (Optional).conn- a valid connection to the database.genKeys- allows to set the auto generated key of a record (INSERT statements only)- Returns:
- the row count for insert, update or delete or 0 for SQL statements that return nothing
- Throws:
SQLException- if a database access error occurs
-
getResultValue
public Object getResultValue(ResultSet rset, int columnIndex, DataType dataType) throws SQLException Description copied from class:DBMSHandlerBaseReads a single column value from the given JDBC ResultSet and returns a value object of desired data type.
This gives the dbms the opportunity to change the value i.e. to simulate missing data types with other types.- Specified by:
getResultValuein interfaceDBMSHandler- Overrides:
getResultValuein classDBMSHandlerBase- Parameters:
rset- the sql Resultset with the current data rowcolumnIndex- one based column Index of the desired columndataType- the required data type- Returns:
- the value of the Column
- Throws:
SQLException- if a database access error occurs
-
getUpdateTimestamp
Overridden. Returns a timestamp that is used for record updates created by the database server.- Specified by:
getUpdateTimestampin interfaceDBMSHandler- Overrides:
getUpdateTimestampin classDBMSHandlerBase- Parameters:
conn- the connection that might be used- Returns:
- the current date and time of the database server.
-
getDDLScript
Description copied from interface:DBMSHandlerAppends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.- Parameters:
type- operation to perform (CREATE, DROP, ALTER)dbo- the object for which to perform the operation (DBDatabase, DBTable, DBView, DBColumn, DBRelation)script- the script to which to add the DDL command(s)- See Also:
-
getNextSequenceValue
Description copied from class:DBMSHandlerBaseReturns the next value of a named sequence The numbers are used for fields of type DBExpr.DT_AUTOINC.
If a dbms supports this function it must return true for isSupported(DBMSFeature.SEQUENCES).- Specified by:
getNextSequenceValuein classDBMSHandlerBase- Parameters:
db- the databaseSeqName- the name of the sequenceminValue- the minimum value of the sequenceconn- a valid database connection- Returns:
- a new unique sequence value or null if an error occurred
-
getNextSequenceValueExpr
Description copied from class:DBMSHandlerBaseReturns an expression for creating a sequence value. This is intended for the use with INSERT INTO statements where many records are affected.- Specified by:
getNextSequenceValueExprin classDBMSHandlerBase- Parameters:
column- the column for which to obtain an expression providing the next sequence value- Returns:
- an expression for the next sequence value
- See Also:
-