Class GenericSearch
Obsolete. Use SearchEngine instead.
Represents a generic database search. GenericSearch has less functionality for adding criteria than SearcEngine. The GenericSearch is originally made for searching and fetching data from the database. Thereby its name. GenericSearch is a tool for building up SQL queries, by adding fields and criteria. GenericSearch extends theSearchEngine class with options for how to list fields. Displayfields, datafields, idfields. The fields must be given as starttablename.fieldname, for example "ticket.title" For tables that have foreign keys to other tables, you can reach them with starttablename.fieldname.fieldname Make sure that all fields you use start with the same table, for example ticket, or else you will recieve a big join that you probably do not want. For many-to-many relations there is a special notation: table1.(table2->field2a).field2b Where field2a is field in table2 that has a foreign key to table1.Examples
ticket.(ticket_customers->ticket_id).cust_id
The firstname of the primary customer of a ticket is "ticket.cust_id.firstname".
The company name of the primary customer of a ticket is "ticket.cust_id.company.name".
Constructors
GenericSearch()
Initializes a new instance of the File class.
Declaration
GenericSearch Methods
addComparison(String,String,String,String,Integer)
Adds a criteria between two database-fields to the database query.
Declaration
Void addComparison(String field1, String compOperator, String field2, String rowOperator, Integer concatLevel) Parameters
| Type | Name | Description |
| String | field1 | The field to compare with field2 |
| String | compOperator | Comparison operator. (OperatorEquals, OperatorNotEquals, OperatorLt, OperatorLte, OperatorGt, OperatorGte, OperatorLike, OperatorNotLike, OperatorContains, OperatorBeginsWith, OperatorEndsWith, OperatorIn, OperatorNotIn, OperatorIs, OperatorOracleLeftJoin, OperatorIsNot) |
| String | field2 | The field to compare with field1 |
| String | rowOperator | Operator for composing this criteria with a following criterion. (OperatorAnd, OperatorOr, OperatorNotAnd, OperatorNotOr) |
| Integer | concatLevel | A number. All criteria with the same number will be placed inside the same brackets. |
Returns
| Type | Description |
| Void |
addCriteria(String,String,String,String,Integer)
Add search criteria to the search.
Declaration
Void addCriteria(String field, String operator, String value, String andOr, Integer concatLevel) Parameters
| Type | Name | Description |
| String | field | The name of the field to select |
| String | operator | The operator for the criteria (OperatorNone, OperatorAnd, OperatorOr, OperatorNotAnd, OperatorNotOr, OperatorLike, OperatorNotLike, OperatorContains, OperatorBeginsWith, OperatorEndsWith, OperatorEquals, OperatorNotEquals, OperatorGt, OperatorLt, OperatorGte, OperatorLte, OperatorIn, OperatorNotIn, OperatorIs, OperatorOracleLeftJoin, OperatorIsNot) |
| String | value | The value to compare with the field |
| String | andOr | The operator which combine this criteria with the following criteria (OperatorAnd, OperatorOr, OperatorNotAnd, OperatorNotOr) |
| Integer | concatLevel | A number to use for combining criteria inside brackets. If the criteria has the same concatLevel, the end up inside the same brackets. |
Returns
| Type | Description |
| Void |
addField(String)
Adds a field to the queryAdds a field to be selected to the database query.
Declaration
Void addField(String field) Parameters
| Type | Name | Description |
| String | field | The name of the field to select. |
Returns
| Type | Description |
| Void |
addField(String,Integer)
Adds a field to the queryAdds a field to be selected to the database query with a field mask.
Declaration
Void addField(String field, Integer fieldMask) Parameters
| Type | Name | Description |
| String | field | The name of the field to select |
| Integer | fieldMask | See table. |
Returns
| Type | Description |
| Void |
addOrder(String,Bool)
Adds order on specified field, descending or ascending.
Declaration
Void addOrder(String field, Bool asc) Parameters
| Type | Name | Description |
| String | field | The field that will be sorted |
| Bool | asc | The direction of the sort. true = ascending; false = descending. |
Returns
| Type | Description |
| Void |
countRows()
Returns the number of rows in the result set.
Declaration
Integer countRows() Returns
| Type | Description |
| Integer | The number of rows in the result set. |
eof()
Returns true if the result pointer has reached the end of result set, or false otherwise.
Declaration
Bool eof() Returns
| Type | Description |
| Bool | True if the result pointer has reached the end of result set; otherwise, false. |
first()
Sets the result pointer to point at the first row in the result set.
Declaration
Bool first() Returns
| Type | Description |
| Bool | False if the result set is empty; otherwise, true. |
get(String,Integer)
Retrieves the value of a field according to a field mask.
Declaration
String get(String field) Parameters
| Type | Name | Description |
| String | field | The name of the field to select |
| Integer | fieldMask | See table. |
Returns
| Type | Description |
| String | The value of the field. |
get(Integer,Integer)
Retrieves the value of a field according to a field mask.
Declaration
String get(Integer id) Parameters
| Type | Name | Description |
| Integer | id | The ID of the field to select |
| Integer | fieldMask | See table. |
Returns
| Type | Description |
| String | The value of the field. |
next()
Sets the result set pointer to next row, returns
Declaration
Bool next() Returns
| Type | Description |
| Bool | True if there is a next row; otherwise, false (the pointer has reached the last result set) |