|
||||||||||
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.mysql.DBDatabaseDriverMySQL
public class DBDatabaseDriverMySQL
This class provides support for the MySQL database system.
Nested Class Summary | |
---|---|
static class |
DBDatabaseDriverMySQL.DBCommandMySQL
Defines the MySQL command type. |
Nested classes/interfaces inherited from class org.apache.empire.db.DBDatabaseDriver |
---|
DBDatabaseDriver.DBSeqTable, DBDatabaseDriver.DBSetGenKeys |
Field Summary |
---|
Constructor Summary | |
---|---|
DBDatabaseDriverMySQL()
Constructor for the MySQL database driver. |
Method Summary | |
---|---|
void |
attachDatabase(DBDatabase db,
Connection conn)
Called when a database is opened |
DBCommandExpr |
createCombinedCommand(DBCommandExpr left,
String keyWord,
DBCommandExpr right)
This function gives the driver a chance to provide a custom implementation for a combined command such as UNION or INTERSECT |
DBCommand |
createCommand(DBDatabase db)
Creates a new MySQL command object. |
String |
getCharacterSet()
|
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()
returns the name for the database / schema |
void |
getDDLScript(DBCmdType type,
DBObject dbo,
DBSQLScript script)
Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript. |
String |
getEngine()
Get the table engine that is used when creating new tables |
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 |
getSequenceTableName()
returns the name of the sequence table |
String |
getSQLPhrase(int phrase)
Gets an sql phrase template for this database system. |
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 identity management. Default is false. |
void |
setCharacterSet(String characterSet)
|
void |
setDatabaseName(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. |
void |
setEngine(String engine)
Set the table engine that is used when creating new tables |
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 identity fields. |
Methods inherited from class org.apache.empire.db.DBDatabaseDriver |
---|
addEnableRelationStmt, addStatementParam, appendElementName, appendElementName, appendSQLTextValue, checkDatabase, close, detachDatabase, detectQuoteName, executeQuery, executeSQL, extractErrorMessage, getColumnAutoValue, getResultValue, getSQLDateTimeString, getSQLNumberString, getSQLTextString, getValueString, isDDLColumnDefaults, prepareStatement, setDDLColumnDefaults, stringToBoolean |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBDatabaseDriverMySQL()
Method Detail |
---|
public String getDatabaseName()
public void setDatabaseName(String databaseName)
databaseName
- the name of the databasepublic String getCharacterSet()
public void setCharacterSet(String characterSet)
public String getEngine()
public void setEngine(String engine)
engine
- the table enginepublic 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 void attachDatabase(DBDatabase db, Connection conn)
DBDatabaseDriver
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 DBCommandExpr createCombinedCommand(DBCommandExpr left, String keyWord, DBCommandExpr right)
DBDatabaseDriver
createCombinedCommand
in class DBDatabaseDriver
left
- the left commandkeyWord
- the key word (either "UNION" or "INTERSECT")
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)
public Timestamp getUpdateTimestamp(Connection conn)
getUpdateTimestamp
in class DBDatabaseDriver
conn
- the connection that might be used
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |