|
3.2.4: 2013-12-06 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.dbengine.AbstractDbEngine
net.sf.basedb.core.dbengine.MySQLEngine
public class MySQLEngine
Database engine for My SQL.
Constructor Summary | |
---|---|
MySQLEngine()
Create MySQLEngine. |
Method Summary | |
---|---|
boolean |
analyzeAfterBatchOperation()
Return true. |
private void |
appendList(StringBuilder sb,
Collection<String> items)
|
boolean |
caseInsensitiveComparison()
Returns TRUE. |
String |
getAnalyzeTableSql(String catalog,
String schema,
String table)
Generate ANALYZE TABLE <catalog>. |
String |
getApproximateRowCountSql(String catalog,
String schema,
String table)
Get an SQL statement that returns an approximate count for the number of rows in the given table. |
String |
getCaseSensitiveVarchar(int length)
Return varchar(length) CHARACTER SET utf8 COLLATE utf8_bin . |
String |
getCreateForeignKeySql(String catalog,
String schema,
String table,
String name,
Set<String> columns,
String refTable,
Set<String> refColumns)
Generate ALTER TABLE schema.table ADD CONSTRAINT name
FOREIGN KEY (columns) REFERERENCES refTable (refColumns) |
String |
getCreateIndexSql(String catalog,
String schema,
String table,
String name,
Set<String> columns,
boolean unique)
Generate ALTER TABLE <catalog>. |
String |
getCreatePrimaryKeySql(String catalog,
String schema,
String table,
String name,
Set<String> columns)
Generate ALTER TABLE catalog.table ADD PRIMARY KEY (columns) |
String |
getDropForeignKeySql(String catalog,
String schema,
String table,
String name)
Generate ALTER TABLE <catalog>. |
String |
getDropIndexSql(String catalog,
String schema,
String table,
String name,
boolean unique)
Generate DROP INDEX <name> ON <catalog>. |
String |
getDropPrimaryKey(String catalog,
String schema,
String table,
String name)
Generate ALTER TABLE catalog.table DROP PRIMARY KEY |
String |
getInsertAutoIncrementSql(PersistentClass pc)
Return a SQL fragment that can be used in an INSERT INTO statement to generate an ID for new rows. |
String |
getOptimizeTableSql(String catalog,
String schema,
String table)
Generate OPTIMIZE TABLE <catalog>. |
String |
getQuotedName(String name)
Put quotes (`) around the name. |
String |
ln(String value)
Return LOG(<value>) . |
String |
makeSafeCreateTable(String sql,
String catalog,
String schema,
String table)
Replace CREATE TABLE with CREATE TABLE IF NOT EXISTS... |
String |
rlike(String value,
String regexp)
Return <value> RLIKE <regexp> . |
boolean |
supportColumnAliasInGroupBy()
Returns TRUE. |
boolean |
supportColumnAliasInHaving()
Returns TRUE. |
boolean |
supportColumnAliasInOrderBy()
Returns TRUE. |
boolean |
supportsColumnAliasInWhere()
Returns FALSE. |
boolean |
useThetaJoin()
Always false. |
Methods inherited from class net.sf.basedb.core.dbengine.AbstractDbEngine |
---|
abs, castToDate, checkForInvalidNumberOperation, exp, inspectSchemaGenerationSQL, isValidColumnName, isValidName, isValidTableName, power, selectOrderByColumnsIfDistinct, useSavePointToContinueTransactionFromSqlFailure |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.dbengine.DbEngine |
---|
abs, castToDate, checkForInvalidNumberOperation, exp, inspectSchemaGenerationSQL, isValidColumnName, isValidTableName, power, selectOrderByColumnsIfDistinct, useSavePointToContinueTransactionFromSqlFailure |
Constructor Detail |
---|
public MySQLEngine()
Method Detail |
---|
public boolean useThetaJoin()
useThetaJoin
in interface DbEngine
useThetaJoin
in class AbstractDbEngine
public String getCreateIndexSql(String catalog, String schema, String table, String name, Set<String> columns, boolean unique)
ALTER TABLE <catalog>.<table> ADD [UNIQUE]
INDEX <name> (<columns>)
.
The schema parameter is not supported.
getCreateIndexSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the index to be createdcolumns
- The name of the columns in the indexunique
- If the index must contain unique values or not
public String getDropIndexSql(String catalog, String schema, String table, String name, boolean unique)
DROP INDEX <name> ON <catalog>.<table>
.
The schema parameter is not supported.
getDropIndexSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the indexunique
- If the index contains unique values or not
public String getCreateForeignKeySql(String catalog, String schema, String table, String name, Set<String> columns, String refTable, Set<String> refColumns)
ALTER TABLE schema.table ADD CONSTRAINT name
FOREIGN KEY (columns) REFERERENCES refTable (refColumns)
getCreateForeignKeySql
in interface DbEngine
catalog
- The name of the catalog (database) where the tables are
located, or null if it is located in the current catalogschema
- The name of the schema where the tables are located, or
null if is located in the current schematable
- The name of the foreign key tablename
- The name of the foreign keycolumns
- The columns that make up the foreign keyrefTable
- The table that is referenced by the foreign keyrefColumns
- The columns that are referenced by the foreign key
public String getDropForeignKeySql(String catalog, String schema, String table, String name)
ALTER TABLE <catalog>.<table> DROP FOREIGN KEY <name>
getDropForeignKeySql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the foreign key
public String getCreatePrimaryKeySql(String catalog, String schema, String table, String name, Set<String> columns)
ALTER TABLE catalog.table ADD PRIMARY KEY (columns)
getCreatePrimaryKeySql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the primary keycolumns
- The name of the columns in the primary key
public String getDropPrimaryKey(String catalog, String schema, String table, String name)
ALTER TABLE catalog.table DROP PRIMARY KEY
getDropPrimaryKey
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the primary key
public String getInsertAutoIncrementSql(PersistentClass pc)
DbEngine
getInsertAutoIncrementSql
in interface DbEngine
pc
- The persistent class
public boolean analyzeAfterBatchOperation()
analyzeAfterBatchOperation
in interface DbEngine
public String getOptimizeTableSql(String catalog, String schema, String table)
OPTIMIZE TABLE <catalog>.<table>
.
The schema parameter is not supported.
getOptimizeTableSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table to optimize
DbEngine.getAnalyzeTableSql(String, String, String)
public String getAnalyzeTableSql(String catalog, String schema, String table)
ANALYZE TABLE <catalog>.<table>
.
The schema parameter is not supported.
getAnalyzeTableSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table to analyze
DbEngine.getOptimizeTableSql(String, String, String)
public String makeSafeCreateTable(String sql, String catalog, String schema, String table)
makeSafeCreateTable
in interface DbEngine
makeSafeCreateTable
in class AbstractDbEngine
sql
- The original SQLcatalog
- The name of the catalog (database) where the table is
being create, or null if it is located in the current catalogschema
- The name of the schema where the table is being created, or
null if is located in the current schematable
- The name of the table that is being created
public boolean caseInsensitiveComparison()
caseInsensitiveComparison
in interface DbEngine
public boolean supportsColumnAliasInWhere()
supportsColumnAliasInWhere
in interface DbEngine
supportsColumnAliasInWhere
in class AbstractDbEngine
public boolean supportColumnAliasInOrderBy()
supportColumnAliasInOrderBy
in interface DbEngine
supportColumnAliasInOrderBy
in class AbstractDbEngine
public boolean supportColumnAliasInGroupBy()
supportColumnAliasInGroupBy
in interface DbEngine
supportColumnAliasInGroupBy
in class AbstractDbEngine
public boolean supportColumnAliasInHaving()
supportColumnAliasInHaving
in interface DbEngine
supportColumnAliasInHaving
in class AbstractDbEngine
public String ln(String value)
LOG(<value>)
.
ln
in interface DbEngine
ln
in class AbstractDbEngine
value
- The value to take the logarithm of
public String rlike(String value, String regexp)
<value> RLIKE <regexp>
.
rlike
in interface DbEngine
rlike
in class AbstractDbEngine
value
- The left valueregexp
- The regular expression as a string
public String getCaseSensitiveVarchar(int length)
varchar(length) CHARACTER SET utf8 COLLATE utf8_bin
.
getCaseSensitiveVarchar
in interface DbEngine
getCaseSensitiveVarchar
in class AbstractDbEngine
length
- The maximum length that needs to be stored in the column
public String getQuotedName(String name)
getQuotedName
in interface DbEngine
getQuotedName
in class AbstractDbEngine
name
- The name of an object in the database
public String getApproximateRowCountSql(String catalog, String schema, String table)
DbEngine
getApproximateRowCountSql
in interface DbEngine
getApproximateRowCountSql
in class AbstractDbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table
private void appendList(StringBuilder sb, Collection<String> items)
|
3.2.4: 2013-12-06 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |