|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
db_entity
Abstract class for an entity in DB.
Used to simplify SELECT
SQL queries and rendering of the results.
Note: This is Article System specific class. It uses global $db
object.
Constructor Summary | |
db_entity(var $name)
Sets up the db_entity table name. |
Method Summary | |
integer |
delete(var $where)
Executes a DB DELETE query. |
unknown |
error_report()
Prints formatted error message. |
array |
get_assoc(var $ckey,
var $cval,
var $assoc,
var $where)
Returns an associative array based on two DB entity columns. |
string |
get_error()
Returns text of the last error. |
string |
get_name()
Return name of this entity |
array |
get_one(var $what,
var $where)
Executes a DB SELECT query as get , but returns just the first value. |
array |
get(var $what,
var $where)
Executes a DB SELECT query. Note: this uses abstract_db::get_result_array , so the result array
can be either numeric, associative or both. |
unknown |
select_box(var $name,
var $cval,
var $ctext,
var $selected_value,
var $begin_options,
var $end_options,
var $attributes)
A HTML form select box renderer. Creates a select box based on the results of previous DB query. |
Constructor Detail |
public db_entity(var $name)
db_entity
table name.$name
- Name of the table in DB describing the entity, string.abstract_db
Method Detail |
public array get(var $what, var $where)
abstract_db::get_result_array
, so the result array
can be either numeric, associative or both.$what
- string The text between 'SELECT' and 'FROM'. Column names or "*".$where
- string Optional WHERE/ORDER clause.$where
- Default Value: ""public array get_one(var $what, var $where)
get
, but returns just the first value.$what
- string The text between 'SELECT' and 'FROM'. Column names or "*".$where
- string Optional WHERE/ORDER clause.$where
- Default Value: ""public array get_assoc(var $ckey, var $cval, var $assoc, var $where)
$ckey
- string First column name. Used as keys to associative array.$cval
- string Second column name. Used as values to associative array.$assoc
- array An array to put values to.$where
- string Optional WHERE/ORDER clause.$assoc
- is passed by reference$where
- Default Value: ""public integer delete(var $where)
$where
- string Compulsory WHERE clause.public string get_error()
public unknown error_report()
public string get_name()
public unknown select_box(var $name, var $cval, var $ctext, var $selected_value, var $begin_options, var $end_options, var $attributes)
$name
- Name of the select form item.$cval
- Name of column or index to the query result, to be used as option's value="".$ctext
- Name of column or index to the query result, to be used as option's label (text to display).$selected_value
- TODO: ..$begin_options
- Default Value: ""$end_options
- Default Value: ""$attributes
- Default Value: ""
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |