YANA 4 PHP Framework
Docs For Class BufferedDbStream
database API
this class is a database abstraction api, that uses pear db
Located in /includes/class_buffereddbstream.php
SerializeableObject | --BufferedDbStream
Class | Description |
---|---|
FileDb | simulate a database |
create a new instance
Each database connection depends on a structure file describing the database. Therefore you have to provide a $filename of such structure file (without path or extension)
These files are to be found in config/db/*.config
Name | Type | Description |
---|---|---|
$filename | string | |
$server | dbServer |
Check wether a certain key exists
Returns bool(true), if the adress $key (table, row, column) is defined, and otherwise bool(false). If no argument is provided, the function returns bool(true) if a database connection exists and bool(false) if not.
Name | Type | Description |
---|---|---|
$key | string | adress to check |
export database structure to a file
Note: if the specified file already exists it will get overwritten.
Structure files need to have the extension '.config' and are to be stored at the directory 'config/db/*.config'.
Name | Type | Description |
---|---|---|
$filename | string |
get values from the database
This returns the values at adress $key starting from $offset and limited to $limit results.
Name | Type | Description |
---|---|---|
$key | mixed | |
$search | string | (optional) |
$filter | string | (optional) |
$offset | int | (optional) |
$limit | int | (optional) |
get the most recently queried table
import SQL from a file
Name | Type | Description |
---|---|---|
$sqlFile | string |
update or insert row
insert $value at position $key
If $key already exists, the previous value gets updated, else the value is created
This function returns bool(true) on success and bool(false) on error. Note, that this function does not auto-commit. This means, changes to the database will NOT be saved unless you call $bufferedDbStream->write().
Name | Type | Description |
---|---|---|
$key | string | |
$value | mixed |
check wether a certain table has no entries
Note: if no table is provided, the most recently used table will be tested instead.
Name | Type | Description |
---|---|---|
$table | string | (optional) |
check wether the current database is readonly
join the resultsets for two tables
results in an INNER JOIN $table1, $table2 WHERE $table1.$key1 = $table2.$key2
Name | Type | Description |
---|---|---|
$table1 | string | |
$table2 | string | (optional) |
$key1 | string | (optional) |
$key2 | string | (optional) |
get the number of entries inside a table
Name | Type | Description |
---|---|---|
$table | string | (optional) |
$search | string | (optional) |
optional API bypass
send a sql-statement directly, bypassing the API
Name | Type | Description |
---|---|---|
$sqlStmt | string |
remove one row
For security reasons all delete queries will automatically be limited to 1 row at a time. While this might be seen as a limitation the far more valueable advantage is, no user is able to destroy a whole table - wether by intention or by accident - in only one query. (At least not via this API.)
Name | Type | Description |
---|---|---|
$key | string | |
$search | string | (optional) |
get CSV string from a table
Name | Type | Description |
---|---|---|
$table | string | (optional) |
Commit current transaction
This writes all changes to the database
Inherited From SerializeableObject
SerializeableObject::serialize()
SerializeableObject::toString()
Documentation generated on Sat, 16 Sep 2006 17:05:52 +0200 by phpDocumentor 1.3.0RC4