Package ru.curs.celesta.dbutils.adaptors
Class OraAdaptor
- java.lang.Object
-
- ru.curs.celesta.dbutils.adaptors.DBAdaptor
-
- ru.curs.celesta.dbutils.adaptors.OraAdaptor
-
- All Implemented Interfaces:
StaticDataAdaptor
,QueryBuildingHelper
public final class OraAdaptor extends DBAdaptor
Oracle Database Adaptor.
-
-
Constructor Summary
Constructors Constructor Description OraAdaptor(ConnectionPool connectionPool, DdlConsumer ddlConsumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PreparedStatement
deleteRecordSetStatement(Connection conn, TableElement t, String where)
Creates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.String
getCallFunctionSql(ParameterizedView pv)
Prepares a function call expression.DbColumnInfo
getColumnInfo(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.int
getCurrentIdent(Connection conn, BasicTable t)
Returns current identity value for the table.int
getDBPid(Connection conn)
Returns process id of current database connection.PreparedStatement
getDeleteRecordStatement(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.String
getInFilterClause(DataGrainElement dge, DataGrainElement otherDge, List<String> fields, List<String> otherFields, String otherWhere)
PreparedStatement
getInsertRecordStatement(Connection conn, BasicTable t, boolean[] nullsMask, List<ParameterSetter> program)
Creates a PreparedStatement object for an INSERT statement to insert a record into a table.PreparedStatement
getNavigationStatement(Connection conn, FromClause from, String orderBy, String navigationWhereClause, Set<String> fields, long offset)
Returns navigable PreparedStatement by a filtered set of records.PreparedStatement
getOneFieldStatement(Connection conn, Column<?> c, String where)
Creates a PreparedStatement object for a SELECT statement of a single column containing at most one record.PreparedStatement
getOneRecordStatement(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.DbPkInfo
getPKInfo(Connection conn, TableElement t)
Returns information on the primary key of a table.DbSequenceInfo
getSequenceInfo(Connection conn, SequenceElement s)
Returns information on a sequence.DBType
getType()
Returns current database type.List<String>
getViewList(Connection conn, Grain g)
Returns list of view names in the grain.boolean
isValidConnection(Connection conn, int timeout)
Checking for connection validity.long
nextSequenceValue(Connection conn, SequenceElement s)
Retrieves next value from the sequence.boolean
nullsFirst()
Does RDBMS sort nulls first?String
pkConstraintString(TableElement tableElement)
Returns DB specific PK constraint name for a table element.ZonedDateTime
prepareZonedDateTimeForParameterSetter(Connection conn, ZonedDateTime z)
boolean
sequenceExists(Connection conn, String schema, String name)
Checks if sequence exists in the DB.String
sequenceString(String schemaName, String sequenceName)
Returns template by sequence name.boolean
tableExists(Connection conn, String schema, String name)
Checks if table exists in the DB.String
tableString(String schemaName, String tableName)
Returns template by table name.String
translateDate(String date)
Translates Celesta date literal to the one from specific database.boolean
triggerExists(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, createSysObjects, createTable, createTableTriggersForMaterializedViews, createView, dropFK, dropIndex, dropParameterizedView, dropPk, dropSequence, dropTable, dropTableTriggersForMaterializedViews, dropTrigger, dropView, executeNative, getRecordSetStatement, getSetCountStatement, getTriggerBody, getUpdateRecordStatement, getViewSQLGenerator, initDataForMaterializedView, selectStaticStrings, supportsCortegeComparing, updateColumn, updateVersioningTrigger, userTablesExist
-
-
-
-
Constructor Detail
-
OraAdaptor
public OraAdaptor(ConnectionPool connectionPool, DdlConsumer ddlConsumer)
-
-
Method Detail
-
tableExists
public boolean tableExists(Connection conn, String schema, String name)
Description copied from class:DBAdaptor
Checks if table exists in the DB.- Specified by:
tableExists
in classDBAdaptor
- Parameters:
conn
- DB connectionschema
- schema namename
- table name
-
getOneFieldStatement
public PreparedStatement getOneFieldStatement(Connection conn, Column<?> c, String where)
Description copied from class:DBAdaptor
Creates a PreparedStatement object for a SELECT statement of a single column containing at most one record.- Specified by:
getOneFieldStatement
in classDBAdaptor
- Parameters:
conn
- DB connectionc
- column to selectwhere
- WHERE condition
-
getOneRecordStatement
public PreparedStatement getOneRecordStatement(Connection conn, TableElement t, String where, Set<String> fields)
Description copied from class:DBAdaptor
Creates a PreparedStatement object for a SELECT statement containing at most one record.- Specified by:
getOneRecordStatement
in classDBAdaptor
- Parameters:
conn
- DB connectiont
- tablewhere
- WHERE conditionfields
- fields of selection
-
getInsertRecordStatement
public PreparedStatement getInsertRecordStatement(Connection conn, BasicTable t, boolean[] nullsMask, List<ParameterSetter> program)
Description copied from class:DBAdaptor
Creates a PreparedStatement object for an INSERT statement to insert a record into a table.- Specified by:
getInsertRecordStatement
in 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
-
getDeleteRecordStatement
public PreparedStatement getDeleteRecordStatement(Connection conn, TableElement t, String where)
Description copied from class:DBAdaptor
Creates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.- Specified by:
getDeleteRecordStatement
in classDBAdaptor
- Parameters:
conn
- DB connectiont
- tablewhere
- condition (can benull
)
-
getColumns
public Set<String> getColumns(Connection conn, TableElement t)
Description copied from class:DBAdaptor
Returns a set of column names for a specific table.- Overrides:
getColumns
in classDBAdaptor
- Parameters:
conn
- DB connectiont
- Table to look the columns in.
-
deleteRecordSetStatement
public PreparedStatement deleteRecordSetStatement(Connection conn, TableElement t, String where)
Description copied from class:DBAdaptor
Creates a PreparedStatement object for a DELETE statement for deleting a set of records that satisfy a condition.- Specified by:
deleteRecordSetStatement
in classDBAdaptor
- Parameters:
conn
- DB connectiont
- tablewhere
- condition
-
isValidConnection
public boolean isValidConnection(Connection conn, int timeout)
Description copied from class:DBAdaptor
Checking for connection validity.- Overrides:
isValidConnection
in classDBAdaptor
- Parameters:
conn
- connectiontimeout
- time-out- Returns:
true
if connection is valid, otherwisefalse
-
tableString
public String tableString(String schemaName, String tableName)
Description copied from class:DBAdaptor
Returns template by table name.- Overrides:
tableString
in classDBAdaptor
- Parameters:
schemaName
- schema nametableName
- table name
-
sequenceString
public String sequenceString(String schemaName, String sequenceName)
Description copied from class:DBAdaptor
Returns template by sequence name.- Overrides:
sequenceString
in classDBAdaptor
- Parameters:
schemaName
- schema namesequenceName
- sequence name
-
pkConstraintString
public String pkConstraintString(TableElement tableElement)
Description copied from class:DBAdaptor
Returns DB specific PK constraint name for a table element.- Overrides:
pkConstraintString
in classDBAdaptor
- Parameters:
tableElement
- table element
-
getCurrentIdent
public int getCurrentIdent(Connection conn, BasicTable t)
Description copied from class:DBAdaptor
Returns current identity value for the table.- Specified by:
getCurrentIdent
in classDBAdaptor
- Parameters:
conn
- DB connectiont
- table
-
getInFilterClause
public String getInFilterClause(DataGrainElement dge, DataGrainElement otherDge, List<String> fields, List<String> otherFields, String otherWhere)
-
getColumnInfo
public DbColumnInfo getColumnInfo(Connection conn, Column<?> c)
Description copied from class:DBAdaptor
Returns information on a column.- Specified by:
getColumnInfo
in classDBAdaptor
- Parameters:
conn
- DB connectionc
- column
-
getPKInfo
public DbPkInfo getPKInfo(Connection conn, TableElement t)
Description copied from class:DBAdaptor
Returns information on the primary key of a table.
-
getFKInfo
public List<DbFkInfo> getFKInfo(Connection conn, Grain g)
Description copied from class:DBAdaptor
Returns information on the foreign keys from grain.
-
getIndices
public Map<String,DbIndexInfo> getIndices(Connection conn, Grain g)
Description copied from class:DBAdaptor
Returns a set of indices referring to tables specified in the indicated grain.- Specified by:
getIndices
in classDBAdaptor
- Parameters:
conn
- DB connectiong
- Grain the tables of which have to be traversed for the indices.
-
getViewList
public List<String> getViewList(Connection conn, Grain g)
Description copied from class:DBAdaptor
Returns list of view names in the grain.- Overrides:
getViewList
in classDBAdaptor
- Parameters:
conn
- DB connectiong
- Grain for which the list of view names have to be returned.
-
getParameterizedViewList
public List<String> getParameterizedViewList(Connection conn, Grain g)
Description copied from class:DBAdaptor
Get names of existing parameterized views.- Specified by:
getParameterizedViewList
in classDBAdaptor
- Parameters:
conn
- connectiong
- current grain
-
getCallFunctionSql
public String getCallFunctionSql(ParameterizedView pv)
Description copied from class:DBAdaptor
Prepares a function call expression.- Overrides:
getCallFunctionSql
in classDBAdaptor
- Parameters:
pv
- current parameterized view
-
triggerExists
public boolean triggerExists(Connection conn, TriggerQuery query) throws SQLException
Description copied from class:DBAdaptor
Checks if trigger exists in the DB.- Specified by:
triggerExists
in classDBAdaptor
- Parameters:
conn
- DB connection.query
- trigger query parameters- Throws:
SQLException
- thrown if resulting query fails
-
getNavigationStatement
public PreparedStatement getNavigationStatement(Connection conn, FromClause from, String orderBy, String navigationWhereClause, Set<String> fields, long offset)
Description copied from class:DBAdaptor
Returns navigable PreparedStatement by a filtered set of records.- Specified by:
getNavigationStatement
in 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
-
translateDate
public String translateDate(String date)
Description copied from class:DBAdaptor
Translates Celesta date literal to the one from specific database.- Specified by:
translateDate
in interfaceQueryBuildingHelper
- Overrides:
translateDate
in classDBAdaptor
- Parameters:
date
- Date literal
-
getDBPid
public int getDBPid(Connection conn)
Description copied from class:DBAdaptor
Returns process id of current database connection.
-
prepareZonedDateTimeForParameterSetter
public ZonedDateTime prepareZonedDateTimeForParameterSetter(Connection conn, ZonedDateTime z)
- Specified by:
prepareZonedDateTimeForParameterSetter
in interfaceQueryBuildingHelper
- Overrides:
prepareZonedDateTimeForParameterSetter
in classDBAdaptor
-
nullsFirst
public boolean nullsFirst()
Description copied from interface:QueryBuildingHelper
Does RDBMS sort nulls first?
-
getType
public DBType getType()
Description copied from class:DBAdaptor
Returns current database type. E.g. H2, POSTGRESQL etc.
-
nextSequenceValue
public long nextSequenceValue(Connection conn, SequenceElement s)
Description copied from class:DBAdaptor
Retrieves next value from the sequence.- Specified by:
nextSequenceValue
in classDBAdaptor
- Parameters:
conn
- DB connections
- sequence
-
sequenceExists
public boolean sequenceExists(Connection conn, String schema, String name)
Description copied from class:DBAdaptor
Checks if sequence exists in the DB.- Specified by:
sequenceExists
in classDBAdaptor
- Parameters:
conn
- DB connectionschema
- schema namename
- sequence name
-
getSequenceInfo
public DbSequenceInfo getSequenceInfo(Connection conn, SequenceElement s)
Description copied from class:DBAdaptor
Returns information on a sequence.- Specified by:
getSequenceInfo
in classDBAdaptor
- Parameters:
conn
- DB connections
- sequence
-
-