Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.solarmetric.rd.kodo.impl.jdbc.schema.dict

DB Dictionaries

See:
Description

Class Summary
CloudscapeDictionary | Dictionary for Cloudscape database.
DaffodilDictionary | Dictionary for Daffodil database.
DB2Dictionary | Dictionary for IBM DB2 database.
HSQLDictionary | Dictionary for Hypersonic SQL database.
InformixDictionary | Dictionary for Informix database.
InstantDBDictionary | Dictionary for InstantDB database.
InterbaseDictionary | Dictionary for Interbase 6.0 database.
MySQLDictionary | Dictionary for MySQL.
OracleDictionary | Dictionary for Oracle.
PointbaseDictionary | Dictionary for Pointbase Embedded.
PostgresDictionary | Dictionary for Postgres.
SQLServerDictionary | Dictionary for MS SQLServer.
SybaseDictionary | Dictionary for Sybase.

## Package com.solarmetric.rd.kodo.impl.jdbc.schema.dict Description

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.rd.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");
    	}
    }

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.