org.melati.poem.dbms
Class Mckoi

Package class diagram package Mckoi
java.lang.Object
  extended by org.melati.poem.dbms.AnsiStandard
      extended by org.melati.poem.dbms.Mckoi
All Implemented Interfaces:
Dbms

public class Mckoi
extends AnsiStandard

A Driver for Mckoidb (http://www.mckoi.com/).


Field Summary
static int mckoiBinaryHack
          Size of binary fields.
static int mckoiTextHack
          Size of text fields.
 
Fields inherited from class org.melati.poem.dbms.AnsiStandard
schema
 
Constructor Summary
Mckoi()
          Constructor.
 
Method Summary
 PoemType canRepresent(PoemType storage, PoemType type)
          Enable one PoemType to represent another, for example a bit to represent a boolean.
 SQLPoemType defaultPoemTypeOfColumnMetaData(ResultSet md)
          The simplest POEM type corresponding to a JDBC description from the database.
 String getBinarySqlDefinition(int size)
          Accomodate different treatment of different sized binary data.
 String getQuotedName(String name)
          Accomodate different quoting strategies.
 String getSqlDefinition(String sqlTypeName)
          Retrieve a 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.
 
Methods inherited from class org.melati.poem.dbms.AnsiStandard
alterColumnNotNullableSQL, booleanTrueExpression, canBeIndexed, canDropColumns, canStoreBlobs, caseInsensitiveRegExpSQL, createTableOptionsSql, createTableSql, createTableTypeQualifierSql, exceptionForUpdate, exceptionForUpdate, getConnection, getDriverClassName, getDriverLoaded, getFixedPtSqlDefinition, getForeignKeyDefinition, getIndexLength, getJdbcMetadataName, getLongSqlDefinition, getPrimaryKeyDefinition, getQuotedValue, getSchema, getSqlDefaultValue, loadDriver, melatiName, preparedStatementPlaceholder, selectLimit, setDriverClassName, setDriverLoaded, shutdown, sqlBooleanValueOfRaw, tableInitialisationSql, toString, unloadDriver, unreservedName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mckoiTextHack

public static final int mckoiTextHack
Size of text fields.

See Also:
Constant Field Values

mckoiBinaryHack

public static final int mckoiBinaryHack
Size of binary fields.

See Also:
Constant Field Values
Constructor Detail

Mckoi

public Mckoi()
Constructor.

Method Detail

getBinarySqlDefinition

public String getBinarySqlDefinition(int size)
Accomodate different treatment of different sized binary data.

Specified by:
getBinarySqlDefinition in interface Dbms
Overrides:
getBinarySqlDefinition in class AnsiStandard
Parameters:
size - how big the field is
Returns:
the keyword to use
See Also:
AnsiStandard.getBinarySqlDefinition(int)

getStringSqlDefinition

public String getStringSqlDefinition(int size)
                              throws SQLException
Accomodate String / Text distinction.

Specified by:
getStringSqlDefinition in interface Dbms
Overrides:
getStringSqlDefinition in class AnsiStandard
Parameters:
size - the string length (-1 means no limit)
Returns:
the SQL definition for a string of this size
Throws:
SQLException
See Also:
AnsiStandard.getStringSqlDefinition(int)

getQuotedName

public String getQuotedName(String name)
Accomodate different quoting strategies.

Specified by:
getQuotedName in interface Dbms
Overrides:
getQuotedName in class AnsiStandard
Parameters:
name - the unquoted name
Returns:
the name quoted (or not) appropriate for this Dbms
See Also:
AnsiStandard.getQuotedName(java.lang.String)

getSqlDefinition

public String getSqlDefinition(String sqlTypeName)
Retrieve a SQL type keyword used by the DBMS for the given Melati type name. Override this in non-Ansi standard dbms to handle variants.

Specified by:
getSqlDefinition in interface Dbms
Overrides:
getSqlDefinition in class AnsiStandard
Parameters:
sqlTypeName - the Melati internal type name
Returns:
this dbms specific type keyword
See Also:
AnsiStandard.getSqlDefinition(java.lang.String)
To do something:
Check against modern McKoi

canRepresent

public PoemType canRepresent(PoemType storage,
                             PoemType type)
Enable one PoemType to represent another, for example a bit to represent a boolean.

Specified by:
canRepresent in interface Dbms
Overrides:
canRepresent in class AnsiStandard
Parameters:
storage - the POEM native type
type - the current type
Returns:
the PoemType to use
See Also:
AnsiStandard.canRepresent(org.melati.poem.PoemType, org.melati.poem.PoemType)

defaultPoemTypeOfColumnMetaData

public SQLPoemType defaultPoemTypeOfColumnMetaData(ResultSet md)
                                            throws SQLException
The simplest POEM type corresponding to a JDBC description from the database.

Specified by:
defaultPoemTypeOfColumnMetaData in interface Dbms
Overrides:
defaultPoemTypeOfColumnMetaData in class AnsiStandard
Parameters:
md - the JDBC metadata
Returns:
the PoemType to use
Throws:
SQLException - potentially
See Also:
AnsiStandard.defaultPoemTypeOfColumnMetaData(java.sql.ResultSet)

givesCapabilitySQL

public String givesCapabilitySQL(Integer userTroid,
                                 String capabilityExpr)
MySQL had no EXISTS keyword, from 4.1 onwards it does. NOTE There is a bootstrap problem here, we need to use the unchecked troid, otherwise we get a stack overflow. SQL string to get a Capability.

Specified by:
givesCapabilitySQL in interface Dbms
Overrides:
givesCapabilitySQL in class AnsiStandard
Parameters:
userTroid - the troid of the User to use in the query
capabilityExpr - the capability troid we need
Returns:
the SQL query to use
See Also:
AnsiStandard.givesCapabilitySQL(java.lang.Integer, java.lang.String)


Copyright © 2000-2010 PanEris. All Rights Reserved.