Public Member Functions | |
| SQL_Generator (&$page) | |
| enumerate ($params, $set_vars=false) | |
| filter ($exprs=array(), $gexprs=array()) | |
| sort ($default, $exprs=array()) | |
| paginate ($perpage=50) | |
Public Attributes | |
| $db | |
| $page | |
PRONTO WEB FRAMEWORK Copyright (C) 2006, Judd Vinet
Description: SQL Generator Methods. Intended to be used by page controllers only.
Definition at line 12 of file sql.php.
| SQL_Generator::enumerate | ( | $ | params, | |
| $ | set_vars = false | |||
| ) |
Generate SQL to enumerate the records of an entity, returning the resulting rows and related pagination data.
| array | $params Parameters that will be used to generate the resulting SQL. These parameters are typically provided by the entity's model, usually in a method called list_params(). | |
| boolean | $set_vars Automatically set template variables: (data, totalrows, curpage, perpage) |
Definition at line 38 of file sql.php.
References $args, $params, assert_type(), filter(), paginate(), and sort().
| SQL_Generator::filter | ( | $ | exprs = array(), |
|
| $ | gexprs = array() | |||
| ) |
Generate SQL to filter a result set based on filter variables in _REQUEST. This can generate SQL that can be used in a WHERE or HAVING clause.
| array | $exprs An array of expressions that do not correspond to real table columns, but to more complex statements that involve functions (eg, LENGTH(colname) or COUNT(c.id)). Each array key should be the "column" name used in the filter variable in _REQUEST. |
Definition at line 113 of file sql.php.
References $args.
Referenced by enumerate().
| SQL_Generator::paginate | ( | $ | perpage = 50 |
) |
Generate SQL to paginate a result set. Also sets the "perpage" and "curpage" variables in the template.
| int | $perpage Number of records to show per page |
Definition at line 277 of file sql.php.
References $page.
Referenced by enumerate().
| SQL_Generator::sort | ( | $ | default, | |
| $ | exprs = array() | |||
| ) |
Generate SQL to sort a result set based on sort variables in _REQUEST
| string | $default Default column(s) to sort by | |
| array | $exprs An array of expressions that do not correspond to real table columns, but to more complex statements that involve functions (eg, LENGTH(colname) or COUNT(c.id)). Each array key should be the "column" name used in the filter variable in _REQUEST. |
Definition at line 233 of file sql.php.
References $p.
Referenced by enumerate().
| SQL_Generator::SQL_Generator | ( | &$ | page | ) |
Constructor
| object | $page The controller object that owns this instance of SQL_Generator |
Definition at line 22 of file sql.php.
References $page, and Registry::get().
| SQL_Generator::$page |
Definition at line 15 of file sql.php.
Referenced by paginate(), and SQL_Generator().
1.6.1