gistoolkit.datasources
Class SimpleSQLConverter

java.lang.Object
  extended bygistoolkit.datasources.SimpleSQLConverter
All Implemented Interfaces:
SQLConverter
Direct Known Subclasses:
DB2SQLConverter, MySQLConverter, OracleSQLConverter, PostGISSQLConverter

public class SimpleSQLConverter
extends java.lang.Object
implements SQLConverter

Class to convert java types and AttributeTypes to SQL for a particular database.


Constructor Summary
SimpleSQLConverter()
          Creates a new instance of SimpleSQLConverter
 
Method Summary
 AttributeType getAttributeType(java.sql.ResultSetMetaData inrmet, int inIndex)
          Convert the given ODBC type of data to the GISToolkit type of data.
 java.lang.String toSQL(java.lang.Object inObject, AttributeType inAttributeType, int inJDBCType)
          Take the given type, of the given value, and convert it to the sql string needed for insertion into the database.
 java.lang.String toSQLDate(java.util.Date inDate, AttributeType inAttributeType)
          Convert a java date into the JDBC date representaion for this database.
 java.lang.String toSQLDate(java.lang.Object inObject, AttributeType inAttributeType)
          Convert the object to the JDBC Date representaion for the database.
 java.lang.String toSQLDate(java.lang.String inDate, AttributeType inAttributeType)
          Convert a string into the JDBC date representaion for this database.
 java.lang.String toSQLDecimal(java.lang.Object inDecimal, AttributeType inAttributeType)
          Convert an object into the JDBC decimal representaion for this database.
 java.lang.String toSQLInteger(java.lang.Object inInteger, AttributeType inAttributeType)
          Convert an object into the JDBC Integer representaion for this database.
 java.lang.String toSQLString(java.lang.Object inObject, AttributeType inAttributeType)
          Convert the object to a JDBC Character representation for the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSQLConverter

public SimpleSQLConverter()
Creates a new instance of SimpleSQLConverter

Method Detail

getAttributeType

public AttributeType getAttributeType(java.sql.ResultSetMetaData inrmet,
                                      int inIndex)
                               throws java.sql.SQLException
Convert the given ODBC type of data to the GISToolkit type of data.

Specified by:
getAttributeType in interface SQLConverter
Throws:
java.sql.SQLException

toSQL

public java.lang.String toSQL(java.lang.Object inObject,
                              AttributeType inAttributeType,
                              int inJDBCType)
Take the given type, of the given value, and convert it to the sql string needed for insertion into the database. In the case of strings, this routine will add the appostraphies as needed.

Specified by:
toSQL in interface SQLConverter

toSQLString

public java.lang.String toSQLString(java.lang.Object inObject,
                                    AttributeType inAttributeType)
Convert the object to a JDBC Character representation for the database. It will add any delimiting characters like the beginning and ending appostraphies, as well as converting the embedded appostraphies to duplicate appostraphies.

Specified by:
toSQLString in interface SQLConverter

toSQLDate

public java.lang.String toSQLDate(java.lang.Object inObject,
                                  AttributeType inAttributeType)
Convert the object to the JDBC Date representaion for the database. It will add any delimited characters, or functions to the database like, to_Date(format, date string) stuff.

Specified by:
toSQLDate in interface SQLConverter

toSQLDate

public java.lang.String toSQLDate(java.util.Date inDate,
                                  AttributeType inAttributeType)
Convert a java date into the JDBC date representaion for this database.

Specified by:
toSQLDate in interface SQLConverter

toSQLDate

public java.lang.String toSQLDate(java.lang.String inDate,
                                  AttributeType inAttributeType)
Convert a string into the JDBC date representaion for this database.

Specified by:
toSQLDate in interface SQLConverter

toSQLInteger

public java.lang.String toSQLInteger(java.lang.Object inInteger,
                                     AttributeType inAttributeType)
Convert an object into the JDBC Integer representaion for this database.

Specified by:
toSQLInteger in interface SQLConverter

toSQLDecimal

public java.lang.String toSQLDecimal(java.lang.Object inDecimal,
                                     AttributeType inAttributeType)
Convert an object into the JDBC decimal representaion for this database.

Specified by:
toSQLDecimal in interface SQLConverter