JCas
v0.3.1

cas.sql
Class SQLTools

java.lang.Object
  extended bycas.sql.SQLTools

public class SQLTools
extends Object

SQL Utilities. This class implements utilities for creating and retrieving information with SQL.

Version:
1.0
Author:
Ralph Schuster

Constructor Summary
SQLTools()
           
 
Method Summary
static boolean getBoolean(String b)
          Returns true if the string is not null and equals Y, false otherwise.
static char getChar(String s)
          Helper function for reading char values from database that can be NULL.
static Date getDate(String s)
          Returns the date given as string as a Java object.
static int getInt(String s)
          Helper function for reading int values from database that can be NULL.
static long getLong(String s)
          Helper function for reading long values from database that can be NULL.
static String prepareBoolean(boolean b)
          Returns 'Y' or 'N' for the argument.
static String prepareBoolean(Boolean b)
          Returns 'Y' or 'N' or NULL for the argument.
static String prepareBoolean(Object b)
          Returns 'Y' or 'N' or NULL for the argument.
static String prepareChar(Object l)
          Preapres a char value for a NULLable field.
static String prepareComparableInt(Object l)
          Preapres an int value for a NULLable field.
static String prepareComparableLong(long l)
          Prepares a long value for a NULLable field.
static String prepareComparableLong(Object l)
          Prepares a long value for a NULLable field.
static String prepareDate(Date d)
          Returns the Java Data as a formatted string for use in Oracle databases.
static String prepareInt(Object l)
          Preapres an int value for a NULLable field.
static String prepareLong(Object l)
          Prepares a long value for a NULLable field.
static String prepareString(Object s)
          Prepares a String for use in a SQL Statement.
static String prepareString(String s)
          Prepares a String for use in a SQL Statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLTools

public SQLTools()
Method Detail

prepareString

public static String prepareString(Object s)
Prepares a String for use in a SQL Statement.


prepareString

public static String prepareString(String s)
Prepares a String for use in a SQL Statement.


prepareBoolean

public static String prepareBoolean(boolean b)
Returns 'Y' or 'N' for the argument.


prepareBoolean

public static String prepareBoolean(Boolean b)
Returns 'Y' or 'N' or NULL for the argument.


prepareBoolean

public static String prepareBoolean(Object b)
Returns 'Y' or 'N' or NULL for the argument.


getBoolean

public static boolean getBoolean(String b)
Returns true if the string is not null and equals Y, false otherwise.


prepareDate

public static String prepareDate(Date d)
Returns the Java Data as a formatted string for use in Oracle databases.

Parameters:
d - date
Returns:
date as TO_DATE('<date>', 'DDMMYYYYHH24MISS')

getDate

public static Date getDate(String s)
Returns the date given as string as a Java object. The date should be retrieved from Oracle databases with TO_CHAR(<column>, 'DDMMYYYYHH24MISS').

Parameters:
s - date as a formatted string "ddMMyyyyHHmmss".

getLong

public static long getLong(String s)
Helper function for reading long values from database that can be NULL.

Returns:
value of s as long if string is not null or -1 otherwise

prepareLong

public static String prepareLong(Object l)
Prepares a long value for a NULLable field.


prepareComparableLong

public static String prepareComparableLong(Object l)
Prepares a long value for a NULLable field.


prepareComparableLong

public static String prepareComparableLong(long l)
Prepares a long value for a NULLable field.


getInt

public static int getInt(String s)
Helper function for reading int values from database that can be NULL.

Returns:
value of s as int if string is not null or -1 otherwise

prepareInt

public static String prepareInt(Object l)
Preapres an int value for a NULLable field.


prepareComparableInt

public static String prepareComparableInt(Object l)
Preapres an int value for a NULLable field.


getChar

public static char getChar(String s)
Helper function for reading char values from database that can be NULL.

Returns:
value of s as char if string is not null or -1 otherwise

prepareChar

public static String prepareChar(Object l)
Preapres a char value for a NULLable field.


JCas
v0.3.1