|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.melati.poem.dbms.AnsiStandard
org.melati.poem.dbms.MySQL
public class MySQL
A Driver for MySQL. See http://www.mysql.com. Notes
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 & 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.
| Nested Class Summary | |
|---|---|
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. |
| Field Summary | |
|---|---|
static int |
indexSize
Size of indexes. |
static int |
mysqlTextSize
Size of MySQL text fields. |
| Fields inherited from class org.melati.poem.dbms.AnsiStandard |
|---|
schema |
| Constructor Summary | |
|---|---|
MySQL()
Constructor - sets driver. |
|
| Method Summary | |
|---|---|
String |
alterColumnNotNullableSQL(String tableName,
Column column)
Return the SQL snippet to alter a column to not nullable. |
PoemType<?> |
canRepresent(PoemType<?> storage,
PoemType<?> type)
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)
Accomodate 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)
Accomodate 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int indexSize
public static final int mysqlTextSize
| Constructor Detail |
|---|
public MySQL()
| Method Detail |
|---|
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 name
Dbms.getSqlDefinition(java.lang.String)
public String getStringSqlDefinition(int size)
throws SQLException
getStringSqlDefinition in interface DbmsgetStringSqlDefinition in class AnsiStandardsize - the string length (-1 means no limit)
SQLExceptionAnsiStandard.getStringSqlDefinition(int)public String getBinarySqlDefinition(int size)
getBinarySqlDefinition in interface DbmsgetBinarySqlDefinition in class AnsiStandardsize - how big the field is
AnsiStandard.getBinarySqlDefinition(int)public String getQuotedName(String name)
getQuotedName in interface DbmsgetQuotedName in class AnsiStandardname - the unquoted name
AnsiStandard.getQuotedName(java.lang.String)
public PoemType<?> canRepresent(PoemType<?> storage,
PoemType<?> type)
canRepresent in interface DbmscanRepresent in class AnsiStandardstorage - the POEM native typetype - the current type
AnsiStandard.canRepresent(org.melati.poem.PoemType, org.melati.poem.PoemType)
public SQLPoemType defaultPoemTypeOfColumnMetaData(ResultSet md)
throws SQLException
defaultPoemTypeOfColumnMetaData in interface DbmsdefaultPoemTypeOfColumnMetaData in class AnsiStandardmd - the JDBC metadata
SQLException - potentiallydefaultPoemTypeOfColumnMetaData(java.sql.ResultSet)
public SQLPoemException exceptionForUpdate(Table table,
String sql,
boolean insert,
SQLException e)
exceptionForUpdate 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 can
AnsiStandard.exceptionForUpdate(org.melati.poem.Table, java.lang.String, boolean, java.sql.SQLException)public String unreservedName(String name)
unreservedName in interface DbmsunreservedName in class AnsiStandardname - the field or table name
AnsiStandard.unreservedName(java.lang.String)public String melatiName(String name)
melatiName in interface DbmsmelatiName in class AnsiStandardname - an SQL name
AnsiStandard.melatiName(java.lang.String)public String getIndexLength(Column column)
getIndexLength in interface DbmsgetIndexLength in class AnsiStandardcolumn - the POEM Column we are dealing with
Dbms.getIndexLength(org.melati.poem.Column),
getIndexLength(org.melati.poem.Column)
public String givesCapabilitySQL(Integer userTroid,
String capabilityExpr)
givesCapabilitySQL in interface DbmsgivesCapabilitySQL in class AnsiStandarduserTroid - the troid of the User to use in the querycapabilityExpr - the capability troid we need
AnsiStandard.givesCapabilitySQL(java.lang.Integer, java.lang.String)
public String caseInsensitiveRegExpSQL(String term1,
String term2)
caseInsensitiveRegExpSQL in interface DbmscaseInsensitiveRegExpSQL in class AnsiStandardterm1 - the term to find interm2 - the quoted term to find
caseInsensitiveRegExpSQL(java.lang.String, java.lang.String)
public String alterColumnNotNullableSQL(String tableName,
Column column)
alterColumnNotNullableSQL in interface DbmsalterColumnNotNullableSQL in class AnsiStandardalterColumnNotNullableSQL(java.lang.String, org.melati.poem.Column)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||