public class MySQL extends AnsiStandard
org.Melati.LogicalDatabase.melatitest.pass=or use explicit username and password and
GRANT ALL PRIVILEGES ON dbname TO username@localhost IDENTIFIED BY 'password';
getConnection now returns a Connection
with autocommit turned off through JDBC.
BDB tables of MySQL-Max 3.23.49 don't support full transactions
- they lock whole table instead, until commit/rollback is called.
According to MySQL 4.0.2-alpha doc, interface between MySQL and
BDB tables is still improved.
As I tested MySQL-Max 3.23.49, InnoDB has correct transactions,
however database size must be specified and reserved in advance
in one file, that is share by all InnoDB tables.
Set in /etc/my.cnf by line like:
innodb_data_file_path=ibdata1:30M
run safe_mysqld --user=mysql --ansi --default-table-type=InnoDBAfter it created and initialised dB file /var/lib/mysql/ibdata1 of 30MB, it creates 2 own log files /var/lib/mysql/ib_logfile0 and ib_logfile1, both of size 5MB.
| Modifier and Type | Class and Description |
|---|---|
static class |
MySQL.BlobPoemType
Translates a MySQL Blob into a Poem
IntegerPoemType. |
static class |
MySQL.MySQLBooleanPoemType
Translates a MySQL Boolean into a Poem
BooleanType. |
static class |
MySQL.MySQLStringPoemType
Translates a MySQL String into a Poem
StringPoemType. |
| Modifier and Type | Field and Description |
|---|---|
static int |
indexSize
Size of indexes.
|
static int |
mysqlTextSize
Size of MySQL text fields.
|
| Constructor and Description |
|---|
MySQL()
Constructor - sets driver.
|
| Modifier and Type | Method and Description |
|---|---|
String |
alterColumnAddCommentSQL(Column<?> column,
String comment)
MySQL does not do the normal thing.
|
String |
alterColumnNotNullableSQL(String tableName,
Column<?> column)
Return the SQL snippet to alter a column to not nullable.
|
String |
alterTableAddCommentSQL(Table<?> table,
String comment)
MySQL does not do the normal thing.
|
<S,O> PoemType<O> |
canRepresent(PoemType<S> storage,
PoemType<O> other)
Enable one PoemType to represent another,
for example a bit to represent a boolean.
|
String |
caseInsensitiveRegExpSQL(String term1,
String term2)
This is the Postgresql syntax.
|
String |
createTableOptionsSql()
Accomodate MySQL table creation options.
|
SQLPoemType<?> |
defaultPoemTypeOfColumnMetaData(ResultSet md)
The simplest POEM type corresponding to a JDBC description from the
database.
|
SQLPoemException |
exceptionForUpdate(Table<?> table,
String sql,
boolean insert,
SQLException e)
An exception appropriate for expressing what really went wrong
during a write to the db.
|
String |
getBinarySqlDefinition(int size)
Ignores size.
|
String |
getIndexLength(Column<?> column)
MySQL requires TEXT and BLOB field indices to have an
explicit length, 30 should be fine.
|
String |
getQuotedName(String name)
Accommodate different quoting strategies.
|
String |
getSqlDefinition(String sqlTypeName)
Retrieve an SQL type keyword used by the DBMS
for the given Melati type name.
|
String |
getStringSqlDefinition(int size)
Accommodate String / Text distinction.
|
String |
givesCapabilitySQL(Integer userTroid,
String capabilityExpr)
MySQL had no EXISTS keyword, from 4.1 onwards it does.
|
String |
melatiName(String name)
Reverse the mapping in unreservedName.
|
String |
unreservedName(String name)
A pair of functions for getting around keywords which make your
JDBC driver barf, as 'group' does for MySQL.
|
booleanTrueExpression, canBeIndexed, canDropColumns, canStoreBlobs, createTableSql, createTableTypeQualifierSql, exceptionForUpdate, getConnection, getFixedPtSqlDefinition, getForeignKeyDefinition, getJdbcMetadataName, getLongSqlDefinition, getPrimaryKeyDefinition, getQuotedValue, getSchema, getSqlDefaultValue, preparedStatementPlaceholder, selectLimit, shutdown, sqlBooleanValueOfRaw, tableInitialisationSql, toString, unloadDriverpublic static final int indexSize
public static final int mysqlTextSize
public String createTableOptionsSql()
createTableOptionsSql in interface DbmscreateTableOptionsSql in class AnsiStandardAnsiStandard.createTableOptionsSql()public String getSqlDefinition(String sqlTypeName)
getSqlDefinition in interface DbmsgetSqlDefinition in class AnsiStandardsqlTypeName - the Melati internal type namepublic String getStringSqlDefinition(int size) throws SQLException
DbmsgetStringSqlDefinition in interface DbmsgetStringSqlDefinition in class AnsiStandardsize - the string length (-1 means no limit)SQLExceptionpublic String getBinarySqlDefinition(int size)
getBinarySqlDefinition in interface DbmsgetBinarySqlDefinition in class AnsiStandardsize - how big the field ispublic String getQuotedName(String name)
DbmsgetQuotedName in interface DbmsgetQuotedName in class AnsiStandardname - the unquoted namepublic <S,O> PoemType<O> canRepresent(PoemType<S> storage, PoemType<O> other)
DbmscanRepresent in interface DbmscanRepresent in class AnsiStandardstorage - the containerother - the type to storepublic SQLPoemType<?> defaultPoemTypeOfColumnMetaData(ResultSet md) throws SQLException
DbmsdefaultPoemTypeOfColumnMetaData in interface DbmsdefaultPoemTypeOfColumnMetaData in class AnsiStandardmd - the JDBC metadataSQLException - potentiallypublic SQLPoemException exceptionForUpdate(Table<?> table, String sql, boolean insert, SQLException e)
DbmsexceptionForUpdate in interface DbmsexceptionForUpdate in class AnsiStandardtable - The table on which the update was affectedsql - The operation attempted, or possibly nullinsert - Whether the operation was an INSERT as
opposed to an UPDATEe - The raw SQL exception: the routine is meant to
try to interpret e.getMessage if it canPostgresql.exceptionForUpdate(org.melati.poem.Table<?>, java.lang.String, boolean, java.sql.SQLException)public String unreservedName(String name)
AnsiStandardunreservedName in interface DbmsunreservedName in class AnsiStandardname - the field or table nameDbms.unreservedName(java.lang.String),
unreservedName(java.lang.String),
melatiName(java.lang.String)public String melatiName(String name)
DbmsmelatiName in interface DbmsmelatiName in class AnsiStandardname - an SQL namepublic String getIndexLength(Column<?> column)
getIndexLength in interface DbmsgetIndexLength in class AnsiStandardcolumn - the POEM Column we are dealing withgetIndexLength(org.melati.poem.Column<?>)public String givesCapabilitySQL(Integer userTroid, String capabilityExpr)
AnsiStandardgivesCapabilitySQL in interface DbmsgivesCapabilitySQL in class AnsiStandarduserTroid - the troid of the User to use in the querycapabilityExpr - the capability troid we needgivesCapabilitySQL(java.lang.Integer, java.lang.String)public String caseInsensitiveRegExpSQL(String term1, String term2)
AnsiStandardcaseInsensitiveRegExpSQL in interface DbmscaseInsensitiveRegExpSQL in class AnsiStandardterm1 - the term to find interm2 - the quoted term to findpublic String alterColumnNotNullableSQL(String tableName, Column<?> column)
DbmsalterColumnNotNullableSQL in interface DbmsalterColumnNotNullableSQL in class AnsiStandardpublic String alterColumnAddCommentSQL(Column<?> column, String comment)
alterColumnAddCommentSQL in interface DbmsalterColumnAddCommentSQL in class AnsiStandardcolumn - the target to add a remark tocomment - the remark to addpublic String alterTableAddCommentSQL(Table<?> table, String comment)
alterTableAddCommentSQL in interface DbmsalterTableAddCommentSQL in class AnsiStandardtable - the target to add a remark tocomment - the remark to addCopyright © 2000–2021 PanEris. All rights reserved.