org.melati.poem.dbms
Class MSAccess

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

public class MSAccess
extends AnsiStandard

A Driver for the Microsoft Access database server. http://www.tobychampion.co.uk/Access2000Dialect.java.txt


Nested Class Summary
static class MSAccess.MSAccessStringPoemType
          Translates a MSSQL String into a Poem StringPoemType.
 
Field Summary
static int msAccessBinarySize
          Size of binary fields.
static int msAccessMemoSize
          Size of memo fields.
static int msAccessTextHack
          Size of text fields.
 
Fields inherited from class org.melati.poem.dbms.AnsiStandard
schema
 
Constructor Summary
MSAccess()
          Constructor.
 
Method Summary
 String alterColumnNotNullableSQL(String tableName, Column column)
          Accommodate SQLServer syntax.
 boolean canDropColumns()
          Whether this DBMS can drop columns.
 PoemType canRepresent(PoemType storage, PoemType type)
          Enable one PoemType to represent another, for example a bit to represent a boolean.
 boolean canStoreBlobs()
          Whether this DBMS can store binary data.
 String caseInsensitiveRegExpSQL(String term1, String term2)
          This is the Postgresql syntax.
 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 getFixedPtSqlDefinition(int scale, int precision)
          Cludge? Accomodate differing Fixed Point notations.
 String getLongSqlDefinition()
          Accomodate Long / Bigint deviants.
 String getSqlDefaultValue(SQLType sqlType)
          Used to set a not null value when creating a non nullable column.
 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 melatiName(String name)
          Ignore tables starting with '~', which should probably have a jdbc type of 'SYSTEM TABLE'.
 String selectLimit(String querySelection, int limit)
          Accomodate different limiting syntax.
 void shutdown(Connection connection)
          A no-op for all but hsqldb, where the db needs to be shutdown when the servlet container or jvm is destroyed.
 String sqlBooleanValueOfRaw(Object raw)
          Accomodate different true and false values.
 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 org.melati.poem.dbms.AnsiStandard
booleanTrueExpression, canBeIndexed, createTableOptionsSql, createTableSql, createTableTypeQualifierSql, exceptionForUpdate, exceptionForUpdate, getConnection, getDriverClassName, getDriverLoaded, getForeignKeyDefinition, getIndexLength, getJdbcMetadataName, getPrimaryKeyDefinition, getQuotedName, getQuotedValue, getSchema, givesCapabilitySQL, loadDriver, preparedStatementPlaceholder, setDriverClassName, setDriverLoaded, tableInitialisationSql, toString, unloadDriver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

msAccessTextHack

public static final int msAccessTextHack
Size of text fields.

See Also:
Constant Field Values

msAccessMemoSize

public static final int msAccessMemoSize
Size of memo fields.

See Also:
Constant Field Values

msAccessBinarySize

public static final int msAccessBinarySize
Size of binary fields.

See Also:
Constant Field Values
Constructor Detail

MSAccess

public MSAccess()
Constructor.

Method Detail

canDropColumns

public boolean canDropColumns()
Whether this DBMS can drop columns.

Specified by:
canDropColumns in interface Dbms
Overrides:
canDropColumns in class AnsiStandard
Returns:
true if we can
See Also:
AnsiStandard.canDropColumns()

canStoreBlobs

public boolean canStoreBlobs()
Whether this DBMS can store binary data.

Specified by:
canStoreBlobs in interface Dbms
Overrides:
canStoreBlobs in class AnsiStandard
Returns:
true if we can
See Also:
Dbms.canStoreBlobs()

shutdown

public void shutdown(Connection connection)
              throws SQLException
A no-op for all but hsqldb, where the db needs to be shutdown when the servlet container or jvm is destroyed.

Specified by:
shutdown in interface Dbms
Overrides:
shutdown in class AnsiStandard
Throws:
SQLException
See Also:
AnsiStandard.shutdown(java.sql.Connection)

unreservedName

public String unreservedName(String name)
A pair of functions for getting around keywords which make your JDBC driver barf, as 'group' does for MySQL. Translate special names to non special ones.

