|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.persist.jdbc.DBAccess
com.sibvisions.rad.persist.jdbc.PostgreSQLDBAccess
public class PostgreSQLDBAccess
The PostgreSQLDBAccess
is the implementation for Postgres databases.
DBAccess
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.sibvisions.rad.persist.jdbc.DBAccess |
---|
DBAccess.BlobFileHandle, DBAccess.ParameterizedStatement |
Field Summary | |
---|---|
static int |
TYPE_ENUM
the enum datatype. |
Fields inherited from class com.sibvisions.rad.persist.jdbc.DBAccess |
---|
BFILE, LONGNVARCHAR, NCHAR, NCLOB, NVARCHAR, QUOTE, SQLXML, TIMESTAMPWITHLOCALTIMEZONE, TIMESTAMPWITHTIMEZONE |
Constructor Summary | |
---|---|
PostgreSQLDBAccess()
Constructs a new OracleDBAccess Object. |
Method Summary | |
---|---|
protected java.lang.Object |
convertDatabaseSpecificObjectToValue(ServerColumnMetaData pColumnMetaData,
java.lang.Object pValue)
Enables the database specific implementation to handle/convert special objects. |
protected java.lang.String |
createWhereColumn(ServerMetaData pServerMetaData,
CompareCondition pCompare,
java.lang.String pColumnName)
Creates the where column. |
protected java.lang.String |
createWhereParam(ServerMetaData pServerMetaData,
CompareCondition pCompare)
Creates the where parameter. |
java.sql.SQLException |
formatSQLException(java.sql.SQLException pSqlException)
Adds the SQL Error Code into the message of the SQL Exception. |
protected ServerColumnMetaData[] |
getColumnMetaDataIntern(java.lang.String pFromClause,
java.lang.String[] pQueryColumns,
java.lang.String pBeforeQueryColumns,
java.lang.String pWhereClause,
java.lang.String pAfterWhereClause)
Returns the meta data information for the specified query, and configures all columns with defaults. |
java.lang.String |
getDatabaseSpecificLockStatement(java.lang.String pWritebackTable,
ServerMetaData pServerMetaData,
ICondition pPKFilter)
Returns the database specific statement to lock the specified row in the database. |
protected java.util.Map<java.lang.String,java.lang.Object> |
getDefaultValuesIntern(java.lang.String pCatalog,
java.lang.String pSchema,
java.lang.String pTable)
Gets all default column values of a specific table. |
protected TableInfo |
getTableInfoIntern(java.lang.String pWriteBackTable)
Returns the meta data information for the specified query, and configures all columns with defaults. |
protected void |
initializeDataType(java.sql.ResultSetMetaData pResultSetMetaData,
int pResultSetColumnIndex,
ColumnMetaData pColumnMetaData)
Initializes the datatype data of the ColumnMetaData with the given ResultSetMetaData . |
java.lang.Object[] |
insertDatabaseSpecific(java.lang.String pWritebackTable,
java.lang.String pInsertStatement,
ServerMetaData pServerMetaData,
java.lang.Object[] pNewDataRow,
java.lang.String pDummyColumn)
Returns the newly inserted row from a Database specific insert statement. |
boolean |
isAutoQuote(java.lang.String pName)
It returns true if this name should be automated quoted. |
protected boolean |
isEnum(ServerColumnMetaData pColumnMetaData)
Gets whether the given column has an enum as datatype. |
protected int |
setColumnsToStore(java.sql.PreparedStatement pInsert,
ServerColumnMetaData[] pServerColumnMetaData,
int[] iaWriteables,
java.lang.Object[] pNew,
java.lang.Object[] pOld)
Sets the values of all changed columns to store from the value Object[]s into the PreparedStatement and returns the last used parameter index. |
void |
setUsername(java.lang.String pUsername)
Sets the user name to connect with. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_ENUM
Constructor Detail |
---|
public PostgreSQLDBAccess()
Method Detail |
---|
public java.lang.String getDatabaseSpecificLockStatement(java.lang.String pWritebackTable, ServerMetaData pServerMetaData, ICondition pPKFilter) throws DataSourceException
getDatabaseSpecificLockStatement
in class DBAccess
pWritebackTable
- the table to use.pServerMetaData
- the MetaDataColumn array to use.pPKFilter
- the PK filter with the values to use.
DataSourceException
- if some parts are missing for the statementpublic java.lang.Object[] insertDatabaseSpecific(java.lang.String pWritebackTable, java.lang.String pInsertStatement, ServerMetaData pServerMetaData, java.lang.Object[] pNewDataRow, java.lang.String pDummyColumn) throws DataSourceException
insertDatabaseSpecific
in class DBAccess
pWritebackTable
- the table to use for the insertpInsertStatement
- the SQL Statement to use for the insertpServerMetaData
- the meta data to use.pNewDataRow
- the new row (Object[]) with the values to insertpDummyColumn
- null
, if all writeable columns are null, but for a correct INSERT it have
to be minimum one column to use in the syntax.
DataSourceException
- if an Exception
occur during insert to the storageprotected java.util.Map<java.lang.String,java.lang.Object> getDefaultValuesIntern(java.lang.String pCatalog, java.lang.String pSchema, java.lang.String pTable) throws DataSourceException
getDefaultValuesIntern
in class DBAccess
pCatalog
- the catalog namepSchema
- the schema namepTable
- the table name
Hashtable
with the column name as key and the default value as value. It only contains columns
with a default value
DataSourceException
- if the database access throws an exceptionpublic java.sql.SQLException formatSQLException(java.sql.SQLException pSqlException)
formatSQLException
in class DBAccess
pSqlException
- the SQL Exception to use.
protected int setColumnsToStore(java.sql.PreparedStatement pInsert, ServerColumnMetaData[] pServerColumnMetaData, int[] iaWriteables, java.lang.Object[] pNew, java.lang.Object[] pOld) throws DataSourceException
PreparedStatement
and returns the last used parameter index.
setColumnsToStore
in class DBAccess
pInsert
- the PreparedStatement
to initializepServerColumnMetaData
- the column meta data to use.iaWriteables
- the writable columns as int index arraypNew
- the new values Object[]pOld
- the old values Object[]
PreparedStatement
.
DataSourceException
- if the values can't set into the PreparedStatement
public boolean isAutoQuote(java.lang.String pName)
DBAccess
isAutoQuote
in class DBAccess
pName
- the name to quote.
public void setUsername(java.lang.String pUsername)
DBAccess
setUsername
in class DBAccess
pUsername
- the user nameprotected ServerColumnMetaData[] getColumnMetaDataIntern(java.lang.String pFromClause, java.lang.String[] pQueryColumns, java.lang.String pBeforeQueryColumns, java.lang.String pWhereClause, java.lang.String pAfterWhereClause) throws DataSourceException
DBAccess
getColumnMetaDataIntern
in class DBAccess
pFromClause
- the from clause with query tables and join definitionspQueryColumns
- the query columnspBeforeQueryColumns
- the before query columnspWhereClause
- the last where condition in querypAfterWhereClause
- the after where clause in query
DataSourceException
- if an Exception
occur during getting the meta data or
if the storage is not opened or
if one columns SQL type is not supportedprotected TableInfo getTableInfoIntern(java.lang.String pWriteBackTable) throws DataSourceException
getTableInfoIntern
in class DBAccess
pWriteBackTable
- the write back table to use for the isWriteable() state (Optional)
DataSourceException
- if an Exception
occur during getting the meta data or
if the storage is not opened or
if one columns SQL type is not supportedprotected java.lang.Object convertDatabaseSpecificObjectToValue(ServerColumnMetaData pColumnMetaData, java.lang.Object pValue) throws java.sql.SQLException
convertDatabaseSpecificObjectToValue
in class DBAccess
pColumnMetaData
- the column metadatapValue
- the read object
java.sql.SQLException
- if it fails.protected void initializeDataType(java.sql.ResultSetMetaData pResultSetMetaData, int pResultSetColumnIndex, ColumnMetaData pColumnMetaData) throws java.sql.SQLException, DataSourceException
ColumnMetaData
with the given ResultSetMetaData
.
initializeDataType
in class DBAccess
pResultSetMetaData
- the result set meta data.pResultSetColumnIndex
- the column index.pColumnMetaData
- the ColumnMetaData
java.sql.SQLException
- if an unwanted SQLException occurs
DataSourceException
- if an know problem occurs during creationprotected java.lang.String createWhereParam(ServerMetaData pServerMetaData, CompareCondition pCompare)
createWhereParam
in class DBAccess
pServerMetaData
- the server metadatapCompare
- the compare condition
protected java.lang.String createWhereColumn(ServerMetaData pServerMetaData, CompareCondition pCompare, java.lang.String pColumnName)
createWhereColumn
in class DBAccess
pServerMetaData
- the server metadatapCompare
- the compare conditionpColumnName
- the column name to use
protected boolean isEnum(ServerColumnMetaData pColumnMetaData) throws DataSourceException
pColumnMetaData
- the column metadata
true
if the column has an enum datatype, false
otherwise
DataSourceException
- if enum detection fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |