Object
This class is a helper for the class “TokyoTyrant::RDBTBL”.%%
set operation type: difference
set operation type: intersection
set operation type: union
query condition: full-text search with all tokens in
query condition: full-text search with the compound expression of
query condition: full-text search with at least one token in
query condition: full-text search with the phrase of
query condition: negation flag
query condition: no index flag
query condition: number is between two tokens of
query condition: number is equal to
query condition: number is greater than or equal to
query condition: number is greater than
query condition: number is less than or equal to
query condition: number is less than
query condition: number is equal to at least one token in
query condition: string includes all tokens in
query condition: string begins with
query condition: string is equal to
query condition: string ends with
query condition: string is included in
query condition: string includes at least one token in
query condition: string is equal to at least one token in
query condition: string matches regular expressions of
order type: number ascending
order type: number descending
order type: string ascending
order type: string descending
Add a narrowing condition.%% `name’ specifies the name of a column. An empty string means the primary key.%% `op’ specifies an operation type: `TokyoTyrant::RDBQRY::QCSTREQ’ for string which is equal to the expression, `TokyoTyrant::RDBQRY::QCSTRINC’ for string which is included in the expression, `TokyoTyrant::RDBQRY::QCSTRBW’ for string which begins with the expression, `TokyoTyrant::RDBQRY::QCSTREW’ for string which ends with the expression, `TokyoTyrant::RDBQRY::QCSTRAND’ for string which includes all tokens in the expression, `TokyoTyrant::RDBQRY::QCSTROR’ for string which includes at least one token in the expression, `TokyoTyrant::RDBQRY::QCSTROREQ’ for string which is equal to at least one token in the expression, `TokyoTyrant::RDBQRY::QCSTRRX’ for string which matches regular expressions of the expression, `TokyoTyrant::RDBQRY::QCNUMEQ’ for number which is equal to the expression, `TokyoTyrant::RDBQRY::QCNUMGT’ for number which is greater than the expression, `TokyoTyrant::RDBQRY::QCNUMGE’ for number which is greater than or equal to the expression, `TokyoTyrant::RDBQRY::QCNUMLT’ for number which is less than the expression, `TokyoTyrant::RDBQRY::QCNUMLE’ for number which is less than or equal to the expression, `TokyoTyrant::RDBQRY::QCNUMBT’ for number which is between two tokens of the expression, `TokyoTyrant::RDBQRY::QCNUMOREQ’ for number which is equal to at least one token in the expression, `TokyoTyrant::RDBQRY::QCFTSPH’ for full-text search with the phrase of the expression, `TokyoTyrant::RDBQRY::QCFTSAND’ for full-text search with all tokens in the expression, `TokyoTyrant::RDBQRY::QCFTSOR’ for full-text search with at least one token in the expression, `TokyoTyrant::RDBQRY::QCFTSEX’ for full-text search with the compound expression. All operations can be flagged by bitwise-or: `TokyoTyrant::RDBQRY::QCNEGATE’ for negation, `TokyoTyrant::RDBQRY::QCNOIDX’ for using no index.%% `expr’ specifies an operand exression.%% The return value is always `nil’.%%
# File tokyotyrant.rb, line 1331 def addcond(name, op, expr) @args.push("addcond" + "\00"" + name + "\00"" + op.to_s + "\00"" + expr) return nil end
Get the hint string.%% The return value is the hint string.%%
# File tokyotyrant.rb, line 1413 def hint() return @hint 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: `TokyoTyrant::RDBQRY::MSUNION’ for the union set, `TokyoTyrant::RDBQRY::MSISECT’ for the intersection set, `TokyoTyrant::RDBQRY::MSDIFF’ for the difference set. If it is not defined, `TokyoTyrant::RDBQRY::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 tokyotyrant.rb, line 1421 def metasearch(others, type = MSUNION) raise ArgumentError if !others.is_a?(Array) args = @args.dup others.each do |other| next if !other.is_a?(RDBQRY) args.push("next") other._args.each do |arg| args.push(arg) end end args.push("mstype\00"" + type.to_s) @hint = "" rv = @rdb.misc("metasearch", args, RDB::MONOULOG) return Array::new if !rv _popmeta(rv) return rv end
Execute the search.%% 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.%%
# File tokyotyrant.rb, line 1353 def search() @hint = "" rv = @rdb.misc("search", @args, RDB::MONOULOG) return Array::new if !rv _popmeta(rv) return rv end
Get the count of corresponding records.%% The return value is the count of corresponding records or 0 on failure.%%
# File tokyotyrant.rb, line 1402 def searchcount() args = @args.dup args.push("count") @hint = "" rv = @rdb.misc("search", args, RDB::MONOULOG) return 0 if !rv _popmeta(rv) return rv.size > 0 ? rv[0].to_i : 0 end
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. It returns 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.%%
# File tokyotyrant.rb, line 1375 def searchget(names = nil) raise ArgumentError if names && !names.is_a?(Array) args = @args.dup if names args.push("get\00"" + names.join("\00"")) else args.push("get") end @hint = "" rv = @rdb.misc("search", args, RDB::MONOULOG) return Array::new if !rv _popmeta(rv) for i in 0...rv.size cols = Hash::new cary = rv[i].split("\00"") cnum = cary.size - 1 j = 0 while j < cnum cols[cary[j]] = cary[j+1] j += 2 end rv[i] = cols end return rv end
Remove each corresponding record.%% If successful, the return value is true, else, it is false.%%
# File tokyotyrant.rb, line 1362 def searchout() args = @args.dup args.push("out") @hint = "" rv = @rdb.misc("search", args, 0) return false if !rv _popmeta(rv) return true 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 tokyotyrant.rb, line 1347 def setlimit(max = -1, skip = -1) @args.push("setlimit" + "\00"" + max.to_s + "\00"" + skip.to_s) return nil 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: `TokyoTyrant::RDBQRY::QOSTRASC’ for string ascending, `TokyoTyrant::RDBQRY::QOSTRDESC’ for string descending, `TokyoTyrant::RDBQRY::QONUMASC’ for number ascending, `TokyoTyrant::RDBQRY::QONUMDESC’ for number descending. If it is not defined, `TokyoTyrant::RDBQRY::QOSTRASC’ is specified.%% The return value is always `nil’.%%
# File tokyotyrant.rb, line 1339 def setorder(name, type = QOSTRASC) @args.push("setorder" + "\00"" + name + "\00"" + type.to_s) return nil end
Generated with the Darkfish Rdoc Generator 2.