Class: TokyoTyrant::RDBTBL

Class | TokyoTyrant::RDBTBL
In: | tokyotyrant.rb
Parent: | RDB

This class inherits the class "TokyoTyrant::RDB". All methods are specific to servers of the table database.

### Methods

genuid get mget out put putcat putkeep setindex

### Constants

ITLEXICAL | = | 0 |  | index type: lexical string
ITDECIMAL | = | 1 |  | index type: decimal string
ITTOKEN | = | 2 |  | index type: token inverted index
ITQGRAM | = | 3 |  | index type: q-gram inverted index
ITOPT | = | 9998 |  | index type: optimize
ITVOID | = | 9999 |  | index type: void
ITKEEP | = | 1 << 24 |  | index type: keep existing index

### Public Instance methods

genuid()

Generate a unique ID number.
The return value is the new unique ID number or -1 on failure.

get(pkey)

Retrieve a record.
`pkey' specifies the primary key.
If successful, the return value is a hash of the columns of the corresponding record. `nil' is returned if no record corresponds.

mget(recs)

Retrieve records.
`recs' specifies a hash containing the retrieval keys. As a result of this method, keys existing in the database have the corresponding columns and keys not existing in the database are removed.
If successful, the return value is the number of retrieved records or -1 on failure.
Due to the protocol restriction, this method can not handle records with binary columns including the "\0" chracter.

out(pkey)

Remove a record.
`pkey' specifies the primary key.
If successful, the return value is true, else, it is false.

put(pkey, cols)

Store a record.
`pkey' specifies the primary key.
`cols' specifies a hash containing columns.
If successful, the return value is true, else, it is false.
If a record with the same key exists in the database, it is overwritten.

putcat(pkey, cols)

Concatenate columns of the existing record.
`pkey' specifies the primary key.
`cols' specifies a hash containing columns.
If successful, the return value is true, else, it is false.
If there is no corresponding record, a new record is created.

putkeep(pkey, cols)

Store a new record.
`pkey' specifies the primary key.
`cols' specifies a hash containing columns.
If successful, the return value is true, else, it is false.
If a record with the same key exists in the database, this method has no effect.

setindex(name, type)

Set a column index.
`name' specifies the name of a column. If the name of an existing index is specified, the index is rebuilt. An empty string means the primary key.
`type' specifies the index type: `TokyoTyrant::RDBTBL::ITLEXICAL' for lexical string, `TokyoTyrant::RDBTBL::ITDECIMAL' for decimal string, `TokyoTyrant::RDBTBL::ITTOKEN' for token inverted index, `TokyoTyrant::RDBTBL::ITQGRAM' for q-gram inverted index. If it is `TokyoTyrant::RDBTBL::ITOPT', the index is optimized. If it is `TokyoTyrant::RDBTBL::ITVOID', the index is removed. If `TokyoTyrant::RDBTBL::ITKEEP' is added by bitwise-or and the index exists, this method merely returns failure.
If successful, the return value is true, else, it is false.