com.partnersoft.io.sql
Class SQLLib

java.lang.Object
  extended by com.partnersoft.io.sql.SQLLib

public class SQLLib
extends java.lang.Object

Convenience methods for dealing with the wonderful "English-like" world of SQL. Blech.

Author:
brad gray, paul reavis Copyright 2000-2003 Partner Software, Inc.

Constructor Summary
SQLLib()
           
 
Method Summary
static java.lang.String buildCreateStatementFor(java.sql.Connection connexion, java.lang.String tableName)
          Returns a String containing a create table statement for the given table on the given connection.
static java.lang.String buildCreateStatementFor(java.sql.ResultSet results, java.lang.String tableName)
          Returns a String containing a create table statement for the given table on the given connection.
static java.lang.String convert(java.lang.Object victim)
          Does smart conversion on objects to turn them into SQL-compatible strings.
static java.lang.String convertAndQuote(java.lang.Object victim)
          Does smart conversion on objects to turn them into SQL-compatible values.
static java.lang.String getDriverForType(java.lang.String type)
          Gives you the class name for a driver based on a simpler "type" of database.
static DatabaseConnectionConfig getNamedConfig(java.lang.String name)
           
static java.lang.String makeURL(java.lang.String type, java.lang.String server, java.lang.String database, java.lang.String databasePath, java.lang.String properties)
           
static boolean sqlTypeRequiresLength(int sqlType)
          Returns true if the type requires a length specification.
static java.lang.String sqlTypeToMySQLString(int sqlType)
          Returns a string representation of the MySQL equivalent of an SQL column type ID code.
static java.lang.String sqlTypeToMySQLString(int sqlType, int size)
          Returns a string representation of the MySQL equivalent of an SQL column type ID code.
static java.lang.String sqlTypeToString(int sqlType)
          Returns a string representation of an SQL column type ID code.
static java.util.Set tablesInQuery(java.lang.String query)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLLib

public SQLLib()
Method Detail

getNamedConfig

public static DatabaseConnectionConfig getNamedConfig(java.lang.String name)

getDriverForType

public static java.lang.String getDriverForType(java.lang.String type)
Gives you the class name for a driver based on a simpler "type" of database.


makeURL

public static java.lang.String makeURL(java.lang.String type,
                                       java.lang.String server,
                                       java.lang.String database,
                                       java.lang.String databasePath,
                                       java.lang.String properties)

convert

public static java.lang.String convert(java.lang.Object victim)
Does smart conversion on objects to turn them into SQL-compatible strings.


convertAndQuote

public static java.lang.String convertAndQuote(java.lang.Object victim)
Does smart conversion on objects to turn them into SQL-compatible values. Adds quotes if appropriate.


tablesInQuery

public static java.util.Set tablesInQuery(java.lang.String query)

buildCreateStatementFor

public static java.lang.String buildCreateStatementFor(java.sql.Connection connexion,
                                                       java.lang.String tableName)
                                                throws java.sql.SQLException
Returns a String containing a create table statement for the given table on the given connection.

Throws:
java.sql.SQLException

buildCreateStatementFor

public static java.lang.String buildCreateStatementFor(java.sql.ResultSet results,
                                                       java.lang.String tableName)
                                                throws java.sql.SQLException
Returns a String containing a create table statement for the given table on the given connection.

Throws:
java.sql.SQLException

sqlTypeToString

public static java.lang.String sqlTypeToString(int sqlType)
Returns a string representation of an SQL column type ID code.


sqlTypeToMySQLString

public static java.lang.String sqlTypeToMySQLString(int sqlType)
Returns a string representation of the MySQL equivalent of an SQL column type ID code.


sqlTypeToMySQLString

public static java.lang.String sqlTypeToMySQLString(int sqlType,
                                                    int size)
Returns a string representation of the MySQL equivalent of an SQL column type ID code.


sqlTypeRequiresLength

public static boolean sqlTypeRequiresLength(int sqlType)
Returns true if the type requires a length specification.