Previous section
To contents
Next section
14.10.2 Tables
The table object is used to store and retrieve information from a table. Table objects are created by the db class. A table object can create a transaction object.
M
ETHOD
Yabu.table.set
- Store a record in a table
S
YNTAX
mixed set(string key, mixed data);
mixed `[]=(string key, mixed data);
D
ESCRIPTION
This method stores the contents of
data
as a record with the name
key
. If a record with that name already exists, it will be replaced. Records can only be added to the database in write mode.
S
EE
A
LSO
Yabu.table->get
,
Yabu.table->delete
,
Yabu.table->list_keys
and
Yabu.table->purge
M
ETHOD
Yabu.table.get
- Fetch a record from a table
S
YNTAX
mixed get(string key);
mixed `[](string key);
D
ESCRIPTION
This method fetches the data associated with the record name
key
. If a record does not exist, zero is returned.
S
EE
A
LSO
Yabu.table->set
,
Yabu.table->delete
,
Yabu.table->list_keys
and
Yabu.table->purge
M
ETHOD
Yabu.table.list_keys
- List the records in a table
S
YNTAX
array(string) list_keys();
array(string) _indices();
D
ESCRIPTION
This method lists all record names in the table.
S
EE
A
LSO
Yabu.table->set
,
Yabu.table->get
,
Yabu.table->delete
,
Yabu.table->purge
and
Yabu.table->_values
M
ETHOD
Yabu.table._values
- Get all the records in a table
S
YNTAX
array(mixed) _values();
D
ESCRIPTION
This method returns all record names in the table.
S
EE
A
LSO
Yabu.table->set
,
Yabu.table->get
,
Yabu.table->delete
,
Yabu.table->purge
and
Yabu.table->_indices
M
ETHOD
Yabu.table.delete
- Delete a record in a table
S
YNTAX
void delete(string
key
);
D
ESCRIPTION
This method deletes the record with the name
key
.
S
EE
A
LSO
Yabu.table->set
,
Yabu.table->get
,
Yabu.table->list_keys
and
Yabu.table->purge
M
ETHOD
Yabu.table.purge
- Delete a table
S
YNTAX
void purge();
D
ESCRIPTION
This method deletes the whole table and the table files on disk.
S
EE
A
LSO
Yabu.table->set
,
Yabu.table->get
,
Yabu.table->list_keys
and
Yabu.table->delete
M
ETHOD
Yabu.table.transaction
- Begin a transaction
S
YNTAX
object(transaction) transaction();
D
ESCRIPTION
A transaction is a sequence of table commands that will be accepted in whole, or not at all. If the program for some reason crashes or makes an abrupt exit during a transaction, the transaction is cancelled.
This method returns a transaction object.
S
EE
A
LSO
Yabu.transaction->commit
and
Yabu.transaction->rollback
Previous section
To contents
Next section