public class DBDatabaseDriverMySQL extends DBDatabaseDriver
| Modifier and Type | Class and Description |
|---|---|
static class |
DBDatabaseDriverMySQL.DBCommandMySQL
Defines the MySQL command type.
|
DBDatabaseDriver.DBSeqTable, DBDatabaseDriver.DBSetGenKeysddlColumnDefaults, GENERAL_SQL_KEYWORDS, ILLEGAL_NAME_CHARS, reservedSQLKeywords, SQL_BOOLEAN_FALSE, SQL_BOOLEAN_TRUE, SQL_CONCAT_EXPR, SQL_CURRENT_DATE, SQL_CURRENT_DATETIME, SQL_DATABASE_LINK, SQL_DATE_PATTERN, SQL_DATE_TEMPLATE, SQL_DATETIME_PATTERN, SQL_DATETIME_TEMPLATE, SQL_FUNC_ABS, SQL_FUNC_AVG, SQL_FUNC_CEILING, SQL_FUNC_COALESCE, SQL_FUNC_DAY, SQL_FUNC_DECODE, SQL_FUNC_DECODE_ELSE, SQL_FUNC_DECODE_PART, SQL_FUNC_DECODE_SEP, SQL_FUNC_ESCAPE, SQL_FUNC_FLOOR, SQL_FUNC_LENGTH, SQL_FUNC_LOWER, SQL_FUNC_LTRIM, SQL_FUNC_MAX, SQL_FUNC_MIN, SQL_FUNC_MONTH, SQL_FUNC_REPLACE, SQL_FUNC_REVERSE, SQL_FUNC_ROUND, SQL_FUNC_RTRIM, SQL_FUNC_STRINDEX, SQL_FUNC_STRINDEXFROM, SQL_FUNC_SUBSTRING, SQL_FUNC_SUBSTRINGEX, SQL_FUNC_SUM, SQL_FUNC_TRIM, SQL_FUNC_TRUNC, SQL_FUNC_UPPER, SQL_FUNC_YEAR, SQL_NULL_VALUE, SQL_PARAMETER, SQL_QUOTES_CLOSE, SQL_QUOTES_OPEN, SQL_RENAME_COLUMN, SQL_RENAME_TABLE| Constructor and Description |
|---|
DBDatabaseDriverMySQL()
Constructor for the MySQL database driver.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
addEnableRelationStmt, addStatementParam, appendElementName, appendElementName, appendSQLTextValue, checkDatabase, close, detachDatabase, detectQuoteName, executeBatch, executeQuery, executeSQL, extractErrorMessage, getColumnAutoValue, getResultValue, getSQLDateTimeString, getSQLNumberString, getSQLTextString, getValueString, isDDLColumnDefaults, prepareStatement, setDDLColumnDefaults, stringToBooleanpublic DBDatabaseDriverMySQL()
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)
DBDatabaseDriverattachDatabase in class DBDatabaseDriverpublic DBCommand createCommand(DBDatabase db)
createCommand in class DBDatabaseDriverdb - the database for which to create a command object forpublic DBCommandExpr createCombinedCommand(DBCommandExpr left, String keyWord, DBCommandExpr right)
DBDatabaseDrivercreateCombinedCommand in class DBDatabaseDriverleft - the left commandkeyWord - the key word (either "UNION" or "INTERSECT")public boolean isSupported(DBDriverFeature type)
isSupported in class DBDatabaseDrivertype - type of requested feature. @see DBDriverFeaturepublic String getSQLPhrase(int phrase)
getSQLPhrase in class DBDatabaseDriverphrase - the identifier of the phraseDBDatabaseDriver.getSQLPhrase(int)public String getConvertPhrase(DataType destType, DataType srcType, Object format)
DBDatabaseDrivergetConvertPhrase in class DBDatabaseDriverdestType - 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)
DBDatabaseDrivergetNextSequenceValue in class DBDatabaseDriverdb - the databaseseqName - the name of the sequenceminValue - the minimum value of the sequenceconn - a valid database connectionDBDatabaseDriver.getNextSequenceValue(DBDatabase, String, int, Connection)public Timestamp getUpdateTimestamp(Connection conn)
getUpdateTimestamp in class DBDatabaseDriverconn - the connection that might be usedpublic void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script)
DBDatabaseDrivergetDDLScript in class DBDatabaseDrivertype - 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)Copyright © 2008–2015 Apache Software Foundation. All rights reserved.