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:
selectByIdStatementupdateByIdStatementdeleteByIdStatement
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
ConstructorsConstructorDescriptionConstructor 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 TypeMethodDescriptionvoidAdds a single field to the field list.voidandHaving(int fieldIndex, Comparison operator, boolean value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, byte value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, double value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, float value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, int value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, short value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, String value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(int fieldIndex, Comparison operator, Date value) Adds aHAVINGclause to aSELECTstatement withAND.voidAdds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, boolean value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, byte value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, double value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, float value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, int value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, short value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, String value) Adds aHAVINGclause to aSELECTstatement withAND.voidandHaving(String fieldName, Comparison operator, Date value) Adds aHAVINGclause to aSELECTstatement withAND.voidandWhere(int fieldIndex, Comparison operator, boolean value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, byte value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, double value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, float value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, int value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, short value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, String value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(int fieldIndex, Comparison operator, Date value) Adds aWHEREclause to an SQL statement withAND.voidAdds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, boolean value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, byte value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, double value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, float value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, int value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, short value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, String value) Adds aWHEREclause to an SQL statement withAND.voidandWhere(String fieldName, Comparison operator, Date value) Adds aWHEREclause to an SQL statement withAND.Creates aCREATE TABLEstatement based on supplied values.deleteByIdStatement(int idToDelete) Creates anDELETEstatement based on supplied values.Creates anDELETEstatement based on supplied values.static StringModifies 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.voidgroupBy(int groupByFieldIndex) Adds aGROUP BYclause to aSELECTstatement.voidAdds aGROUP BYclause to aSELECTstatement.Creates aINSERTstatement based on supplied values.voidAdds aJOINclause to an SQL statement.voidjoin(JoinType joinType, String tableToJoin, String fieldInFirstTable, Comparison operator, String fieldInTableToJoin) Adds aJOINclause to an SQL statement.voidAdds anINNER JOINclause to an SQL statement.voidjoin(String tableToJoin, String fieldInFirstTable, Comparison operator, String fieldInTableToJoin) Adds anINNER JOINclause to an SQL statement.voidAdds anINNER JOINclause to an SQL statement.voidorderBy(int orderByFieldIndex, OrderDirection direction) Adds anORDER BYclause to aSELECTstatement withdirectionas the direction.voidorderBy(String orderByField, OrderDirection direction) Adds aORDER BYclause to aSELECTstatement withdirectionas the direction.voidorderByAscending(int orderByFieldIndex) Adds anORDER BYclause to aSELECTstatement withASCas the direction.voidorderByAscending(String orderByField) Adds aORDER BYclause to aSELECTstatement withASCas the direction.voidorderByDescending(int orderByFieldIndex) Adds anORDER BYclause to aSELECTstatement withDESCas the direction.voidorderByDescending(String orderByField) Adds aORDER BYclause to aSELECTstatement withDESCas the direction.voidorHaving(int fieldIndex, Comparison operator, boolean value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, byte value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, double value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, float value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, int value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, short value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, String value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(int fieldIndex, Comparison operator, Date value) Adds aHAVINGclause to aSELECTstatement withOR.voidAdds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, boolean value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, byte value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, double value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, float value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, int value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, short value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, String value) Adds aHAVINGclause to aSELECTstatement withOR.voidorHaving(String fieldName, Comparison operator, Date value) Adds aHAVINGclause to aSELECTstatement withOR.voidorWhere(int fieldIndex, Comparison operator, boolean value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, byte value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, double value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, float value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, int value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, short value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, String value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(int fieldIndex, Comparison operator, Date value) Adds aWHEREclause to an SQL statement withOR.voidAdds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, boolean value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, byte value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, double value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, float value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, int value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, short value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, String value) Adds aWHEREclause to an SQL statement withOR.voidorWhere(String fieldName, Comparison operator, Date value) Adds aWHEREclause to an SQL statement withOR.voidprependField(int fieldIndex, String tableName) Prepends the field name with a table name.selectByIdStatement(int idToSelect) Creates aSELECTstatement based on supplied values.Creates aSELECTstatement based on supplied values.voidsetFieldList(String[] fields) Establishes fields.voidsetFieldList(String[] fields, int idFieldIndex) Establishes fields and identity field.voidsetFieldList(String[] fields, String idField) Establishes fields and identity field.voidsetFieldProperties(int fieldIndex, String fieldProperties) Sets properties of a field forCREATE TABLEstatements.voidEstablishes table.voidsetValue(int fieldIndex, boolean fieldValue) Sets value of field forUPDATEandINSERTstatements.voidsetValue(int fieldIndex, byte fieldValue) Sets value of field forUPDATEandINSERTstatements.voidsetValue(int fieldIndex, double fieldValue) Sets value of field forUPDATEandINSERTstatements.voidsetValue(int fieldIndex, float fieldValue) Sets value of field forUPDATEandINSERTstatements.voidsetValue(int fieldIndex, int fieldValue) Sets value of field forUPDATEandINSERTstatements.voidsetValue(int fieldIndex, long fieldValue) Sets value of field forUPDATEandINSERTstatements.voidsetValue(int fieldIndex, short fieldValue) Sets value of field forUPDATEandINSERTstatements.voidSets value of field forUPDATEandINSERTstatements.voidSets value of field forUPDATEandINSERTstatements.voidSets value of field forUPDATEandINSERTstatements.voidSets value of field forUPDATEandINSERTstatements.voidsetValueToNull(int fieldIndex) Sets value of field forUPDATEandINSERTstatements to NULL.updateByIdStatement(int idToUpdate) Creates anUPDATEstatement based on supplied values.Creates anUPDATEstatement 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,setFieldListmust 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- Parameters:
fieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList)fieldValue- value of field as boolean
-
setValue
Sets value of field forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements to NULL.- Parameters:
fieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList)
-
setValue
Sets value of field forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 forUPDATEandINSERTstatements.- 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 TABLEstatements.- Parameters:
fieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList)fieldProperties- properties of field as java.lang.String
-
andWhere
Adds aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause to an SQL statement withAND.- Parameters:
whereStatement- string containing completeWHEREclause
-
orWhere
Adds aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause 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 aWHEREclause to an SQL statement withOR.- Parameters:
whereStatement- string containing completeWHEREclause
-
join
Adds anINNER JOINclause 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 JOINclause 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 JOINclause 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 aJOINclause 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 aJOINclause 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 BYclause to aSELECTstatement.- Parameters:
groupByFieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList) to group by
-
groupBy
Adds aGROUP BYclause to aSELECTstatement.- Parameters:
groupByField- string name of field to group by
-
andHaving
Adds aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement withAND.- Parameters:
havingStatement- string containing completeHAVINGclause
-
orHaving
Adds aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement 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 aHAVINGclause to aSELECTstatement withOR.- Parameters:
havingStatement- string containing completeHAVINGclause
-
orderByAscending
public void orderByAscending(int orderByFieldIndex) Adds anORDER BYclause to aSELECTstatement withASCas the direction.- Parameters:
orderByFieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList) to sort by
-
orderByAscending
Adds aORDER BYclause to aSELECTstatement withASCas the direction.- Parameters:
orderByField- string name of field to sort by
-
orderByDescending
Adds aORDER BYclause to aSELECTstatement withDESCas the direction.- Parameters:
orderByField- string name of field to sort by
-
orderByDescending
public void orderByDescending(int orderByFieldIndex) Adds anORDER BYclause to aSELECTstatement withDESCas the direction.- Parameters:
orderByFieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList) to sort by
-
orderBy
Adds anORDER BYclause to aSELECTstatement withdirectionas the direction.- Parameters:
orderByFieldIndex- ordinal position of field infields[](as defined in constructor orsetFieldList) to sort by
-
orderBy
Adds aORDER BYclause to aSELECTstatement withdirectionas the direction.- Parameters:
orderByField- string name of field to sort by
-
selectByIdStatement
Creates aSELECTstatement based on supplied values.- Parameters:
idToSelect- int representing identity value of specific record to return- Returns:
- SQL
SELECTstatement
-
selectStatement
Creates aSELECTstatement based on supplied values.- Returns:
- SQL
SELECTstatement
-
insertStatement
Creates aINSERTstatement based on supplied values.- Returns:
- SQL
INSERTstatement
-
updateByIdStatement
Creates anUPDATEstatement based on supplied values.- Parameters:
idToUpdate- int representing identity value of specific record to update- Returns:
- SQL
UPDATEstatement
-
updateStatement
Creates anUPDATEstatement based on supplied values.- Returns:
- SQL
UPDATEstatement
-
createTableStatement
Creates aCREATE TABLEstatement based on supplied values.- Returns:
- SQL
CREATE TABLEstatement
-
deleteByIdStatement
Creates anDELETEstatement based on supplied values.- Parameters:
idToDelete- int representing identity value of specific record to delete- Returns:
- SQL
DELETEstatement
-
deleteStatement
Creates anDELETEstatement based on supplied values.- Returns:
- SQL
DELETEstatement
-
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
-