All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.bitmechanic.sql.SQLUtil

com.bitmechanic.sql.SQLUtil

public class SQLUtil
A set of utility SQL methods. Not really related to the JDBC Pool, but included because you might find it useful

Version:
$Id: SQLUtil.java,v 1.5 1998/09/16 07:28:21 pixel Exp $
Author:
James Cooper

Constructor Index

 o SQLUtil()

Method Index

 o booleanToString(boolean)
returns "y" if b is true.
 o escapeString(String)
Calls escapeString(str, int) with a length of 999999
 o escapeString(String, int)
Escapes ' with '' and truncates the string to the length specified.
 o formatHiResMysqlDate(Date)
Formats a date using the SimpleDateFormat "yyyy-MM-dd HH:mm:ss"
 o formatMysqlDate(Date)
Formats a date using the SimpleDateFormat "yyyy-MM-dd"
 o notNull(String)
Checks if str is null, and if it is returns an empty string.
 o parseMysqlDate(String)
 o stringToBoolean(String)
returns true if str is not null and equals "y" otherwise returns true

Constructors

 o SQLUtil
 public SQLUtil()

Methods

 o escapeString
 public static String escapeString(String str)
Calls escapeString(str, int) with a length of 999999

 o escapeString
 public static String escapeString(String str,
                                   int length)
Escapes ' with '' and truncates the string to the length specified.

Parameters:
str - String to escape
length - Maximum allowable length of string
 o notNull
 public static String notNull(String str)
Checks if str is null, and if it is returns an empty string. Otherwise returns str itself. Useful for wrapping around calls to rs.getString() since that will return null if the field is undefined.

 o formatMysqlDate
 public static String formatMysqlDate(Date date)
Formats a date using the SimpleDateFormat "yyyy-MM-dd"

 o parseMysqlDate
 public static Date parseMysqlDate(String date_str)
 o formatHiResMysqlDate
 public static String formatHiResMysqlDate(Date date)
Formats a date using the SimpleDateFormat "yyyy-MM-dd HH:mm:ss"

 o booleanToString
 public static String booleanToString(boolean b)
returns "y" if b is true. otherwise returns "n"

 o stringToBoolean
 public static boolean stringToBoolean(String str)
returns true if str is not null and equals "y" otherwise returns true


All Packages  Class Hierarchy  This Package  Previous  Next  Index