Class | TokyoCabinet::TDBQRY |
In: |
tokyocabinet-doc.rb
|
Parent: | Object |
Query is a mechanism to search for and
retrieve records corresponding conditions from table database.
QCSTREQ | = | 1 | query condition: string is equal to | |
QCSTRINC | = | 2 | query condition: string is included in | |
QCSTRBW | = | 3 | query condition: string begins with | |
QCSTREW | = | 4 | query condition: string ends with | |
QCSTRAND | = | 5 | query condition: string includes all tokens in | |
QCSTROR | = | 6 | query condition: string includes at least one token in | |
QCSTROREQ | = | 7 | query condition: string is equal to at least one token in | |
QCSTRRX | = | 8 | query condition: string matches regular expressions of | |
QCNUMEQ | = | 9 | query condition: number is equal to | |
QCNUMGT | = | 10 | query condition: number is greater than | |
QCNUMGE | = | 11 | query condition: number is greater than or equal to | |
QCNUMLT | = | 12 | query condition: number is less than | |
QCNUMLE | = | 13 | query condition: number is less than or equal to | |
QCNUMBT | = | 14 | query condition: number is between two tokens of | |
QCNUMOREQ | = | 15 | query condition: number is equal to at least one token in | |
QCNEGATE | = | 1 << 24 | query condition: negation flag | |
QCNOIDX | = | 1 << 25 | query condition: no index flag | |
QOSTRASC | = | 1 | order type: string ascending | |
QOSTRDESC | = | 2 | order type: string descending | |
QONUMASC | = | 3 | order type: number ascending | |
QONUMDESC | = | 4 | order type: number descending | |
QPPUT | = | 1 << 0 | post treatment: modify the record | |
QPOUT | = | 1 << 1 | post treatment: remove the record | |
QPSTOP | = | 1 << 24 | post treatment: stop the iteration |
Create a query object.
`tdb' specifies the table database
object.
The return value is the new
query object.
Add a narrowing condition.
`name' specifies the name of a
column. An empty string means the primary key.
`op'
specifies an operation type: `TokyoCabinet::TDBQRY::QCSTREQ' for
string which is equal to the expression,
`TokyoCabinet::TDBQRY::QCSTRINC' for string which is included in the
expression, `TokyoCabinet::TDBQRY::QCSTRBW' for string which begins
with the expression, `TokyoCabinet::TDBQRY::QCSTREW' for string which
ends with the expression, `TokyoCabinet::TDBQRY::QCSTRAND' for string
which includes all tokens in the expression,
`TokyoCabinet::TDBQRY::QCSTROR' for string which includes at least
one token in the expression, `TokyoCabinet::TDBQRY::QCSTROREQ' for
string which is equal to at least one token in the expression,
`TokyoCabinet::TDBQRY::QCSTRRX' for string which matches regular
expressions of the expression, `TokyoCabinet::TDBQRY::QCNUMEQ' for
number which is equal to the expression,
`TokyoCabinet::TDBQRY::QCNUMGT' for number which is greater than the
expression, `TokyoCabinet::TDBQRY::QCNUMGE' for number which is
greater than or equal to the expression,
`TokyoCabinet::TDBQRY::QCNUMLT' for number which is less than the
expression, `TokyoCabinet::TDBQRY::QCNUMLE' for number which is less
than or equal to the expression, `TokyoCabinet::TDBQRY::QCNUMBT' for
number which is between two tokens of the expression,
`TokyoCabinet::TDBQRY::QCNUMOREQ' for number which is equal to at
least one token in the expression. All operations can be flagged by bitwise
or: `TokyoCabinet::TDBQRY::QCNEGATE' for negation,
`TokyoCabinet::TDBQRY::QCNOIDX' for using no index.
`expr' specifies an operand exression.
The return value is
always `nil'.
Process each corresponding record.
This function needs a block parameter
of the iterator called for each record. The block receives two parameters.
The first parameter is the primary key. The second parameter is a hash
containing columns. It returns flags of the post treatment by bitwise or:
`TokyoCabinet::TDBQRY::QPPUT' to modify the record,
`TokyoCabinet::TDBQRY::QPOUT' to remove the record,
`TokyoCabinet::TDBQRY::QPSTOP' to stop the iteration.
If
successful, the return value is true, else, it is false.
Execute the search.
The return value is
an array of the primary keys of the corresponding records. This method does
never fail and return an empty array even if no record corresponds.
Set the maximum number of records of the result.
`max'
specifies the maximum number of records of the result.
The return value
is always `nil'.
Set the order of the result.
`name' specifies the name of
a column. An empty string means the primary key.
`type'
specifies the order type: `TokyoCabinet::TDBQRY::QOSTRASC' for string
ascending, `TokyoCabinet::TDBQRY::QOSTRDESC' for string descending,
`TokyoCabinet::TDBQRY::QONUMASC' for number ascending,
`TokyoCabinet::TDBQRY::QONUMDESC' for number descending.
The return
value is always `nil'.