|
||||||||||
| 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.ColumnMetaDataInfo |
| Field Summary | |
|---|---|
static int |
TYPE_ENUM
the enum datatype. |
| Fields inherited from class com.sibvisions.rad.persist.jdbc.DBAccess |
|---|
logger, LONGNVARCHAR, NCHAR, NCLOB, NVARCHAR, QUOTE, SQLXML |
| Constructor Summary | |
|---|---|
PostgreSQLDBAccess()
Constructs a new OracleDBAccess Object. |
|
| Method Summary | |
|---|---|
protected Object |
convertDatabaseSpecificObjectToValue(ServerColumnMetaData pColumnMetaData,
Object pValue)
Enables the database specific implementation to handle/convert special objects. |
protected String |
createWhereColumn(ServerMetaData pServerMetaData,
CompareCondition pCompare,
String pColumnName)
Creates the where column. |
protected String |
createWhereParam(ServerMetaData pServerMetaData,
CompareCondition pCompare)
Creates the where parameter. |
SQLException |
formatSQLException(SQLException pSqlException)
Adds the SQL Error Code into the message of the SQL Exception. |
DBAccess.ColumnMetaDataInfo |
getColumnMetaData(String pFromClause,
String[] pQueryColumns,
String pBeforeQueryColumns,
String pWhereClause,
String pAfterWhereClause,
String pWritebackTable,
String[] pWritebackColumns)
Returns the meta data information for the specified query, and configures all columns with defaults. |
String |
getDatabaseSpecificLockStatement(String pWritebackTable,
ServerMetaData pServerMetaData,
ICondition pPKFilter)
Returns the database specific statement to lock the specified row in the database. |
Hashtable<String,Object> |
getDefaultValues(String pCatalog,
String pSchema,
String pTable)
Gets all default column values of a specific table. |
Object[] |
insertDatabaseSpecific(String pWritebackTable,
String pInsertStatement,
ServerMetaData pServerMetaData,
Object[] pNewDataRow,
String pDummyColumn)
Returns the newly inserted row from an Database specific insert statement. |
boolean |
isAutoQuote(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(PreparedStatement pInsert,
ServerColumnMetaData[] pServerColumnMetaData,
int[] iaWriteables,
Object[] pNew,
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. |
protected boolean |
setDatabaseSpecificType(ResultSetMetaData pMetaData,
int pColumnIndex,
ServerColumnMetaData pColumnMetaData)
Enables the database specific implementation to change the metadata before the default settings are made. |
void |
setUsername(String pUsername)
Sets the user name to connect with. |
protected Object |
translateDefaultValue(String pColumnName,
int pDataType,
String pDefaultValue)
Translates a default value from a column to the datatype object. |
| 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 String getDatabaseSpecificLockStatement(String pWritebackTable,
ServerMetaData pServerMetaData,
ICondition pPKFilter)
throws DataSourceException
getDatabaseSpecificLockStatement in class DBAccesspWritebackTable - 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 statement
public Object[] insertDatabaseSpecific(String pWritebackTable,
String pInsertStatement,
ServerMetaData pServerMetaData,
Object[] pNewDataRow,
String pDummyColumn)
throws DataSourceException
insertDatabaseSpecific in class DBAccesspWritebackTable - 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 storage
public Hashtable<String,Object> getDefaultValues(String pCatalog,
String pSchema,
String pTable)
throws DataSourceException
getDefaultValues in class DBAccesspCatalog - 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 exception
protected Object translateDefaultValue(String pColumnName,
int pDataType,
String pDefaultValue)
throws Exception
translateDefaultValue in class DBAccesspColumnName - the column name to translatepDataType - the datatype of the columnpDefaultValue - the original default value from the database
null if the default value is not valid
Exception - if the type translation causes an error or the datatype is not supportedpublic SQLException formatSQLException(SQLException pSqlException)
formatSQLException in class DBAccesspSqlException - the SQL Exception to use.
protected int setColumnsToStore(PreparedStatement pInsert,
ServerColumnMetaData[] pServerColumnMetaData,
int[] iaWriteables,
Object[] pNew,
Object[] pOld)
throws DataSourceException
PreparedStatement and returns the last used parameter index.
setColumnsToStore in class DBAccesspInsert - 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 PreparedStatementpublic boolean isAutoQuote(String pName)
DBAccess
isAutoQuote in class DBAccesspName - the name to quote.
public void setUsername(String pUsername)
DBAccess
setUsername in class DBAccesspUsername - the user name
public DBAccess.ColumnMetaDataInfo getColumnMetaData(String pFromClause,
String[] pQueryColumns,
String pBeforeQueryColumns,
String pWhereClause,
String pAfterWhereClause,
String pWritebackTable,
String[] pWritebackColumns)
throws DataSourceException
DBAccess
getColumnMetaData in class DBAccesspFromClause - 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 querypWritebackTable - the write back table to use for the isWriteable() state (Optional)pWritebackColumns - the write back columns 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 supported
protected Object convertDatabaseSpecificObjectToValue(ServerColumnMetaData pColumnMetaData,
Object pValue)
convertDatabaseSpecificObjectToValue in class DBAccesspColumnMetaData - the column metadatapValue - the read object
protected boolean setDatabaseSpecificType(ResultSetMetaData pMetaData,
int pColumnIndex,
ServerColumnMetaData pColumnMetaData)
throws SQLException
setDatabaseSpecificType in class DBAccesspMetaData - the metadata from the resultsetpColumnIndex - the column index in the resultset metadatapColumnMetaData - the newly created and pre-configured column metadata
true if column metadata are changed and the default settings should not be applied,
false to apply the standard settings
SQLException - if metadata access fails
protected String createWhereParam(ServerMetaData pServerMetaData,
CompareCondition pCompare)
createWhereParam in class DBAccesspServerMetaData - the server metadatapCompare - the compare condition
protected String createWhereColumn(ServerMetaData pServerMetaData,
CompareCondition pCompare,
String pColumnName)
createWhereColumn in class DBAccesspServerMetaData - 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 | |||||||||