Package ru.curs.celesta.dbutils.adaptors
Class FirebirdAdaptor
- java.lang.Object
-
- ru.curs.celesta.dbutils.adaptors.DBAdaptor
-
- ru.curs.celesta.dbutils.adaptors.FirebirdAdaptor
-
- All Implemented Interfaces:
StaticDataAdaptor,QueryBuildingHelper
public final class FirebirdAdaptor extends DBAdaptor
FirebirdAdaptor.- Author:
- ioanngolovko
-
-
Constructor Summary
Constructors Constructor Description FirebirdAdaptor(ConnectionPool connectionPool, DdlConsumer ddlConsumer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateSysObjects(Connection conn, String sysSchemaName)Creates or recreates other system objects (stored procedures, functions) needed for Celesta functioning on current RDBMS.PreparedStatementdeleteRecordSetStatement(Connection conn, TableElement t, String where)Creates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.voiddropSequence(Connection conn, SequenceElement s)Drops sequence from the database.DbColumnInfogetColumnInfo(Connection conn, Column<?> c)Returns information on a column.Set<String>getColumns(Connection conn, TableElement t)Returns a set of column names for a specific table.intgetCurrentIdent(Connection conn, BasicTable t)Returns current identity value for the table.intgetDBPid(Connection conn)Returns process id of current database connection.PreparedStatementgetDeleteRecordStatement(Connection conn, TableElement t, String where)Creates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.List<DbFkInfo>getFKInfo(Connection conn, Grain g)Returns information on the foreign keys from grain.Map<String,DbIndexInfo>getIndices(Connection conn, Grain g)Returns a set of indices referring to tables specified in the indicated grain.StringgetInFilterClause(DataGrainElement dge, DataGrainElement otherDge, List<String> fields, List<String> otherFields, String whereForOtherTable)PreparedStatementgetInsertRecordStatement(Connection conn, BasicTable t, boolean[] nullsMask, List<ParameterSetter> program)Creates a PreparedStatement object for an INSERT statement to insert a record into a table.PreparedStatementgetNavigationStatement(Connection conn, FromClause from, String orderBy, String navigationWhereClause, Set<String> fields, long offset)Returns navigable PreparedStatement by a filtered set of records.PreparedStatementgetOneFieldStatement(Connection conn, Column<?> c, String where)Creates a PreparedStatement object for a SELECT statement of a single column containing at most one record.PreparedStatementgetOneRecordStatement(Connection conn, TableElement t, String where, Set<String> fields)Creates a PreparedStatement object for a SELECT statement containing at most one record.List<String>getParameterizedViewList(Connection conn, Grain g)Get names of existing parameterized views.DbPkInfogetPKInfo(Connection conn, TableElement t)Returns information on the primary key of a table.DbSequenceInfogetSequenceInfo(Connection conn, SequenceElement s)Returns information on a sequence.DBTypegetType()Returns current database type.List<String>getViewList(Connection conn, Grain g)Returns list of view names in the grain.longnextSequenceValue(Connection conn, SequenceElement s)Retrieves next value from the sequence.booleannullsFirst()Does RDBMS sort nulls first?StringpkConstraintString(TableElement tableElement)Returns DB specific PK constraint name for a table element.ZonedDateTimeprepareZonedDateTimeForParameterSetter(Connection conn, ZonedDateTime z)static StringsequenceCurValueProcString(String schemaName, String sequenceName)booleansequenceExists(Connection conn, String schema, String name)Checks if sequence exists in the DB.static StringsequenceNextValueProcString(String schemaName, String sequenceName)StringsequenceString(String schemaName, String sequenceName)Returns template by sequence name.booleantableExists(Connection conn, String schema, String name)Checks if table exists in the DB.StringtableString(String schemaName, String tableName)Returns template by table name.booleantriggerExists(Connection conn, TriggerQuery query)Checks if trigger exists in the DB.-
Methods inherited from class ru.curs.celesta.dbutils.adaptors.DBAdaptor
alterSequence, compareStrings, createColumn, createFK, createIndex, createParameterizedView, createPK, createSchemaIfNotExists, createSequence, createTable, createTableTriggersForMaterializedViews, createView, dropFK, dropIndex, dropParameterizedView, dropPk, dropTable, dropTableTriggersForMaterializedViews, dropTrigger, dropView, executeNative, getCallFunctionSql, getRecordSetStatement, getSetCountStatement, getTriggerBody, getUpdateRecordStatement, getViewSQLGenerator, initDataForMaterializedView, isValidConnection, selectStaticStrings, supportsCortegeComparing, translateDate, updateColumn, updateVersioningTrigger, userTablesExist
-
-
-
-
Constructor Detail
-
FirebirdAdaptor
public FirebirdAdaptor(ConnectionPool connectionPool, DdlConsumer ddlConsumer)
-
-
Method Detail
-
getNavigationStatement
public PreparedStatement getNavigationStatement(Connection conn, FromClause from, String orderBy, String navigationWhereClause, Set<String> fields, long offset)
Description copied from class:DBAdaptorReturns navigable PreparedStatement by a filtered set of records.- Specified by:
getNavigationStatementin classDBAdaptor- Parameters:
conn- Connectionfrom- From clauseorderBy- Sorting order (ascending or descending)navigationWhereClause- Navigable set condition (from current record)fields- Fields of selectionoffset- First record offset
-
tableExists
public boolean tableExists(Connection conn, String schema, String name)
Description copied from class:DBAdaptorChecks if table exists in the DB.- Specified by:
tableExistsin classDBAdaptor- Parameters:
conn- DB connectionschema- schema namename- table name
-
triggerExists
public boolean triggerExists(Connection conn, TriggerQuery query) throws SQLException
Description copied from class:DBAdaptorChecks if trigger exists in the DB.- Specified by:
triggerExistsin classDBAdaptor- Parameters:
conn- DB connection.query- trigger query parameters- Throws:
SQLException- thrown if resulting query fails
-
getColumns
public Set<String> getColumns(Connection conn, TableElement t)
Description copied from class:DBAdaptorReturns a set of column names for a specific table.- Overrides:
getColumnsin classDBAdaptor- Parameters:
conn- DB connectiont- Table to look the columns in.
-
getOneRecordStatement
public PreparedStatement getOneRecordStatement(Connection conn, TableElement t, String where, Set<String> fields)
Description copied from class:DBAdaptorCreates a PreparedStatement object for a SELECT statement containing at most one record.- Specified by:
getOneRecordStatementin classDBAdaptor- Parameters:
conn- DB connectiont- tablewhere- WHERE conditionfields- fields of selection
-
getOneFieldStatement
public PreparedStatement getOneFieldStatement(Connection conn, Column<?> c, String where)
Description copied from class:DBAdaptorCreates a PreparedStatement object for a SELECT statement of a single column containing at most one record.- Specified by:
getOneFieldStatementin classDBAdaptor- Parameters:
conn- DB connectionc- column to selectwhere- WHERE condition
-
deleteRecordSetStatement
public PreparedStatement deleteRecordSetStatement(Connection conn, TableElement t, String where)
Description copied from class:DBAdaptorCreates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.- Specified by:
deleteRecordSetStatementin classDBAdaptor- Parameters:
conn- DB connectiont- tablewhere- condition
-
getInsertRecordStatement
public PreparedStatement getInsertRecordStatement(Connection conn, BasicTable t, boolean[] nullsMask, List<ParameterSetter> program)
Description copied from class:DBAdaptorCreates a PreparedStatement object for an INSERT statement to insert a record into a table.- Specified by:
getInsertRecordStatementin classDBAdaptor- Parameters:
conn- DB connectiont- tablenullsMask- null-flags (if set the corresponding field at n-th position becomesnull)program- collects parameters that can be set with the query
-
getCurrentIdent
public int getCurrentIdent(Connection conn, BasicTable t)
Description copied from class:DBAdaptorReturns current identity value for the table.- Specified by:
getCurrentIdentin classDBAdaptor- Parameters:
conn- DB connectiont- table
-
getDeleteRecordStatement
public PreparedStatement getDeleteRecordStatement(Connection conn, TableElement t, String where)
Description copied from class:DBAdaptorCreates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.- Specified by:
getDeleteRecordStatementin classDBAdaptor- Parameters:
conn- DB connectiont- tablewhere- condition (can benull)
-
getColumnInfo
public DbColumnInfo getColumnInfo(Connection conn, Column<?> c)
Description copied from class:DBAdaptorReturns information on a column.- Specified by:
getColumnInfoin classDBAdaptor- Parameters:
conn- DB connectionc- column
-
getPKInfo
public DbPkInfo getPKInfo(Connection conn, TableElement t)
Description copied from class:DBAdaptorReturns information on the primary key of a table.
-
getFKInfo
public List<DbFkInfo> getFKInfo(Connection conn, Grain g)
Description copied from class:DBAdaptorReturns information on the foreign keys from grain.
-
getIndices
public Map<String,DbIndexInfo> getIndices(Connection conn, Grain g)
Description copied from class:DBAdaptorReturns a set of indices referring to tables specified in the indicated grain.- Specified by:
getIndicesin classDBAdaptor- Parameters:
conn- DB connectiong- Grain the tables of which have to be traversed for the indices.
-
getParameterizedViewList
public List<String> getParameterizedViewList(Connection conn, Grain g)
Description copied from class:DBAdaptorGet names of existing parameterized views.- Specified by:
getParameterizedViewListin classDBAdaptor- Parameters:
conn- connectiong- current grain
-
getDBPid
public int getDBPid(Connection conn)
Description copied from class:DBAdaptorReturns process id of current database connection.
-
getType
public DBType getType()
Description copied from class:DBAdaptorReturns current database type. E.g. H2, POSTGRESQL etc.
-
nextSequenceValue
public long nextSequenceValue(Connection conn, SequenceElement s)
Description copied from class:DBAdaptorRetrieves next value from the sequence.- Specified by:
nextSequenceValuein classDBAdaptor- Parameters:
conn- DB connections- sequence
-
prepareZonedDateTimeForParameterSetter
public ZonedDateTime prepareZonedDateTimeForParameterSetter(Connection conn, ZonedDateTime z)
- Specified by:
prepareZonedDateTimeForParameterSetterin interfaceQueryBuildingHelper- Overrides:
prepareZonedDateTimeForParameterSetterin classDBAdaptor
-
dropSequence
public void dropSequence(Connection conn, SequenceElement s)
Description copied from class:DBAdaptorDrops sequence from the database.- Overrides:
dropSequencein classDBAdaptor- Parameters:
conn- DB connections- sequence element
-
sequenceCurValueProcString
public static String sequenceCurValueProcString(String schemaName, String sequenceName)
-
sequenceNextValueProcString
public static String sequenceNextValueProcString(String schemaName, String sequenceName)
-
sequenceExists
public boolean sequenceExists(Connection conn, String schema, String name)
Description copied from class:DBAdaptorChecks if sequence exists in the DB.- Specified by:
sequenceExistsin classDBAdaptor- Parameters:
conn- DB connectionschema- schema namename- sequence name
-
getSequenceInfo
public DbSequenceInfo getSequenceInfo(Connection conn, SequenceElement s)
Description copied from class:DBAdaptorReturns information on a sequence.- Specified by:
getSequenceInfoin classDBAdaptor- Parameters:
conn- DB connections- sequence
-
nullsFirst
public boolean nullsFirst()
Description copied from interface:QueryBuildingHelperDoes RDBMS sort nulls first?
-
getInFilterClause
public String getInFilterClause(DataGrainElement dge, DataGrainElement otherDge, List<String> fields, List<String> otherFields, String whereForOtherTable)
-
createSysObjects
public void createSysObjects(Connection conn, String sysSchemaName)
Description copied from class:DBAdaptorCreates or recreates other system objects (stored procedures, functions) needed for Celesta functioning on current RDBMS.- Overrides:
createSysObjectsin classDBAdaptor- Parameters:
conn- DB connectionsysSchemaName- system schema name
-
getViewList
public List<String> getViewList(Connection conn, Grain g)
Description copied from class:DBAdaptorReturns list of view names in the grain.- Overrides:
getViewListin classDBAdaptor- Parameters:
conn- DB connectiong- Grain for which the list of view names have to be returned.
-
tableString
public String tableString(String schemaName, String tableName)
Description copied from class:DBAdaptorReturns template by table name.- Overrides:
tableStringin classDBAdaptor- Parameters:
schemaName- schema nametableName- table name
-
pkConstraintString
public String pkConstraintString(TableElement tableElement)
Description copied from class:DBAdaptorReturns DB specific PK constraint name for a table element.- Overrides:
pkConstraintStringin classDBAdaptor- Parameters:
tableElement- table element
-
-