|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.commons.ErrorObject
org.apache.empire.db.DBDatabaseDriver
org.apache.empire.db.postgresql.DBDatabaseDriverPostgreSQL
public class DBDatabaseDriverPostgreSQL
This class provides support for the PostgreSQL database system.
Nested Class Summary | |
---|---|
static class |
DBDatabaseDriverPostgreSQL.DBCommandPostreSQL
Defines the PostgreSQL command type. |
Nested classes/interfaces inherited from class org.apache.empire.db.DBDatabaseDriver |
---|
DBDatabaseDriver.DBSeqTable, DBDatabaseDriver.DBSetGenKeys |
Nested classes/interfaces inherited from class org.apache.empire.commons.ErrorObject |
---|
ErrorObject.ObjectErrorInfo |
Field Summary |
---|
Constructor Summary | |
---|---|
DBDatabaseDriverPostgreSQL()
Constructor for the PostgreSQL database driver. |
Method Summary | |
---|---|
protected boolean |
alterTable(DBTableColumn col,
DBCmdType type,
DBSQLScript script)
Creates an alter table dll statement for adding, modifiying or droping a column. |
protected boolean |
appendColumnDesc(DBTableColumn c,
java.lang.StringBuilder sql,
boolean alter)
Appends a table column definition to a ddl statement http://www.postgresql.org/docs/8.3/static/datatype.html |
DBCommand |
createCommand(DBDatabase db)
Creates a new PostgreSQL command object. |
protected boolean |
createDatabase(DBDatabase db,
DBSQLScript script)
|
protected boolean |
createRelation(DBRelation r,
DBSQLScript script)
Returns true if the relation has been created successfully. |
boolean |
createReverseFunction(java.sql.Connection conn)
Creates the reverse function in postgre sql that returns the reverse of a string value. |
protected boolean |
createSequence(DBDatabase db,
DBTableColumn c,
DBSQLScript script)
Returns true if the sequence has been created successfully. |
protected java.lang.String |
createSequenceName(DBTableColumn c)
|
protected boolean |
createTable(DBTable t,
DBSQLScript script)
Returns true if the table has been created successfully. |
protected boolean |
createView(DBView v,
DBSQLScript script)
Returns true if the view has been created successfully. |
protected boolean |
dropObject(java.lang.String name,
java.lang.String objType,
DBSQLScript script)
Returns true if the object has been dropped successfully. |
java.lang.String |
getConvertPhrase(DataType destType,
DataType srcType,
java.lang.Object format)
Returns a data type convertion phrase template for this driver The returned template must contain a '?' which will be replaced by a column expression. |
java.lang.String |
getDatabaseName()
returns the name for the database / schema |
boolean |
getDDLScript(DBCmdType type,
DBObject dbo,
DBSQLScript script)
Gets a SQL command for creating, modifying or deleting objects in the database (tables, columns, constraints, etc.) |
java.lang.Object |
getNextSequenceValue(DBDatabase db,
java.lang.String seqName,
int minValue,
java.sql.Connection conn)
Returns the next value of a named sequence The numbers are used for fields of type DBExpr.DT_AUTOINC. If a driver supports this function it must return true for isSupported(DBDriverFeature.SEQUENCES). |
java.lang.String |
getSQLPhrase(int phrase)
Gets an sql phrase template for this database system. |
java.sql.Timestamp |
getUpdateTimestamp(java.sql.Connection conn)
Overridden. |
boolean |
isSupported(DBDriverFeature type)
Returns whether or not a particular feature is supported by this driver |
void |
setDatabaseName(java.lang.String databaseName)
Sets the name for the database / schema This names is required for creating a database. When a name is set, the driver will automatically execute 'USE dbname' when the database is opened. |
Methods inherited from class org.apache.empire.db.DBDatabaseDriver |
---|
appendElementName, appendElementName, appendTextValue, attachDatabase, checkDatabase, close, detachDatabase, detectQuoteName, executeQuery, executeSQL, extractErrorMessage, getColumnAutoValue, getDateTimeString, getResultValue, getValueString, isDDLColumnDefaults, prepareStatement, setDDLColumnDefaults |
Methods inherited from class org.apache.empire.commons.ErrorObject |
---|
clearError, clearErrorInfo, error, error, error, error, error, getErrorInfo, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, internalSetError, isExceptionsEnabled, setExceptionsEnabled, success |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBDatabaseDriverPostgreSQL()
Method Detail |
---|
public java.lang.String getDatabaseName()
public void setDatabaseName(java.lang.String databaseName)
databaseName
- the name of the databasepublic boolean createReverseFunction(java.sql.Connection conn)
conn
- a valid database connection
public DBCommand createCommand(DBDatabase db)
createCommand
in class DBDatabaseDriver
db
- the database for which to create a command object for
public boolean isSupported(DBDriverFeature type)
isSupported
in class DBDatabaseDriver
type
- type of requrested feature. @see DBDriverFeature
public java.lang.String getSQLPhrase(int phrase)
getSQLPhrase
in class DBDatabaseDriver
phrase
- the identifier of the phrase
DBDatabaseDriver.getSQLPhrase(int)
public java.lang.String getConvertPhrase(DataType destType, DataType srcType, java.lang.Object format)
DBDatabaseDriver
getConvertPhrase
in class DBDatabaseDriver
destType
- the target data typesrcType
- the source data typeformat
- additional formatting information (optional)
DBDatabaseDriver.getConvertPhrase(DataType, DataType, Object)
public java.lang.Object getNextSequenceValue(DBDatabase db, java.lang.String seqName, int minValue, java.sql.Connection conn)
DBDatabaseDriver
getNextSequenceValue
in class DBDatabaseDriver
db
- the databaseseqName
- the name of the sequenceminValue
- the minimum value of the sequenceconn
- a valid database connection
DBDatabaseDriver.getNextSequenceValue(DBDatabase, String, int, Connection)
public boolean getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
DBDatabaseDriver
getDDLScript
in class DBDatabaseDriver
type
- the command typedbo
- the databse objectscript
- the script to complete
DBDatabaseDriver.getDDLScript(DBCmdType, DBObject, DBSQLScript)
public java.sql.Timestamp getUpdateTimestamp(java.sql.Connection conn)
getUpdateTimestamp
in class DBDatabaseDriver
conn
- the connection that might be used
protected boolean createDatabase(DBDatabase db, DBSQLScript script)
protected java.lang.String createSequenceName(DBTableColumn c)
protected boolean createSequence(DBDatabase db, DBTableColumn c, DBSQLScript script)
protected boolean createTable(DBTable t, DBSQLScript script)
protected boolean appendColumnDesc(DBTableColumn c, java.lang.StringBuilder sql, boolean alter)
c
- the column which description to appendsql
- the sql builder objectalter
- is this for an alter statement
protected boolean createRelation(DBRelation r, DBSQLScript script)
protected boolean alterTable(DBTableColumn col, DBCmdType type, DBSQLScript script)
col
- the column which to add, modify or droptype
- the type of operation to performscript
- to which to append the sql statement to
protected boolean createView(DBView v, DBSQLScript script)
protected boolean dropObject(java.lang.String name, java.lang.String objType, DBSQLScript script)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |