|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.db.DBDatabaseDriver
org.apache.empire.db.sqlserver.DBDatabaseDriverMSSQL
public class DBDatabaseDriverMSSQL
This class provides support for the Microsoft SQL-Server database system.
Nested Class Summary | |
---|---|
static class |
DBDatabaseDriverMSSQL.DBCommandMSSQL
Defines the Microsoft SQL-Server command type. |
Nested classes/interfaces inherited from class org.apache.empire.db.DBDatabaseDriver |
---|
DBDatabaseDriver.DBSeqTable, DBDatabaseDriver.DBSetGenKeys |
Field Summary | |
---|---|
protected static String[] |
MSSQL_SQL_KEYWORDS
|
Constructor Summary | |
---|---|
DBDatabaseDriverMSSQL()
Constructor for the MSSQL database driver. |
Method Summary | |
---|---|
void |
addEnableRelationStmt(DBRelation r,
boolean enable,
DBSQLScript script)
Appends a statement to enable or disable a foreign key relation. The default is to drop or create the relation Override this method to provide different behavior for your database. |
void |
attachDatabase(DBDatabase db,
Connection conn)
Called when a database is opened |
DBCommand |
createCommand(DBDatabase db)
Creates a new Microsoft SQL-Server command object. |
Object |
getColumnAutoValue(DBDatabase db,
DBTableColumn column,
Connection conn)
Returns an auto-generated value for a particular column |
String |
getConvertPhrase(DataType destType,
DataType srcType,
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. |
String |
getDatabaseName()
|
void |
getDDLScript(DBCmdType 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. If a driver supports this function it must return true for isSupported(DBDriverFeature.SEQUENCES). |
String |
getObjectOwner()
|
String |
getSequenceTableName()
returns the name of the sequence table |
String |
getSQLPhrase(int phrase)
Gets an sql phrase template for this database system. |
protected String |
getSQLTextString(DataType type,
Object value)
encodes Text values for an SQL command string. |
Timestamp |
getUpdateTimestamp(Connection conn)
Overridden. |
boolean |
isSupported(DBDriverFeature type)
Returns whether or not a particular feature is supported by this driver |
boolean |
isUseSequenceTable()
returns whether a sequence table is used for record identiy management. Default is false. |
boolean |
isUseUnicodePrefix()
Indicates whether or not a Unicode Prefix (N) is prepended to all text values |
void |
setDatabaseName(String databaseName)
|
void |
setObjectOwner(String objectOwner)
|
void |
setSequenceTableName(String sequenceTableName)
Sets the name of the sequence table. |
void |
setUseSequenceTable(boolean useSequenceTable)
If set to true a special table is used for sequence number generation. Otherwise the AutoIncrement feature of MySQL is used identiy fields. |
void |
setUseUnicodePrefix(boolean useUnicodePrefix)
Sets whether or not to use a Unicode Prefix (N) for all text values Default is true |
Methods inherited from class org.apache.empire.db.DBDatabaseDriver |
---|
addStatementParam, appendElementName, appendElementName, appendSQLTextValue, checkDatabase, close, createCombinedCommand, detachDatabase, detectQuoteName, executeQuery, executeSQL, extractErrorMessage, getResultValue, getSQLDateTimeString, getSQLNumberString, getValueString, isDDLColumnDefaults, prepareStatement, setDDLColumnDefaults, stringToBoolean |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String[] MSSQL_SQL_KEYWORDS
Constructor Detail |
---|
public DBDatabaseDriverMSSQL()
Method Detail |
---|
public String getDatabaseName()
public void setDatabaseName(String databaseName)
public String getObjectOwner()
public void setObjectOwner(String objectOwner)
public boolean isUseSequenceTable()
public void setUseSequenceTable(boolean useSequenceTable)
useSequenceTable
- true to use a sequence table or false otherwise.public String getSequenceTableName()
public void setSequenceTableName(String sequenceTableName)
sequenceTableName
- the name of the table used for sequence number generationpublic boolean isUseUnicodePrefix()
public void setUseUnicodePrefix(boolean useUnicodePrefix)
useUnicodePrefix
- true if a Unicode Prefix (N) should be used for text valuespublic void attachDatabase(DBDatabase db, Connection conn)
attachDatabase
in class DBDatabaseDriver
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 requested feature. @see DBDriverFeature
public String getSQLPhrase(int phrase)
getSQLPhrase
in class DBDatabaseDriver
phrase
- the identifier of the phrase
DBDatabaseDriver.getSQLPhrase(int)
public String getConvertPhrase(DataType destType, DataType srcType, 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 Object getNextSequenceValue(DBDatabase db, String seqName, int minValue, 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)
protected String getSQLTextString(DataType type, Object value)
DBDatabaseDriver
getSQLTextString
in class DBDatabaseDriver
type
- date type (can only be TEXT, CHAR, CLOB and UNIQUEID)value
- the text to be encoded
DBDatabaseDriver.getSQLTextString(DataType type, Object value)
public Timestamp getUpdateTimestamp(Connection conn)
getUpdateTimestamp
in class DBDatabaseDriver
conn
- the connection that might be used
public Object getColumnAutoValue(DBDatabase db, DBTableColumn column, Connection conn)
getColumnAutoValue
in class DBDatabaseDriver
db
- the databasecolumn
- the column for which a value is requiredconn
- a valid database connection
public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
DBDatabaseDriver
getDDLScript
in class DBDatabaseDriver
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)DBDatabaseDriver.getDDLScript(DBCmdType, DBObject, DBSQLScript)
public void addEnableRelationStmt(DBRelation r, boolean enable, DBSQLScript script)
DBDatabaseDriver
addEnableRelationStmt
in class DBDatabaseDriver
r
- the foreign key relation which should be enabled or disabledenable
- true to enable the relation or false to disablescript
- the script to which to add the DDL command(s)DBDatabaseDriver.addEnableRelationStmt(DBRelation, boolean, DBSQLScript)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |