Package ru.curs.celesta.dbutils.adaptors
Class PostgresAdaptor
- java.lang.Object
-
- ru.curs.celesta.dbutils.adaptors.DBAdaptor
-
- ru.curs.celesta.dbutils.adaptors.OpenSourceDbAdaptor
-
- ru.curs.celesta.dbutils.adaptors.PostgresAdaptor
-
- All Implemented Interfaces:
StaticDataAdaptor
,QueryBuildingHelper
public final class PostgresAdaptor extends OpenSourceDbAdaptor
Postgres adaptor.
-
-
Constructor Summary
Constructors Constructor Description PostgresAdaptor(ConnectionPool connectionPool, DdlConsumer ddlConsumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createSysObjects(Connection conn, String sysSchemaName)
Creates or recreates other system objects (stored procedures, functions) needed for Celesta functioning on current RDBMS.DbColumnInfo
getColumnInfo(Connection conn, Column<?> c)
Returns information on a column.int
getCurrentIdent(Connection conn, BasicTable t)
Returns current identity value for the table.int
getDBPid(Connection conn)
Returns process id of current database connection.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.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.ZonedDateTime
prepareZonedDateTimeForParameterSetter(Connection conn, ZonedDateTime z)
boolean
supportsCortegeComparing()
Whether DB supports cortege comparing.boolean
triggerExists(Connection conn, TriggerQuery query)
Checks if trigger exists in the DB.-
Methods inherited from class ru.curs.celesta.dbutils.adaptors.OpenSourceDbAdaptor
deleteRecordSetStatement, getColumns, getDeleteRecordStatement, getNavigationStatement, getOneFieldStatement, getOneRecordStatement, nextSequenceValue, nullsFirst, sequenceExists, tableExists
-
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, dropSequence, dropTable, dropTableTriggersForMaterializedViews, dropTrigger, dropView, executeNative, getCallFunctionSql, getRecordSetStatement, getSetCountStatement, getTriggerBody, getUpdateRecordStatement, getViewList, getViewSQLGenerator, initDataForMaterializedView, isValidConnection, pkConstraintString, selectStaticStrings, sequenceString, tableString, translateDate, updateColumn, updateVersioningTrigger, userTablesExist
-
-
-
-
Constructor Detail
-
PostgresAdaptor
public PostgresAdaptor(ConnectionPool connectionPool, DdlConsumer ddlConsumer)
-
-
Method Detail
-
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
-
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
-
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
-
getInFilterClause
public String getInFilterClause(DataGrainElement dge, DataGrainElement otherDge, List<String> fields, List<String> otherFields, String otherWhere)
-
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
-
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.
-
createSysObjects
public void createSysObjects(Connection conn, String sysSchemaName)
Description copied from class:DBAdaptor
Creates or recreates other system objects (stored procedures, functions) needed for Celesta functioning on current RDBMS.- Overrides:
createSysObjects
in classDBAdaptor
- Parameters:
conn
- DB connectionsysSchemaName
- system schema name
-
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
-
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
-
getType
public DBType getType()
Description copied from class:DBAdaptor
Returns current database type. E.g. H2, POSTGRESQL etc.
-
supportsCortegeComparing
public boolean supportsCortegeComparing()
Description copied from class:DBAdaptor
Whether DB supports cortege comparing.- Specified by:
supportsCortegeComparing
in interfaceQueryBuildingHelper
- Overrides:
supportsCortegeComparing
in classDBAdaptor
- Returns:
-
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
-
-