DBIx::HTMLView::Selection - A kriteria used to select posts
$sel=DBIx::HTMLView::Selection->new($table, $search_string); print $sel->sql_select
This class is used to parse search query strings and generate SQL select queries out of them. You usually don't use this class itself, but simply pass the strings to methods like list in DBIx::HTMLView::Table, which then uses this class to parse them.
The format of the search strings looks very much like the SQL select querys, but with some modifications. All fields are supposed to belong to the table $tab passed to the constructor and fields in related posts are accessed using the string <relation_name>-><field_name> (eg group->name). It's even possible (not yet implemeted though) to access fields through several relations (eg rel1->rel2->field).
Here is a more precise definition of the language useed:
<expr> = <bool_value> (("AND" | "OR") <bool_value>)? <bool_value> = <fld_spec> <opperator> <value> | "(" <expr> ")" <fld_spec> = <fld_name> ("->" <fld_name>)* <fld_name> = <word> <value> = <literal>|<fld_spec> <literal> = \d+ | "'" <string> "'" <string> = [^']* <word> = [a-zA-Z0-9_.]+ <operator> = "<" | ">" | "=" | "<=" | ">=" | "<>" | "LIKE" | ...
Creats a new selection for posts in the table $table (a DBIx::HTMLView::Table object) selecting posts matching the search string $str (in the format described above).
$flds is for optimisations. If it is definied it is supposed to be a reference to an array with the names of the extra fields to select from the database server. All fields used in the $str query will ofcourse also be selected. If this parameter is not defined, all fields of the table will be selected.
$opps is an array ref listing all the opperations your SQL server supports and you wish to be able to use in your search query. Deault is: ['<=', '>=', '<>', '<', '>', '=', 'LIKE', 'RLIKE', 'CLIKE', 'SLIKE']. Note that the opperator <= must be placed before the opperators < and = otherwise <= in a serach string will be interpreted as the two opperators < and = next to eachother and generate a syntax error.
Returns a SQL select query mathing the posts described in the search query passed to the constructor.
Returns a SQL select query counting the posts described in the search query passed to the constructor.
Returns the table we're selecting posts from (a DBIx::HTMLView::Table object).
Add $str to the end of the string that will be the where clause of the slect query.
Add $str to the end of the string that will be the join clause of the slect query.
Adds the field named $field_name to the list of fields selected.
Adds the table named $table_name to the list of tabels selected from.
Returns an array of comparation opperation recognised as specified by the $opps parameter to the constructor.
Returns the current token.
Returns true if the current token is of the kind $kind.
Set $val as the curent token, and $kind as the kind of that token.
Get's the next token from the string, determins it's type and makes it the current token using $self->token.
All those reads and parsers a specifik sub expretions as defined in the description.