|
SolarMetric Kodo JDO 2.4.3 generated on March 27 2003 | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
AbstractDictionary | Abstrract implementation of the DBDictionary interface for generic SQL. |
CloudscapeDictionary | Implementation of the DBDictionary interface for Cloudscape SQL. |
DaffodilDictionary | Implementation of the DBDictionary interface for DaffodilDB. |
DB2Dictionary | Implementation of the DBDictionary interface for IBM DB2. |
GenericDictionary | Concrete implementation of the DBDictionary interface for generic SQL. |
HSQLDictionary | Implementation of the DBDictionary interface for Hypersonic SQL. |
HSQLTCKDictionary | Implementation of the DBDictionary interface for Hypersonic SQL, used to pass the JDO TCK. |
InformixDictionary | Dictionary for Informix. |
InstantDBDictionary | Implementation of the DBDictionary interface for InstantDB. |
InterbaseDictionary | Dictionary for Interbase 6.0. |
MySQLDictionary | Implementation of the DBDictionary interface for MySQL. |
OracleDictionary | Implementation of the DBDictionary interface for Oracle. |
PointbaseDictionary | Implementation of the DBDictionary interface for Pointbase Embedded. |
PostgresDictionary | Implementation of DBDictionary for PostgreSQL. |
SQLServerDictionary | Implementation of the DBDictionary interface for MS SQLServer. |
SQLTypeMap | Maps of java types to their SQL counterparts for a particular database. |
SybaseDictionary | Implementation of the DBDictionary interface for Sybase |
DB Dictionaries
This package provides database plugins for schema manipulation on different relational database products.
Sample Code
The following represents a sample custom dictionary:
package com.solarmetric.kodo.impl.jdbc.schema.dict;
import java.sql.*;
/**
* Implementation of the DBDictionary interface for Postgresql.
*
* @author Abe White
*/
public class PostgresDictionary
extends GenericDictionary
{
public String getPlatform ()
{
return "Postgres";
}
/**
* Postgres does not support locking on distinct selects.
*/
public String toSelect (String cols, String tables, String where,
String order, boolean distinct, boolean update)
{
String sql = super.toSelect (cols, tables, where, order, distinct,
false);
if (update && !distinct)
return sql + " FOR UPDATE";
return sql;
}
/**
* PostgreSQL seems to use '\' as a quote character as well
* as '.
*/
protected String stringToSQL (String string)
{
StringBuffer buf = new StringBuffer (string.length () + 10);
buf.append ('\'');
for (int i = 1; i < string.length (); i++)
{
if (string.charAt (i) == '\\' || string.charAt (i) == '\'')
buf.append ('\\');
buf.append (string.charAt (i));
}
buf.append ('\'');
return buf.toString ();
}
protected String timestampToSQL (Timestamp val)
{
// postgres does not support the standard
// {ts 'datestring'} format, but it does understand
// just the string value of the timestamp.
return "'" + val.toString () + "'";
}
protected void setupSQLTypeMap (SQLTypeMap map)
{
map.setUnlimitedStringType ("TEXT");
map.setDateType ("TIMESTAMP");
map.setBooleanType ("INT2");
map.setByteType ("INT2");
map.setShortType ("INT2");
map.setDoubleType ("FLOAT");
map.setFloatType ("FLOAT");
map.setIntType ("INT4");
map.setLongType ("INT8");
}
}
|
SolarMetric Kodo JDO 2.4.3 generated on March 27 2003 | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |