com.lokorin.dfcrafters.lib
[ class tree: com.lokorin.dfcrafters.lib ] [ index: com.lokorin.dfcrafters.lib ] [ all elements ]

Class: TableSearcher

Source Location: /_includes/lib_search.php

Class Overview


Describes a utility that searches tables for rows that satisfy specified conditions. The result of a search can be retrieved directly as rows or as a sql statement describing the conditions.


Author(s):

  • Andreas Launila

Variables

Methods



Class Details

[line 142]
Describes a utility that searches tables for rows that satisfy specified conditions. The result of a search can be retrieved directly as rows or as a sql statement describing the conditions.



Tags:

author:  Andreas Launila


[ Top ]


Class Variables

$fields =

[line 152]

An array of SearchField instances.



Tags:

access:  private

Type:   array


[ Top ]

$queryAppendage =

[line 159]

An optional query appendage to use when searching. This can be used to specify a specific subset or ordering and is appended on the end of the query.



Tags:

access:  private

Type:   string


[ Top ]

$table =

[line 147]

The name of the table that the search should be performed on.



Tags:

access:  private

Type:   string


[ Top ]



Class Methods


constructor __construct [line 169]

TableSearcher __construct( string $tableToUse, [string $queryAppendage = ''])

Constructor for SearchGenerator.



Tags:

access:  public


Parameters:

string   $tableToUse   The name of the table that should be seached.
string   $queryAppendage   An optional query appendage that is appended to the end of the used search query. This can be used to specify a specific subset or ordering and is appended on the end of the query.

[ Top ]

method addField [line 182]

void addField( SearchField $fieldToAdd)

Adds a search field to the table searcher. The field specifies the restrictions that should be put on the corresponding table field.



Tags:

access:  public


Parameters:

SearchField   $fieldToAdd   The field that should be added, any sub class of SearchField will also do.

[ Top ]

method getMatchedRows [line 202]

array getMatchedRows( [array $fieldsToGet = array()])

Gets all rows that matched the search parameters (if any).



Tags:

return:  The selected rows and fields. The array contains one array per row. Each of those array rows contain keys with the specified field names along with the connected values. If no values were found then an empty array will be returned.
access:  public


Parameters:

array   $fieldsToGet   An array with the names of the table fields that should be retrieved from the database. This parameter is optional, if nothing is specified then all table fields are retrieved.

[ Top ]

method getSqlSelector [line 219]

string getSqlSelector( )

Gets the sql selector that represents the current configuration of the table searcher. The selector describes what the search will match.



Tags:

return:  A sql statement describing what the search will match.
access:  public


[ Top ]

method isValid [line 239]

boolean isValid( )

Checks if the table searcher has valid results. I.e. if any search paramters have been caught by it.



Tags:

return:  True if the table searcher has valid results, false otherwise.
access:  public


[ Top ]

method setSearchParameter [line 255]

void setSearchParameter( string $requestName, mixed $newValue)

Sets the search parameter of all search fields connected to the request name to the specified value.



Tags:

access:  public


Parameters:

string   $requestName   The request name connected to the search fields, i.e. the names specified at construction.
mixed   $newValue   The new value to use as search parameter.

[ Top ]


Documentation generated on Tue, 10 Jan 2006 17:06:37 +0100 by phpDocumentor 1.3.0RC4