Specified by:
unreservedName in interface Dbms
Overrides:
unreservedName in class AnsiStandard
Parameters:
name - the field or table name
Returns:
the name translated if necessary
See Also:
AnsiStandard.unreservedName(java.lang.String)

melatiName

public String melatiName(String name)
Ignore tables starting with '~', which should probably have a jdbc type of 'SYSTEM TABLE'. Reverse the mapping in unreservedName.

Specified by:
melatiName in interface Dbms
Overrides:
melatiName in class AnsiStandard
Parameters:
name - an SQL name
Returns:
the coresponding name to use within Melati
See Also:
AnsiStandard.melatiName(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)

getLongSqlDefinition

public String getLongSqlDefinition()
Accomodate Long / Bigint deviants.

Specified by:
getLongSqlDefinition in interface Dbms
Overrides:
getLongSqlDefinition in class AnsiStandard
Returns:
the keyword to use.
See Also:
AnsiStandard.getLongSqlDefinition()

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)

getFixedPtSqlDefinition

public String getFixedPtSqlDefinition(int scale,
                                      int precision)
                               throws SQLException
Cludge? Accomodate differing Fixed Point notations.

Specified by:
getFixedPtSqlDefinition in interface Dbms
Overrides:
getFixedPtSqlDefinition in class AnsiStandard
Parameters:
scale - the number of places to right of decimal point
precision - how many digits in total
Returns:
the keywords to use
Throws:
SQLException - potentially
See Also:
AnsiStandard.getFixedPtSqlDefinition(int, int)

getBinarySqlDefinition

public String getBinarySqlDefinition(int size)
                              throws SQLException
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
Throws:
SQLException
See Also:
AnsiStandard.getBinarySqlDefinition(int)

sqlBooleanValueOfRaw

public String sqlBooleanValueOfRaw(Object raw)
Accomodate different true and false values.

Specified by:
sqlBooleanValueOfRaw in interface Dbms
Overrides:
sqlBooleanValueOfRaw in class AnsiStandard
Returns:
the DBMS specific truth and false values
See Also:
AnsiStandard.sqlBooleanValueOfRaw(java.lang.Object)

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)

caseInsensitiveRegExpSQL

public String caseInsensitiveRegExpSQL(String term1,
                                       String term2)
This is the Postgresql syntax. Accomodate the variety of ways of ignoring case.

Specified by:
caseInsensitiveRegExpSQL in interface Dbms
Overrides:
caseInsensitiveRegExpSQL in class AnsiStandard
Parameters:
term1 - the term to find in
term2 - the quoted term to find
Returns:
the SQL query to use
See Also:
AnsiStandard.caseInsensitiveRegExpSQL(java.lang.String, java.lang.String)

alterColumnNotNullableSQL

public String alterColumnNotNullableSQL(String tableName,
                                        Column column)
Accommodate SQLServer syntax. Return the SQL snippet to alter a column to not nullable.

Specified by:
alterColumnNotNullableSQL in interface Dbms
Overrides:
alterColumnNotNullableSQL in class AnsiStandard
Returns:
SQL snippet to set a column not nullable
See Also:
alterColumnNotNullableSQL(java.lang.String, java.lang.String)

selectLimit

public String selectLimit(String querySelection,
                          int limit)
Accomodate different limiting syntax.

Specified by:
selectLimit in interface Dbms
Overrides:
selectLimit in class AnsiStandard
Parameters:
querySelection - main body of query
limit - number to limit to
Returns:
limited query
See Also:
Dbms.selectLimit(java.lang.String, int)

getSqlDefaultValue

public String getSqlDefaultValue(SQLType sqlType)
Used to set a not null value when creating a non nullable column.

Specified by:
getSqlDefaultValue in interface Dbms
Overrides:
getSqlDefaultValue in class AnsiStandard
Parameters:
sqlType - the type name
Returns:
a String suitable for substitution in UPDATE table SET field = ?
See Also:
AnsiStandard.getSqlDefaultValue(org.melati.poem.SQLType)


Copyright © 2000-2010 PanEris. All Rights Reserved.