    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

##

SQLUtil()

##

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

##

SQLUtil

     public SQLUtil()

##

escapeString

     public static String escapeString(String str)

  Calls escapeString(str, int) with a length of 999999

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

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.

formatMysqlDate

     public static String formatMysqlDate(Date date)

  Formats a date using the SimpleDateFormat "yyyy-MM-dd"

parseMysqlDate

     public static Date parseMysqlDate(String date_str)

formatHiResMysqlDate

     public static String formatHiResMysqlDate(Date date)

  Formats a date using the SimpleDateFormat "yyyy-MM-dd HH:mm:ss"

booleanToString

     public static String booleanToString(boolean b)

  returns "y" if b is true. otherwise returns "n"

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