Class TokyoTyrant::RDBQRY
In: tokyotyrant.rb
Parent: Object

This class is a helper for the class "TokyoTyrant::RDBTBL".

Methods

addcond   new   search   searchget   searchout   setmax   setorder  

Constants

QCSTREQ = 0   query condition: string is equal to
QCSTRINC = 1   query condition: string is included in
QCSTRBW = 2   query condition: string begins with
QCSTREW = 3   query condition: string ends with
QCSTRAND = 4   query condition: string includes all tokens in
QCSTROR = 5   query condition: string includes at least one token in
QCSTROREQ = 6   query condition: string is equal to at least one token in
QCSTRRX = 7   query condition: string matches regular expressions of
QCNUMEQ = 8   query condition: number is equal to
QCNUMGT = 9   query condition: number is greater than
QCNUMGE = 10   query condition: number is greater than or equal to
QCNUMLT = 11   query condition: number is less than
QCNUMLE = 12   query condition: number is less than or equal to
QCNUMBT = 13   query condition: number is between two tokens of
QCNUMOREQ = 14   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 = 0   order type: string ascending
QOSTRDESC = 1   order type: string descending
QONUMASC = 2   order type: number ascending
QONUMDESC = 3   order type: number descending

Public Class methods

Create a query object.
`rdb' specifies the remote database object.
The return value is the new query object.

Public Instance methods

Add a narrowing condition.
`name' specifies the name of a column. An empty string means the primary key.
`op' specifies an operation type: `TokyoCabinet::RDBQRY::QCSTREQ' for string which is equal to the expression, `TokyoCabinet::RDBQRY::QCSTRINC' for string which is included in the expression, `TokyoCabinet::RDBQRY::QCSTRBW' for string which begins with the expression, `TokyoCabinet::RDBQRY::QCSTREW' for string which ends with the expression, `TokyoCabinet::RDBQRY::QCSTRAND' for string which includes all tokens in the expression, `TokyoCabinet::RDBQRY::QCSTROR' for string which includes at least one token in the expression, `TokyoCabinet::RDBQRY::QCSTROREQ' for string which is equal to at least one token in the expression, `TokyoCabinet::RDBQRY::QCSTRRX' for string which matches regular expressions of the expression, `TokyoCabinet::RDBQRY::QCNUMEQ' for number which is equal to the expression, `TokyoCabinet::RDBQRY::QCNUMGT' for number which is greater than the expression, `TokyoCabinet::RDBQRY::QCNUMGE' for number which is greater than or equal to the expression, `TokyoCabinet::RDBQRY::QCNUMLT' for number which is less than the expression, `TokyoCabinet::RDBQRY::QCNUMLE' for number which is less than or equal to the expression, `TokyoCabinet::RDBQRY::QCNUMBT' for number which is between two tokens of the expression, `TokyoCabinet::RDBQRY::QCNUMOREQ' for number which is equal to at least one token in the expression. All operations can be flagged by bitwise or: `TokyoCabinet::RDBQRY::QCNEGATE' for negation, `TokyoCabinet::RDBQRY::QCNOIDX' for using no index.
`expr' specifies an operand exression.
The return value is always `nil'.

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.

Get records corresponding to the search.
`names' specifies an array of column names to be fetched. An empty string means the primary key. If it is not defined, every column is fetched.
The return value is an array of column hashes of the corresponding records. This method does never fail and return an empty list even if no record corresponds.
Due to the protocol restriction, this method can not handle records with binary columns including the "\0" chracter.

Remove each corresponding record.
If successful, the return value is true, else, it is false.

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::RDBQRY::QOSTRASC' for string ascending, `TokyoCabinet::RDBQRY::QOSTRDESC' for string descending, `TokyoCabinet::RDBQRY::QONUMASC' for number ascending, `TokyoCabinet::RDBQRY::QONUMDESC' for number descending.
The return value is always `nil'.