com.jdbwc.core.util
Class SQLUtils

java.lang.Object
  extended by com.jdbwc.core.util.SQLUtils

public final class SQLUtils
extends java.lang.Object

Version:
2008-05-29, 2010-04-10
Author:
Tim Gall (Oz-DevWorX)

Constructor Summary
SQLUtils()
           
 
Method Summary
static int getNumberFromString(java.lang.String input)
           
static boolean isEmptyOrWhitespaceOnly(java.lang.String str)
           
protected static boolean isNullOrEmpty(java.lang.String value)
           
protected static SQLField[] rebuildFieldSet(SQLField[] newFields, SQLField[] myFieldSet)
          Increases the size of this.fieldSet and adds a new Field to the array.
protected static SQLField[] rebuildFieldSet(SQLField newField, SQLField[] myFieldSet)
          Increases the size of this.fieldSet and adds a new Field to the array.
protected static java.lang.String[] removeBlanks(java.lang.String[] sqlStringArray)
          Remove empty entries from an array.
Designed specifically for cleaning up string arrays constructed using split(regex) methods.
protected static java.lang.String stripComments(java.lang.String src)
           
static java.lang.String stripComments(java.lang.String src, java.lang.String stringOpens, java.lang.String stringCloses)
           
protected static java.lang.String stripComments(java.lang.String src, java.lang.String stringOpens, java.lang.String stringCloses, boolean slashStarComments, boolean slashSlashComments, boolean hashComments, boolean dashDashComments)
          Returns the given string, with comments removed
protected static java.lang.String stripWhiteSpace(java.lang.String sqlString)
          Strip out excess whitespace characters.
ie:
newlines, carriage returns, tabs, and multiple consecutive spaces are all converted to a single space.
The result should not contain any consecutive whitespace characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLUtils

public SQLUtils()
Method Detail

rebuildFieldSet

protected static SQLField[] rebuildFieldSet(SQLField newField,
                                            SQLField[] myFieldSet)
Increases the size of this.fieldSet and adds a new Field to the array.

Parameters:
newField - a new Field to add to the result sieldSet.

rebuildFieldSet

protected static SQLField[] rebuildFieldSet(SQLField[] newFields,
                                            SQLField[] myFieldSet)
Increases the size of this.fieldSet and adds a new Field to the array.

Parameters:
newFields - a new Field array to add to the rebuiltSet.
myFieldSet -
Returns:
array of SQLField MetaData

removeBlanks

protected static java.lang.String[] removeBlanks(java.lang.String[] sqlStringArray)
Remove empty entries from an array.
Designed specifically for cleaning up string arrays constructed using split(regex) methods.

Parameters:
sqlStringArray - An array with potentially empty indexes.
Returns:
An array without empty indexes.

stripWhiteSpace

protected static java.lang.String stripWhiteSpace(java.lang.String sqlString)
Strip out excess whitespace characters.
ie:
newlines, carriage returns, tabs, and multiple consecutive spaces are all converted to a single space.
The result should not contain any consecutive whitespace characters.

Parameters:
sqlString - A String to clean
Returns:
A String without excess whitespace characters.

isNullOrEmpty

protected static boolean isNullOrEmpty(java.lang.String value)

stripComments

protected static java.lang.String stripComments(java.lang.String src)

stripComments

public static java.lang.String stripComments(java.lang.String src,
                                             java.lang.String stringOpens,
                                             java.lang.String stringCloses)

stripComments

protected static java.lang.String stripComments(java.lang.String src,
                                                java.lang.String stringOpens,
                                                java.lang.String stringCloses,
                                                boolean slashStarComments,
                                                boolean slashSlashComments,
                                                boolean hashComments,
                                                boolean dashDashComments)
Returns the given string, with comments removed

Parameters:
src - the source string
stringOpens - characters which delimit the "open" of a string
stringCloses - characters which delimit the "close" of a string, in counterpart order to stringOpens
slashStarComments - strip slash-star type "C" style comments
slashSlashComments - strip slash-slash C++ style comments to end-of-line
hashComments - strip #-style comments to end-of-line
dashDashComments - strip "--" style comments to end-of-line
Returns:
the input string with all comment-delimited data removed

isEmptyOrWhitespaceOnly

public static final boolean isEmptyOrWhitespaceOnly(java.lang.String str)

getNumberFromString

public static int getNumberFromString(java.lang.String input)