|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.jdc.lang.Object
|
+--com.jdc.rdb.sql.SQLHelper
SQLHelper is a utility class that provides Structured Query
Language (SQL) helper methods to simplify the creation
of Table command statements. The following methods are
available:
SQLClauseHelper,
Serialized Form| Field Summary | |
static String |
COMMA
The SQL statement comma character. |
static String |
EQUALS
The SQL statement equals character. |
protected static String |
LEFT_PARENTHESIS
The SQL statement left parenthesis character. |
static String |
NULL
The SQL statement null keyword. |
protected static String |
RIGHT_PARENTHESIS
The SQL statement right parenthesis character. |
static String |
SPACE
The SQL statement space character. |
protected static String |
SUBSTITUTION_VALUE
The SQL statement substitution value character. |
| Fields inherited from class com.jdc.lang.Object |
string |
| Constructor Summary | |
SQLHelper()
Constructs a new SQLHelper object. |
|
| Method Summary | |
String |
addCommas(String[] sqlClauseItems)
Adds commas to SQL list items and return a comma-delimited SQL clause. |
String |
addDoubleQuotes(String sqlString)
Adds double quotes to the SQL string, if the SQL string is not already contained in double quotes. |
String |
addParentheses(String sqlString)
Adds parentheses to an SQL clause, if the SQL clause is not already contained in parentheses. |
String |
addSingleQuotes(String sqlString)
Adds single quotes to the SQL string, if the SQL string is not already contained in single quotes. |
String |
createNameValues(String[] columnNames,
String[] columnValues)
Sets the SET clause for the UPDATE command. |
Object |
formatValue(Column column,
Object value)
|
String |
formatValue(String columnName,
String columnValue)
Returns a formatted table column value of appropriate type for a database Insert or Update statement. |
String |
getQualifiedAlias(Table table)
Returns a fully-qualified database Table alias. |
Table |
getTable()
Returns the database table to execute the SQL command upon. |
boolean |
isPreparedStatement()
Returns true if creating an prepared, i.e. |
boolean |
isStatement()
Returns true if creating a static SQL statement. |
void |
logNoRequiredClause(String command,
String objectName,
String clauseKeyword)
Logs an error message for required SQL (DML) statement clause. |
static void |
main(String[] args)
Executes unit tests for the SQLHelper class. |
String |
removeDoubleQuotes(String sqlString)
Removes double quotes from SQL string, if present. |
void |
setPreparedStatement(boolean preparedStatement)
Sets the prepared SQL statement flag. |
void |
setTable(Table table)
Sets the database table to execute the SQL command upon. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String COMMA
public static final String EQUALS
protected static final String LEFT_PARENTHESIS
public static final String NULL
protected static final String RIGHT_PARENTHESIS
public static final String SPACE
protected static final String SUBSTITUTION_VALUE
| Constructor Detail |
public SQLHelper()
| Method Detail |
public Object formatValue(Column column,
Object value)
public String getQualifiedAlias(Table table)
Table alias.
Table alias.Intopublic String addCommas(String[] sqlClauseItems)
public String addDoubleQuotes(String sqlString)
public String removeDoubleQuotes(String sqlString)
public String addParentheses(String sqlString)
public String addSingleQuotes(String sqlString)
public String createNameValues(String[] columnNames,
String[] columnValues)
public String formatValue(String columnName,
String columnValue)
public Table getTable()
public boolean isPreparedStatement()
public boolean isStatement()
public void logNoRequiredClause(String command,
String objectName,
String clauseKeyword)
public void setPreparedStatement(boolean preparedStatement)
public void setTable(Table table)
public static void main(String[] args)
SQLHelper class.
|
2004.04.29 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||