public class DBMSHandlerPostgreSQL extends DBMSHandlerBase
DBMSHandlerBase.DBMSBuilder, DBMSHandlerBase.DBMSCommand, DBMSHandlerBase.DBSeqTable
DBMSHandler.DBSetGenKeys
GENERAL_SQL_KEYWORDS, ILLEGAL_NAME_CHARS, reservedSQLKeywords, SEQUENCE_NAME_SUFFIX
Constructor and Description |
---|
DBMSHandlerPostgreSQL()
Constructor for the PostgreSQL database dbms.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addReservedKeyWord(String keyWord) |
void |
attachDatabase(DBDatabase db,
Connection conn)
Initialize Database on open
|
DBCommandPostgres |
createCommand(boolean autoPrepareStmt)
Creates a new PostgreSQL command object.
|
String |
getConvertPhrase(DataType destType,
DataType srcType,
Object format)
Returns a data type convertion phrase template for this dbms
The returned template must contain a '?' |
String |
getDatabaseName()
returns the name for the database / schema
|
PostgresDDLGenerator |
getDDLGenerator()
Returns the Postgres DDL Generator
|
void |
getDDLScript(DBDDLGenerator.DDLActionType type,
DBObject dbo,
DBSQLScript script)
Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.
|
Object |
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.
|
DBColumnExpr |
getNextSequenceValueExpr(DBTableColumn column)
Returns an expression for creating a sequence value.
|
Object |
getResultValue(ResultSet rset,
int columnIndex,
DataType dataType)
Postgre needs special handling for CLOBs and BLOB's
|
String |
getSQLPhrase(DBSqlPhrase phrase)
Gets an sql phrase template for this database system.
|
Timestamp |
getUpdateTimestamp(Connection conn)
Overridden.
|
protected void |
initSerialSequenceNames(DBDatabase db,
Connection conn)
Initializes the Sequence names of SERIAL and BIGSERIAL columns
|
boolean |
isSupported(DBMSFeature type)
Returns whether or not a particular feature is supported by this dbms
|
boolean |
isUsePostgresSerialType()
Returns whether or not the Postgres Serial Type is used for Identity columns
|
void |
setDatabaseName(String databaseName)
Sets the name for the database / schema
This names is required for creating a database. |
protected void |
setReservedKeywords() |
void |
setUsePostgresSerialType(boolean usePostgresSerialType)
Sets whether or not the Postgres Serial Type is used for Identity columns
|
addStatementParam, appendEnableRelationStmt, appendObjectName, checkExists, closeResultSet, closeStatement, createCombinedCommand, createModelChecker, createModelParser, createSQLBuilder, detachDatabase, detectQuoteName, executeBatch, executeQuery, executeSQL, extractErrorMessage, getColumnAutoValue, getColumnSequenceName, prepareStatement, querySingleValue
public DBMSHandlerPostgreSQL()
public String getDatabaseName()
public boolean isUsePostgresSerialType()
public void setUsePostgresSerialType(boolean usePostgresSerialType)
usePostgresSerialType
- true if Postgres Serial Type should be used or false if INTEGER should be usedpublic void setDatabaseName(String databaseName)
databaseName
- the name of the databasepublic void attachDatabase(DBDatabase db, Connection conn)
attachDatabase
in interface DBMSHandler
attachDatabase
in class DBMSHandlerBase
db
- the databaseconn
- the Jdbc connectionpublic DBCommandPostgres createCommand(boolean autoPrepareStmt)
createCommand
in interface DBMSHandler
createCommand
in class DBMSHandlerBase
autoPrepareStmt
- flag whether to automatically provide literal values as prepared statement paramspublic boolean isSupported(DBMSFeature type)
isSupported
in interface DBMSHandler
isSupported
in class DBMSHandlerBase
type
- type of requested feature. @see DBMSFeaturepublic String getSQLPhrase(DBSqlPhrase phrase)
phrase
- the identifier of the phraseDBMSHandler.getSQLPhrase(DBSqlPhrase)
public String getConvertPhrase(DataType destType, DataType srcType, Object format)
DBMSHandler
destType
- the target data typesrcType
- the source data typeformat
- additional formatting information (optional)DBMSHandler.getConvertPhrase(DataType, DataType, Object)
public Object getNextSequenceValue(DBDatabase db, String seqName, int minValue, Connection conn)
DBMSHandlerBase
getNextSequenceValue
in class DBMSHandlerBase
db
- the databaseseqName
- the name of the sequenceminValue
- the minimum value of the sequenceconn
- a valid database connectionDBMSHandlerBase.getNextSequenceValue(DBDatabase, String, int, Connection)
public DBColumnExpr getNextSequenceValueExpr(DBTableColumn column)
DBMSHandlerBase
getNextSequenceValueExpr
in class DBMSHandlerBase
column
- the column for which to obtain an expression providing the next sequence valueDBMSHandlerBase.getNextSequenceValueExpr(DBTableColumn col)
public Timestamp getUpdateTimestamp(Connection conn)
getUpdateTimestamp
in interface DBMSHandler
getUpdateTimestamp
in class DBMSHandlerBase
conn
- the connection that might be usedpublic PostgresDDLGenerator getDDLGenerator()
public void getDDLScript(DBDDLGenerator.DDLActionType type, DBObject dbo, DBSQLScript script)
DBMSHandler
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)DBMSHandler#getDDLScript(DDLActionType, DBObject, DBSQLScript)
public Object getResultValue(ResultSet rset, int columnIndex, DataType dataType) throws SQLException
getResultValue
in interface DBMSHandler
getResultValue
in class DBMSHandlerBase
rset
- the sql Resultset with the current data rowcolumnIndex
- one based column Index of the desired columndataType
- the required data typeSQLException
- if a database access error occursprotected void addReservedKeyWord(String keyWord)
protected void setReservedKeywords()
protected void initSerialSequenceNames(DBDatabase db, Connection conn)
db
- the database for which to set the sequence namesconn
- the connectionCopyright © 2008–2023 Apache Software Foundation. All rights reserved.