Package anderix.datajets
Class SqlBuilder
java.lang.Object
anderix.datajets.SqlBuilder
Facilitates creation of SQL statements in an object-oriented manner. The basic
use of a SqlBuilder object follows this pattern:
- Instantiate SqlBuilder object
- Define table to connect to
- Define fields in that table
- Define identity field (if applicable)
- Set field values (if applicable)
- Return completed SQL statement
SELECT
statement:
//Example: creating a SELECT statement SqlBuilder sql = new SqlBuilder; String table = "my_table"; sql.setTable(table); String[] fields = new String[]{"field1", "field2"}; sql.setFieldList(fields); System.out.println(sql.selectStatement());SqlBuilder contains methods for adding
WHERE
clauses to
SELECT
, INSERT
, UPDATE
, and
DELETE
statements. There are also methods for adding
JOIN
, GROUP BY
, HAVING
,
and ORDER BY
clauses to SELECT
statements.
Calling these methods for INSERT
, UPDATE
or
DELETE
statements will have no effect.
Some statments require that the identity field be specified. This can be done
in the setFieldList
method or in an appropriate constructor. The
methods that require an identity field are:
selectByIdStatement
updateByIdStatement
deleteByIdStatement
INSERT
or UPDATE
statment, you may
populate parameter values by calling setValue
or
setValueToNull
. If you do not set field values, the statement
will be returned with ? as a placeholder value.
If SqlBuilder does not have enough information to create the requested SQL statement, it will return an empty string ("");
-
Constructor Summary
ConstructorDescriptionConstructor that does not establish table, fields or identity field.SqlBuilder
(String table) Constructor that establishes table.SqlBuilder
(String table, String[] fields) Constructor that establishes table and fields.SqlBuilder
(String table, String[] fields, int idFieldIndex) Constructor that establishes table, fields, and identity field.SqlBuilder
(String table, String[] fields, String idField) Constructor that establishes table, fields, and identity field.SqlBuilder
(String table, String[] fields, String[] fieldProperties, int idFieldIndex) Constructor that establishes table, fields, field properties and identity field. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a single field to the field list.void
andHaving
(int fieldIndex, Comparison operator, boolean value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, byte value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, double value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, float value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, int value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, short value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, String value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(int fieldIndex, Comparison operator, Date value) Adds aHAVING
clause to aSELECT
statement withAND
.void
Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, boolean value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, byte value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, double value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, float value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, int value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, short value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, String value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andHaving
(String fieldName, Comparison operator, Date value) Adds aHAVING
clause to aSELECT
statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, boolean value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, byte value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, double value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, float value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, int value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, short value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, String value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(int fieldIndex, Comparison operator, Date value) Adds aWHERE
clause to an SQL statement withAND
.void
Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, boolean value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, byte value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, double value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, float value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, int value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, short value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, String value) Adds aWHERE
clause to an SQL statement withAND
.void
andWhere
(String fieldName, Comparison operator, Date value) Adds aWHERE
clause to an SQL statement withAND
.Creates aCREATE TABLE
statement based on supplied values.deleteByIdStatement
(int idToDelete) Creates anDELETE
statement based on supplied values.Creates anDELETE
statement based on supplied values.static String
Modifies a string so it will be processed as a complete string within SQL.String[]
Returns array of strings representing field names already established.getTable()
Returns string representing table name already established.void
groupBy
(int groupByFieldIndex) Adds aGROUP BY
clause to aSELECT
statement.void
Adds aGROUP BY
clause to aSELECT
statement.Creates aINSERT
statement based on supplied values.void
Adds aJOIN
clause to an SQL statement.void
join
(JoinType joinType, String tableToJoin, String fieldInFirstTable, Comparison operator, String fieldInTableToJoin) Adds aJOIN
clause to an SQL statement.void
Adds anINNER JOIN
clause to an SQL statement.void
join
(String tableToJoin, String fieldInFirstTable, Comparison operator, String fieldInTableToJoin) Adds anINNER JOIN
clause to an SQL statement.void
Adds anINNER JOIN
clause to an SQL statement.void
orderBy
(int orderByFieldIndex, OrderDirection direction) Adds anORDER BY
clause to aSELECT
statement withdirection
as the direction.void
orderBy
(String orderByField, OrderDirection direction) Adds aORDER BY
clause to aSELECT
statement withdirection
as the direction.void
orderByAscending
(int orderByFieldIndex) Adds anORDER BY
clause to aSELECT
statement withASC
as the direction.void
orderByAscending
(String orderByField) Adds aORDER BY
clause to aSELECT
statement withASC
as the direction.void
orderByDescending
(int orderByFieldIndex) Adds anORDER BY
clause to aSELECT
statement withDESC
as the direction.void
orderByDescending
(String orderByField) Adds aORDER BY
clause to aSELECT
statement withDESC
as the direction.void
orHaving
(int fieldIndex, Comparison operator, boolean value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, byte value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, double value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, float value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, int value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, short value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, String value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(int fieldIndex, Comparison operator, Date value) Adds aHAVING
clause to aSELECT
statement withOR
.void
Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, boolean value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, byte value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, double value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, float value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, int value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, short value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, String value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orHaving
(String fieldName, Comparison operator, Date value) Adds aHAVING
clause to aSELECT
statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, boolean value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, byte value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, double value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, float value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, int value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, short value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, String value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(int fieldIndex, Comparison operator, Date value) Adds aWHERE
clause to an SQL statement withOR
.void
Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, boolean value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, byte value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, double value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, float value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, int value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, short value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, String value) Adds aWHERE
clause to an SQL statement withOR
.void
orWhere
(String fieldName, Comparison operator, Date value) Adds aWHERE
clause to an SQL statement withOR
.void
prependField
(int fieldIndex, String tableName) Prepends the field name with a table name.selectByIdStatement
(int idToSelect) Creates aSELECT
statement based on supplied values.Creates aSELECT
statement based on supplied values.void
setFieldList
(String[] fields) Establishes fields.void
setFieldList
(String[] fields, int idFieldIndex) Establishes fields and identity field.void
setFieldList
(String[] fields, String idField) Establishes fields and identity field.void
setFieldProperties
(int fieldIndex, String fieldProperties) Sets properties of a field forCREATE TABLE
statements.void
Establishes table.void
setValue
(int fieldIndex, boolean fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
setValue
(int fieldIndex, byte fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
setValue
(int fieldIndex, double fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
setValue
(int fieldIndex, float fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
setValue
(int fieldIndex, int fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
setValue
(int fieldIndex, long fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
setValue
(int fieldIndex, short fieldValue) Sets value of field forUPDATE
andINSERT
statements.void
Sets value of field forUPDATE
andINSERT
statements.void
Sets value of field forUPDATE
andINSERT
statements.void
Sets value of field forUPDATE
andINSERT
statements.void
Sets value of field forUPDATE
andINSERT
statements.void
setValueToNull
(int fieldIndex) Sets value of field forUPDATE
andINSERT
statements to NULL.updateByIdStatement
(int idToUpdate) Creates anUPDATE
statement based on supplied values.Creates anUPDATE
statement based on supplied values.
-
Constructor Details
-
SqlBuilder
Constructor that establishes table, fields, field properties and identity field.- Parameters:
table
- string name of the table in the databasefields
- array of strings representing each fieldfieldProperties
- array of strings representing fieldPropertiesidFieldIndex
- zero-based ordinal position of field infields[]
-
SqlBuilder
Constructor that establishes table, fields, and identity field.- Parameters:
table
- string name of the table in the databasefields
- array of strings representing each fieldidFieldIndex
- zero-based ordinal position of field infields[]
-
SqlBuilder
Constructor that establishes table, fields, and identity field.- Parameters:
table
- string name of the table in the databasefields
- array of strings representing each fieldidField
- name of identity field
-
SqlBuilder
Constructor that establishes table and fields.- Parameters:
table
- string name of the table in the databasefields
- array of strings representing each field
-
SqlBuilder
Constructor that establishes table. After instantiation,setFieldList
must be called to populate field list and/or identity field.- Parameters:
table
- string name of the table in the database
-
SqlBuilder
public SqlBuilder()Constructor that does not establish table, fields or identity field.
-
-
Method Details
-
setFieldList
Establishes fields and identity field.- Parameters:
fields
- array of strings representing each fieldidFieldIndex
- zero-based ordinal position of field infields[]
-
setFieldList
Establishes fields and identity field.- Parameters:
fields
- array of strings representing each fieldidField
- name of identity field
-
setFieldList
Establishes fields.- Parameters:
fields
- array of strings representing each field
-
getFieldList
Returns array of strings representing field names already established.- Returns:
- fields as array of strings
-
addField
Adds a single field to the field list.- Parameters:
fieldName
- the name of the field to add
-
prependField
Prepends the field name with a table name. This is used to differentiate fields from different tables that have the same name in queries that joins those tables.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)tableName
- name of the table to which the field belongs
-
setTable
Establishes table.- Parameters:
table
- string representing table name
-
getTable
Returns string representing table name already established.- Returns:
- table name as string
-
setValue
public void setValue(int fieldIndex, byte fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as byte
-
setValue
public void setValue(int fieldIndex, double fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as double
-
setValue
public void setValue(int fieldIndex, float fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as float
-
setValue
public void setValue(int fieldIndex, long fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as long
-
setValue
public void setValue(int fieldIndex, short fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as short
-
setValue
public void setValue(int fieldIndex, boolean fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as boolean
-
setValue
Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as java.util.Date
-
setValue
public void setValue(int fieldIndex, int fieldValue) Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as int
-
setValueToNull
public void setValueToNull(int fieldIndex) Sets value of field forUPDATE
andINSERT
statements to NULL.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)
-
setValue
Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as java.lang.String
-
setValue
Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as java.lang.String
-
setValue
Sets value of field forUPDATE
andINSERT
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldValue
- value of field as java.lang.String
-
setFieldProperties
Sets properties of a field forCREATE TABLE
statements.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
)fieldProperties
- properties of field as java.lang.String
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
andWhere
Adds aWHERE
clause to an SQL statement withAND
.- Parameters:
whereStatement
- string containing completeWHERE
clause
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
orWhere
Adds aWHERE
clause to an SQL statement withOR
.- Parameters:
whereStatement
- string containing completeWHERE
clause
-
join
Adds anINNER JOIN
clause to an SQL statement.- Parameters:
tableToJoin
- name of the table to joinfieldInFirstTable
- name of field in first tablefieldInTableToJoin
- name of field in table specified in tableToJoin
-
join
public void join(String tableToJoin, String fieldInFirstTable, Comparison operator, String fieldInTableToJoin) Adds anINNER JOIN
clause to an SQL statement.- Parameters:
tableToJoin
- name of the table to joinfieldInFirstTable
- name of field in first tableoperator
- comparison operator for joinfieldInTableToJoin
- name of field in table specified in tableToJoin
-
join
Adds anINNER JOIN
clause to an SQL statement.- Parameters:
tableToJoin
- name of the table to joinonStatement
- conditional statement to define the join
-
join
public void join(JoinType joinType, String tableToJoin, String fieldInFirstTable, Comparison operator, String fieldInTableToJoin) Adds aJOIN
clause to an SQL statement.- Parameters:
joinType
- the type of join to addtableToJoin
- name of the table to joinfieldInFirstTable
- name of field in first tableoperator
- comparison operator for joinfieldInTableToJoin
- name of field in table specified in tableToJoin
-
join
Adds aJOIN
clause to an SQL statement.- Parameters:
joinType
- the type of join to addtableToJoin
- name of the table to joinonStatement
- conditional statement to define the join
-
groupBy
public void groupBy(int groupByFieldIndex) Adds aGROUP BY
clause to aSELECT
statement.- Parameters:
groupByFieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to group by
-
groupBy
Adds aGROUP BY
clause to aSELECT
statement.- Parameters:
groupByField
- string name of field to group by
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
andHaving
Adds aHAVING
clause to aSELECT
statement withAND
.- Parameters:
havingStatement
- string containing completeHAVING
clause
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- string representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- int representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- java.util.Date representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- boolean representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- short representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- float representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- double representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
fieldName
- string name of field to test versus supplied value.operator
- Comparison representing the type of comparison operationvalue
- byte representing value to compare to field
-
orHaving
Adds aHAVING
clause to aSELECT
statement withOR
.- Parameters:
havingStatement
- string containing completeHAVING
clause
-
orderByAscending
public void orderByAscending(int orderByFieldIndex) Adds anORDER BY
clause to aSELECT
statement withASC
as the direction.- Parameters:
orderByFieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to sort by
-
orderByAscending
Adds aORDER BY
clause to aSELECT
statement withASC
as the direction.- Parameters:
orderByField
- string name of field to sort by
-
orderByDescending
Adds aORDER BY
clause to aSELECT
statement withDESC
as the direction.- Parameters:
orderByField
- string name of field to sort by
-
orderByDescending
public void orderByDescending(int orderByFieldIndex) Adds anORDER BY
clause to aSELECT
statement withDESC
as the direction.- Parameters:
orderByFieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to sort by
-
orderBy
Adds anORDER BY
clause to aSELECT
statement withdirection
as the direction.- Parameters:
orderByFieldIndex
- ordinal position of field infields[]
(as defined in constructor orsetFieldList
) to sort by
-
orderBy
Adds aORDER BY
clause to aSELECT
statement withdirection
as the direction.- Parameters:
orderByField
- string name of field to sort by
-
selectByIdStatement
Creates aSELECT
statement based on supplied values.- Parameters:
idToSelect
- int representing identity value of specific record to return- Returns:
- SQL
SELECT
statement
-
selectStatement
Creates aSELECT
statement based on supplied values.- Returns:
- SQL
SELECT
statement
-
insertStatement
Creates aINSERT
statement based on supplied values.- Returns:
- SQL
INSERT
statement
-
updateByIdStatement
Creates anUPDATE
statement based on supplied values.- Parameters:
idToUpdate
- int representing identity value of specific record to update- Returns:
- SQL
UPDATE
statement
-
updateStatement
Creates anUPDATE
statement based on supplied values.- Returns:
- SQL
UPDATE
statement
-
createTableStatement
Creates aCREATE TABLE
statement based on supplied values.- Returns:
- SQL
CREATE TABLE
statement
-
deleteByIdStatement
Creates anDELETE
statement based on supplied values.- Parameters:
idToDelete
- int representing identity value of specific record to delete- Returns:
- SQL
DELETE
statement
-
deleteStatement
Creates anDELETE
statement based on supplied values.- Returns:
- SQL
DELETE
statement
-
encode
Modifies a string so it will be processed as a complete string within SQL.- Parameters:
toEncode
- the string to encode- Returns:
- the encoded string
-