Class | TokyoCabinet::TDBQRY |
In: |
tokyocabinet.c
tokyocabinet-doc.rb |
Parent: | Object |
Query is a mechanism to search for and retrieve records corresponding conditions from table database.%%
QCSTREQ | = | INT2NUM(TDBQCSTREQ) | ||
QCSTRINC | = | INT2NUM(TDBQCSTRINC) | ||
QCSTRBW | = | INT2NUM(TDBQCSTRBW) | ||
QCSTREW | = | INT2NUM(TDBQCSTREW) | ||
QCSTRAND | = | INT2NUM(TDBQCSTRAND) | ||
QCSTROR | = | INT2NUM(TDBQCSTROR) | ||
QCSTROREQ | = | INT2NUM(TDBQCSTROREQ) | ||
QCSTRRX | = | INT2NUM(TDBQCSTRRX) | ||
QCNUMEQ | = | INT2NUM(TDBQCNUMEQ) | ||
QCNUMGT | = | INT2NUM(TDBQCNUMGT) | ||
QCNUMGE | = | INT2NUM(TDBQCNUMGE) | ||
QCNUMLT | = | INT2NUM(TDBQCNUMLT) | ||
QCNUMLE | = | INT2NUM(TDBQCNUMLE) | ||
QCNUMBT | = | INT2NUM(TDBQCNUMBT) | ||
QCNUMOREQ | = | INT2NUM(TDBQCNUMOREQ) | ||
QCFTSPH | = | INT2NUM(TDBQCFTSPH) | ||
QCFTSAND | = | INT2NUM(TDBQCFTSAND) | ||
QCFTSOR | = | INT2NUM(TDBQCFTSOR) | ||
QCFTSEX | = | INT2NUM(TDBQCFTSEX) | ||
QCNEGATE | = | INT2NUM(TDBQCNEGATE) | ||
QCNOIDX | = | INT2NUM(TDBQCNOIDX) | ||
QOSTRASC | = | INT2NUM(TDBQOSTRASC) | ||
QOSTRDESC | = | INT2NUM(TDBQOSTRDESC) | ||
QONUMASC | = | INT2NUM(TDBQONUMASC) | ||
QONUMDESC | = | INT2NUM(TDBQONUMDESC) | ||
QPPUT | = | INT2NUM(TDBQPPUT) | ||
QPOUT | = | INT2NUM(TDBQPOUT) | ||
QPSTOP | = | INT2NUM(TDBQPSTOP) | ||
MSUNION | = | INT2NUM(TDBMSUNION) | ||
MSISECT | = | INT2NUM(TDBMSISECT) | ||
MSDIFF | = | INT2NUM(TDBMSDIFF) | ||
KWMUTAB | = | INT2NUM(TCKWMUTAB) | ||
KWMUCTRL | = | INT2NUM(TCKWMUCTRL) | ||
KWMUBRCT | = | INT2NUM(TCKWMUBRCT) | ||
KWNOOVER | = | INT2NUM(TCKWNOOVER) | ||
KWPULEAD | = | INT2NUM(TCKWPULEAD) | ||
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 | |
QCFTSPH | = | 15 | query condition: full-text search with the phrase of | |
QCFTSAND | = | 16 | query condition: full-text search with all tokens in | |
QCFTSOR | = | 17 | query condition: full-text search with at least one token in | |
QCFTSEX | = | 18 | query condition: full-text search with the compound expression of | |
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 | |
MSUNION | = | 0 | set operation type: union | |
MSISECT | = | 1 | set operation type: intersection | |
MSDIFF | = | 2 | set operation type: difference | |
KWMUTAB | = | 1 << 0 | KWIC option: mark up by tabs | |
KWMUCTRL | = | 1 << 1 | KWIC option: mark up by control characters | |
KWMUBRCT | = | 1 << 2 | KWIC option: mark up by square brackets | |
KWNOOVER | = | 1 << 24 | KWIC option: do not overlap | |
KWPULEAD | = | 1 << 25 | KWIC option: pick up the lead string |
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, `TokyoCabinet::TDBQRY::QCFTSPH’ for full-text search with the phrase of the expression, `TokyoCabinet::TDBQRY::QCFTSAND’ for full-text search with all tokens in the expression, `TokyoCabinet::TDBQRY::QCFTSOR’ for full-text search with at least one token in the expression, `TokyoCabinet::TDBQRY::QCFTSEX’ for full-text search with the compound 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’.%%
# File tokyocabinet-doc.rb, line 1319 1319: def addcond(name, op, expr) 1320: # (native code) 1321: end
Generate keyword-in-context strings.%% `cols’ specifies a hash containing columns.%% `name’ specifies the name of a column. If it is not defined, the first column of the query is specified.%% `width’ specifies the width of strings picked up around each keyword. If it is not defined or negative, the whole text is picked up.%% `opts’ specifies options by bitwise-or: `TokyoCabinet::TDBQRY::KWMUTAB’ specifies that each keyword is marked up between two tab characters, `TokyoCabinet::TDBQRY::KWMUCTRL’ specifies that each keyword is marked up by the STX (0x02) code and the ETX (0x03) code, `TokyoCabinet::TDBQRY::KWMUBRCT’ specifies that each keyword is marked up by the two square brackets, `TokyoCabinet::TDBQRY::KWNOOVER’ specifies that each context does not overlap, `TokyoCabinet::TDBQRY::KWPULEAD’ specifies that the lead string is picked up forcibly. If it is not defined, no option is specified.%% The return value is an array of strings around keywords.%%
# File tokyocabinet-doc.rb, line 1371 1371: def kwic(cols, name, width, opts) 1372: # (native code) 1373: end
Retrieve records with multiple query objects and get the set of the result.%% `others’ specifies an array of the query objects except for the self object.%% `type’ specifies a set operation type: `TokyoCabinet::TDBQRY::MSUNION’ for the union set, `TokyoCabinet::TDBQRY::MSISECT’ for the intersection set, `TokyoCabinet::TDBQRY::MSDIFF’ for the difference set. If it is not defined, `TokyoCabinet::TDBQRY::MSUNION’ is specified.%% The return value is an array of the primary keys of the corresponding records. This method does never fail. It returns an empty array even if no record corresponds.%% If the first query object has the order setting, the result array is sorted by the order.%%
# File tokyocabinet-doc.rb, line 1362 1362: def metasearch(others, type) 1363: # (native code) 1364: end
Process each corresponding record.%% This method 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.%%
# File tokyocabinet-doc.rb, line 1349 1349: def proc() 1350: # (native code) 1351: end
Remove each corresponding record.%% If successful, the return value is true, else, it is false.%%
# File tokyocabinet-doc.rb, line 1343 1343: def searchout() 1344: # (native code) 1345: end
Set the maximum number of records of the result.%% `max’ specifies the maximum number of records of the result. If it is not defined or negative, no limit is specified.%% `skip’ specifies the maximum number of records of the result. If it is not defined or not more than 0, no record is skipped.%% The return value is always `nil’.%%
# File tokyocabinet-doc.rb, line 1333 1333: def setlimit(max, skip) 1334: # (native code) 1335: end
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. If it is not defined, `TokyoCabinet::TDBQRY::QOSTRASC’ is specified.%% The return value is always `nil’.%%
# File tokyocabinet-doc.rb, line 1326 1326: def setorder(name, type) 1327: # (native code) 1328: end