Class: DB_Table
Source Location: /DB_Table-1.3.0/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 707]
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 2463]
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:
alter [line 2210]
Alters the table based on $this->col and $this->idx.
autoRecast [line 1885]
void autoRecast(
[bool
$flag = true])
|
|
Turns on (or off) automatic recasting of insert and update data.
Parameters:
autoValidInsert [line 1549]
void autoValidInsert(
[bool
$flag = true])
|
|
Turns on (or off) automatic validation of inserted data.
Parameters:
autoValidUpdate [line 1683]
void autoValidUpdate(
[bool
$flag = true])
|
|
Turns on (or off) automatic validation of updated data.
Parameters:
buildSQL [line 1401]
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 2146]
mixed create(
mixed
$flag)
|
|
Creates the table based on $this->col and $this->idx.
Parameters:
delete [line 1768]
mixed delete(
string
$where)
|
|
Deletes table rows matching a custom WHERE clause.
Parameters:
getBlankRow [line 1858]
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 944]
mixed getColumns(
[mixed
$col = null])
|
|
Returns all or part of the $this->col property array.
Parameters:
getForm [line 2428]
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 2526]
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 2557]
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 2497]
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 994]
array getIndexes(
[mixed
$idx = null], string
$col)
|
|
Returns all or part of the $this->idx property array.
Parameters:
getPHPTypeAndDBSyntax [line 886]
array getPHPTypeAndDBSyntax(
object
&$db)
|
|
Detect values of 'phptype' and 'dbsyntax' keys of DSN.
Parameters:
insert [line 1512]
mixed insert(
array
$data)
|
|
Inserts a single table row after validating through validInsert().
Parameters:
isRequired [line 2367]
boolean isRequired(
mixed
$column)
|
|
Is a specific column required to be set and non-null?
Parameters:
isValid [line 2279]
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:
modeSupported [line 837]
bool|object True modeSupported(
string
$mode, string
$phptype)
|
|
Is a creation mode supported for a RDBMS by DB_Table?
Parameters:
nextID [line 1795]
integer nextID(
[string
$seq_name = null])
|
|
Generates a sequence value; sequence name defaults to the table name.
Parameters:
quote [line 1834]
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 1918]
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 1081]
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/MDB2 get*() methods.
Parameters:
selectCount [line 1277]
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 1184]
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/MDB2_Result_* object.
Parameters:
setErrorMessage [line 917]
void setErrorMessage(
mixed
$code, [string
$message = null])
|
|
Overwrite one or more error messages, e.g. to internationalize them.
Parameters:
supported [line 811]
bool supported(
string
$phptype, [string
$dbsyntax = ''])
|
|
Is a particular RDBMS supported by DB_Table?
Parameters:
throwError [line 662]
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 1644]
mixed update(
array
$data, string
$where)
|
|
Updates table row(s) matching a custom WHERE clause, after checking against validUpdate().
Parameters:
validInsert [line 1577]
mixed validInsert(
array
&$data)
|
|
Validates an array for insertion into the table.
Parameters:
validUpdate [line 1711]
mixed validUpdate(
array
&$data)
|
|
Validates an array for updating the table.
Parameters:
verify [line 2251]
Verifies the table based on $this->col and $this->idx.
_getFormColDefs [line 2582]
array _getFormColDefs(
[string|array
$column_set = null])
|
|
Creates a column definition array suitable for DB_Table_QuickForm.
Parameters:
Documentation generated on Wed, 26 Apr 2006 12:03:21 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.
|
|