planetj.database
Class MySQLDBSystem

java.lang.Object
  extended byplanetj.database.DBSystem
      extended byplanetj.database.MySQLDBSystem
All Implemented Interfaces:
java.util.EventListener, IDBObject, ITaskListener, IXMLObject, java.io.Serializable

public class MySQLDBSystem
extends DBSystem

See Also:
Serialized Form

Field Summary
static java.lang.String DRIVER
          MYSQL driver
 
Fields inherited from class planetj.database.DBSystem
LIBRARIES_NOT_SUPPORTED, LIBRARIES_REQUIRED, LIBRARIES_SUPPORTED, METADATA_CATALOG_NAME_FIELD, METADATA_COLUMN_NAME_FIELD, METADATA_COLUMN_NAME_OPERATION, METADATA_COLUMN_NAME_OPERATION_FOR_CATALOGS, METADATA_LIBRARY_NAME, METADATA_LIBRARY_NAME_FIELD, METADATA_SYSTEM_NAME_FIELD, METADATA_TABLE_NAME_FIELD, METADATA_TABLE_NAME_FOR_COLUMNS, METADATA_TABLE_NAME_FOR_LIBRARIES, METADATA_TABLE_NAME_FOR_TABLES, METADATA_TABLE_NAME_OPERATION, METADATA_TABLE_NAME_OPERATION_FOR_CATALOGS
 
Constructor Summary
protected MySQLDBSystem()
          MySQLDBSystem constructor comment.
protected MySQLDBSystem(java.lang.String url)
          MySQLDBSystem constructor comment.
protected MySQLDBSystem(java.lang.String pURL, java.lang.String pAlias)
          MySQLDBSystem constructor comment.
 
Method Summary
 java.lang.String correctOperationSQL(java.lang.String originalSQL)
          Corrects the SQL to account for difference in the SQL syntax of different DB systems.
 java.lang.String correctSQLLiteral(java.lang.String value)
          Corrects the given SQL literal by adding additional escape characters to allow the value to be as is.
 java.lang.String getColumnDataTypeName(FieldDescriptorRow oldFD)
          Gets the correct column data type name for the FD on this system.
 java.lang.String getColumnIndicationCharacter()
          Returns the character that needs to be used during an insert.
 java.lang.String getColumnPrimaryKeyName(FieldDescriptorRow oldFD)
          Gets the correct column name which a primary key on this system should refer to for the FD.
 byte getLibrarySupportLevel()
          Gets the level of library support; this is one of the constants defined in the class.
 void handleConnectionEvent(ConnectionEvent ce)
          Invoked when a connection event occurs
protected  void setURL(java.lang.String pURL)
          Sets the url of the system.
 
Methods inherited from class planetj.database.DBSystem
addSQLTypeName, correctDatabaseObject, correctOperation, createLibrary, createSystem, createSystem, createSystem, createSystem, getAlias, getAllLibraries, getCache, getDataType, getDBLibraryName, getDefaultDateFormat, getDefaultLibraryName, getDefaultTimeFormat, getDefaultTimestampFormat, getFieldClassForSQLTypeName, getIPAddress, getLibraries, getLibrary, getLibrary, getLibraryTableSeparator, getMetaDataAlias, getMetadataColumns, getMetadataLibraries, getMetaDataSystem, getMetadataTables, getName, getProperties, getSQLTypeNames, getSupportedDataType, getSystem, getURL, getXMLData, isAS400, isBackgroundThreadsSupported, isDB2, isDefaultLibraryOmitted, isDelegateToPersonal, isHasAllLibraries, isMSAccess, isMySQL, isOracle, isSQLServer, removeLibrary, setAlias, setDelegateToPersonal, setMetaDataAlias, setProperties, setURLInternal, startRetrieveAllLibrariesTask, taskCompleted, taskFailed, taskStarted, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DRIVER

public static final java.lang.String DRIVER
MYSQL driver

See Also:
Constant Field Values
Constructor Detail

MySQLDBSystem

protected MySQLDBSystem()
MySQLDBSystem constructor comment.


MySQLDBSystem

protected MySQLDBSystem(java.lang.String url)
MySQLDBSystem constructor comment.

Parameters:
url - java.lang.String

MySQLDBSystem

protected MySQLDBSystem(java.lang.String pURL,
                        java.lang.String pAlias)
MySQLDBSystem constructor comment.

Parameters:
pURL - java.lang.String
pAlias - java.lang.String
Method Detail

correctOperationSQL

public java.lang.String correctOperationSQL(java.lang.String originalSQL)
Corrects the SQL to account for difference in the SQL syntax of different DB systems. For example, in mySQL you cannot use the DECIMAL data type inside of a cast, instead the BINARY data type should be used

Overrides:
correctOperationSQL in class DBSystem

correctSQLLiteral

public java.lang.String correctSQLLiteral(java.lang.String value)
Description copied from class: DBSystem
Corrects the given SQL literal by adding additional escape characters to allow the value to be as is. For example, "can't" becomes "can''t". Otherwise, running the SQL would terminate the literal when it found the first "'".

Overrides:
correctSQLLiteral in class DBSystem

getColumnDataTypeName

public java.lang.String getColumnDataTypeName(FieldDescriptorRow oldFD)
Gets the correct column data type name for the FD on this system. This method is invoked on a DBSystem when the SQL for creating a new table on that system is being generated from the FD's of another table. The two tables may be on different systems. A null return value indicates that the same data type name is used for the new & old tables. For some data types the column length may have to be included.

Overrides:
getColumnDataTypeName in class DBSystem
Parameters:
oldFD - The FD for the column of the existing table

getColumnIndicationCharacter

public java.lang.String getColumnIndicationCharacter()
Returns the character that needs to be used during an insert. This char may be different for different DBSystems, so if necessary, override this method to return the required char An Example in MySQL: insert into depvdta (`TYPE`, `key`, `value`) values (6, 'HeHa', 'Yo') In this example the MySQLDBSystem should return a ` char The AS400DBSystem would return a " char

This char will is necessary when a column name is the same as a reserved keyword for this DBSystem. Such as KEY or USER Creation date: (6/23/2003 2:27:41 PM)

Overrides:
getColumnIndicationCharacter in class DBSystem

getColumnPrimaryKeyName

public java.lang.String getColumnPrimaryKeyName(FieldDescriptorRow oldFD)
Gets the correct column name which a primary key on this system should refer to for the FD. This method is invoked on a DBSystem when the SQL for creating a new table on that system is being generated from the FD's of another table. The two tables may be on different systems. This method returns the name of the column as referenced by the PRIMARY KEY clause of the CREATE TABLE statement. For some data types and systems, a length may need to be included with the column name (to indicate that the primary key should only look at a certain number of characters in the column)

Overrides:
getColumnPrimaryKeyName in class DBSystem
Parameters:
oldFD - The FD for the column of the existing table

getLibrarySupportLevel

public byte getLibrarySupportLevel()
Gets the level of library support; this is one of the constants defined in the class. By default, libraries are required. Subclasses may override this method to indicate a different level of library support.

Overrides:
getLibrarySupportLevel in class DBSystem

handleConnectionEvent

public void handleConnectionEvent(ConnectionEvent ce)
Invoked when a connection event occurs

Overrides:
handleConnectionEvent in class DBSystem

setURL

protected void setURL(java.lang.String pURL)
Sets the url of the system.

Overrides:
setURL in class DBSystem