butler.sql.util
Class SQLHelper

java.lang.Object
  extended by butler.sql.util.SQLHelper
Direct Known Subclasses:
Frontbase_SQLHelper, Informix_SQLHelper, MySQL_SQLHelper, Oracle_SQLHelper, Postgres_SQLHelper, SQLServer_SQLHelper

public class SQLHelper
extends java.lang.Object

Helper class for providing misc database vendor specific information. This class has subclasses for every database vendor that has specific information.

Author:
Fredrik

Constructor Summary
SQLHelper()
           
 
Method Summary
 boolean checkDuplicateBeforeInsert()
           
 java.lang.Exception createException(java.sql.SQLException e)
           
 java.lang.Object db2obj(java.lang.Object obj, Column col)
           
 java.lang.String getColumnTypeSQL(Column col)
           
static SQLHelper getHelper(java.sql.DatabaseMetaData meta)
          Returns the helper for given database.
 java.lang.Class getJavaClass(int type)
          Deprecated. Use Datatype.getJavaClass instead.
 java.lang.String getJoinAliasKeyword()
           
 java.lang.String getQuote()
          Returns the character that is used as a quote.
 java.lang.String getTypeName(int type)
          Returns the column type name that is used in create table statements.
 void populateStatement(JPreparedStatement stmt, int index, Record rec, Column col, java.lang.Object value)
           
 boolean supportsForeignKeys()
           
 boolean supportsIndexes()
           
 boolean useCatalog()
          Tells if catalog should be used in qualified names for tables.
 boolean useColumnAliasInOrderBy()
           
 boolean useSchema()
          Tells if schema should be used in qualified names for tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLHelper

public SQLHelper()
Method Detail

getHelper

public static SQLHelper getHelper(java.sql.DatabaseMetaData meta)
                           throws java.lang.Exception
Returns the helper for given database.

Throws:
java.lang.Exception

getTypeName

public java.lang.String getTypeName(int type)
                             throws java.lang.Exception
Returns the column type name that is used in create table statements.

Throws:
java.lang.Exception

getColumnTypeSQL

public java.lang.String getColumnTypeSQL(Column col)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getJavaClass

public java.lang.Class getJavaClass(int type)
                             throws java.lang.Exception
Deprecated. Use Datatype.getJavaClass instead.

Returns the java class that the jdbc driver uses for given type.

Throws:
java.lang.Exception

getQuote

public java.lang.String getQuote()
Returns the character that is used as a quote.


useCatalog

public boolean useCatalog()
Tells if catalog should be used in qualified names for tables.


useSchema

public boolean useSchema()
Tells if schema should be used in qualified names for tables.


populateStatement

public void populateStatement(JPreparedStatement stmt,
                              int index,
                              Record rec,
                              Column col,
                              java.lang.Object value)
                       throws java.lang.Exception
Throws:
java.lang.Exception

getJoinAliasKeyword

public java.lang.String getJoinAliasKeyword()

db2obj

public java.lang.Object db2obj(java.lang.Object obj,
                               Column col)
                        throws java.lang.Exception
Throws:
java.lang.Exception

createException

public java.lang.Exception createException(java.sql.SQLException e)

useColumnAliasInOrderBy

public boolean useColumnAliasInOrderBy()

checkDuplicateBeforeInsert

public boolean checkDuplicateBeforeInsert()

supportsIndexes

public boolean supportsIndexes()

supportsForeignKeys

public boolean supportsForeignKeys()