Class: DB_Table
Source Location: /DB_Table-1.2.1/DB/Table.php
DB_Table is a database API and data type SQL abstraction class.
Author(s):
Version:
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
DB_Table (Constructor) [line 567]
object DB_Table DB_Table(
object
&$db, string
$table, [mixed
$create = false])
|
|
Constructor. If there is an error on instantiation, $this->error will be populated with the PEAR_Error.
Parameters:
addFormElements [line 2013]
void addFormElements(
object
&$form, [array
$columns = null], [string
$array_name = null], [mixed
$clientValidate = null])
|
|
Adds elements and rules to a pre-existing HTML_QuickForm object.
Parameters:
autoRecast [line 1506]
void autoRecast(
[bool
$flag = true])
|
|
Turns on (or off) automatic recasting of insert and update data.
Parameters:
autoValidInsert [line 1195]
void autoValidInsert(
[bool
$flag = true])
|
|
Turns on (or off) automatic validation of inserted data.
Parameters:
autoValidUpdate [line 1320]
void autoValidUpdate(
[bool
$flag = true])
|
|
Turns on (or off) automatic validation of updated data.
Parameters:
buildSQL [line 1061]
mixed buildSQL(
string
$sqlkey, [string
$filter = null], [string
$order = null], [int
$start = null], [int
$count = null])
|
|
Builds the SQL command from a specified $this->sql element.
Parameters:
create [line 1768]
mixed create(
mixed
$flag)
|
|
Creates the table based on $this->col and $this->idx.
Parameters:
delete [line 1403]
mixed delete(
string
$where)
|
|
Deletes table rows matching a custom WHERE clause.
Parameters:
getBlankRow [line 1479]
Returns a blank row array based on the column map. The array keys are the column names, and all values are set to null.
getColumns [line 640]
mixed getColumns(
[mixed
$col = null])
|
|
Returns all or part of the $this->col property array.
Parameters:
getForm [line 1979]
object HTML_QuickForm &getForm(
[array
$columns = null], [string
$array_name = null], [array
$args = array()], [string
$clientValidate = null], [array
$formFilters = null])
|
|
Creates and returns a QuickForm object based on table columns.
Parameters:
getFormElement [line 2075]
object HTML_QuickForm_Element &getFormElement(
string
$column, string
$elemname)
|
|
Creates and returns a single QuickForm element based on a DB_Table column name.
Parameters:
getFormElements [line 2103]
object HTML_QuickForm_Element &getFormElements(
string
$cols, [string
$array_name = null])
|
|
Creates and returns an array of QuickForm elements based on a DB_Table column name.
Parameters:
getFormGroup [line 2047]
array &getFormGroup(
[array
$columns = null], [string
$array_name = null])
|
|
Creates and returns an array of QuickForm elements based on an array of DB_Table column names.
Parameters:
getIndexes [line 690]
array getIndexes(
[mixed
$idx = null], string
$col)
|
|
Returns all or part of the $this->idx property array.
Parameters:
insert [line 1163]
mixed insert(
array
$data)
|
|
Inserts a single table row after validating through validInsert().
Parameters:
isRequired [line 1918]
boolean isRequired(
mixed
$column)
|
|
Is a specific column required to be set and non-null?
Parameters:
isValid [line 1830]
boolean isValid(
array
$val, array
$col)
|
|
Checks if a value validates against the DB_Table data type for a given column. This only checks that it matches the data type; it does not do extended validation.
Parameters:
nextID [line 1423]
integer nextID(
[string
$seq_name = null])
|
|
Generates a sequence value; sequence name defaults to the table name.
Parameters:
quote [line 1460]
string quote(
mixed
$val)
|
|
Escapes and enquotes a value for use in an SQL query. Helps makes user input safe against SQL injection attack.
recast [line 1539]
void recast(
array
&$data)
|
|
Forces array elements to the proper types for their columns. This will not valiate the data, and will forcibly change the data to match the recast-type. The date, time, and timestamp recasting has special logic for arrays coming from an HTML_QuickForm object so that the arrays are converted into properly-formatted strings.
Parameters:
select [line 767]
mixed select(
string
$sqlkey, [string
$filter = null], [string
$order = null], [int
$start = null], [int
$count = null], [array
$params = array()])
|
|
Selects rows from the table using one of the 'DB::get*()' methods.
Parameters:
selectCount [line 941]
mixed selectCount(
string
$sqlkey, [string
$filter = null], [string
$order = null], [int
$start = null], [int
$count = null], [array
$params = array()])
|
|
Counts the number of rows which will be returned by a query. This function works identically to select(), but it returns the number of rows returned by a query instead of the query results themselves. This makes using DB_Table with Pager easier, since you can pass the return value of this to Pager as totalItems, then select only the rows you need to display on a page.
Parameters:
selectResult [line 860]
mixed selectResult(
string
$sqlkey, [string
$filter = null], [string
$order = null], [int
$start = null], [int
$count = null], [array
$params = array()])
|
|
Selects rows from the table as a DB_Result object.
Parameters:
supported [line 616]
bool supported(
string
$phptype)
|
|
Is a particular RDBMS supported by DB_Table?
Parameters:
throwError [line 529]
object PEAR_Error &throwError(
string
$code, [string
$extra = null])
|
|
Specialized version of throwError() modeled on PEAR_Error. Throws a PEAR_Error with a DB_Table error message based on a DB_Table constant error code.
Parameters:
update [line 1288]
mixed update(
array
$data, string
$where)
|
|
Updates table row(s) matching a custom WHERE clause, after checking against validUpdate().
Parameters:
validInsert [line 1223]
mixed validInsert(
array
&$data)
|
|
Validates an array for insertion into the table.
Parameters:
validUpdate [line 1348]
mixed validUpdate(
array
&$data)
|
|
Validates an array for updating the table.
Parameters:
_getFormColDefs [line 2126]
array _getFormColDefs(
[string|array
$column_set = null])
|
|
Creates a column definition array suitable for DB_Table_QuickForm.
Parameters:
Documentation generated on Tue, 13 Sep 2005 11:00:11 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.
|
|