|
Tv2 documentation | |||||
PREV NEXT | FRAMES NO FRAME | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
General purpose indexer.
Field Summary | |
private object | $db Database |
private string | $fkeys Float keys table name |
private string | $ikeys Int keys table name |
private array | $indices Indexes array |
private string | $itable Indices table name |
private string | $skeys String keys table name |
private string | $slists String value lists table |
Constructor Summary | |
void | ctlIndexer() Constructor. |
Method Summary | |
boolean | addItem(integer $id, string $iname, mixed $val) Adds item to index |
boolean | createIndex(string $iname, [string $type]) Creates a new index |
boolean | dropIndex(string $iname) Removes index |
boolean | emptyIndex(string $iname) Removes values from index |
mixed | getByIndex(string $iname) Returns array of item ids indexed by values |
mixed | getByPreg(string $iname, string $preg) Returns an array of item ids matching a regular expression. |
mixed | getByRange(string $iname, [mixed $from], [boolean $fs], [mixed $to], [boolean $ts]) Returns items whose values are in a range. |
mixed | getByValue(string $iname, mixed $val) Returns an array of item ids that have common value |
mixed | getByValueList(string $iname, array $vals) Returns an array of item ids which have values specified in $vals |
mixed | getValues(string $iname) Returns an array of values stored in index |
boolean | load(array $tables) Loads indices from table, assignes values to table name attributes |
void | removeItem(integer $id) Removes item from index tables |
mixed | sortIdList(array $ids, string $iname, [string $direction]) Sorts item id list by indexed value |
boolean | updateItem(integer $id, string $iname, mixed $val) Updates indexed item value |
Field Detail |
private object $db
private string $fkeys
Float keys table name
private string $ikeys
Int keys table name
private array $indices
Indexes array
private string $itable
Indices table name
private string $skeys
String keys table name
private string $slists
String value lists table
Constructor Detail |
void ctlIndexer()
Constructor. Links $this->db to db, creates empty $this->indices array
Method Detail |
boolean addItem(integer $id, string $iname, mixed $val)
Adds item to index
id
- item idiname
- index nameval
- item valueboolean createIndex(string $iname, [string $type])
Creates a new index
iname
- Index nametype
- Index type (one of: string, int, float).
Default: stringboolean dropIndex(string $iname)
Removes index
iname
- Index nameboolean emptyIndex(string $iname)
Removes values from index
iname
- Index namemixed getByIndex(string $iname)
Returns array of item ids indexed by values
iname
- Index namemixed getByPreg(string $iname, string $preg)
Returns an array of item ids matching a regular expression.
iname
- index namepreg
- regular expression. Full Perl-compatible regexp should be specified (e.g. /foo/i).mixed getByRange(string $iname, [mixed $from], [boolean $fs], [mixed $to], [boolean $ts])
Returns items whose values are in a range. Applies only to int and float indexes.
iname
- index namefrom
- lower value. NULL if not specified. Note that 0 (zero) is a value.fs
- "from strict"? if TRUE '>' will be used, otherwise '>='. Defaults to FALSE.to
- upper value. NULL if not specified. Note that 0 (zero) is a value.ts
- "to strict"? if TRUE '<' will be used, '<=' otherwise. Defaults to FALSE.mixed getByValue(string $iname, mixed $val)
Returns an array of item ids that have common value
iname
- index nameval
- item valuemixed getByValueList(string $iname, array $vals)
Returns an array of item ids which have values specified in $vals
iname
- index namevals
- array of item valuesmixed getValues(string $iname)
Returns an array of values stored in index
iname
- Index nameboolean load(array $tables)
Loads indices from table, assignes values to table name attributes
tables
- array of table names. Format:
array('itable'=>'index_table', 'ikeys'=>'int_keys'...)void removeItem(integer $id)
Removes item from index tables
id
- item idmixed sortIdList(array $ids, string $iname, [string $direction])
Sorts item id list by indexed value
ids
- item id arrayiname
- index namedirection
- order direction (ASC/DESC)boolean updateItem(integer $id, string $iname, mixed $val)
Updates indexed item value
id
- item idiname
- index nameval
- item value
|
Tv2 documentation | |||||
PREV NEXT | FRAMES NO FRAME | |||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)