![]() |
Xataface 2.0
Xataface Application Framework
|
Definition at line 24 of file wrapper.php.
_findClausesWithPattern_rec | ( | $ | regex, |
&$ | root, | ||
&$ | clauses | ||
) |
Definition at line 518 of file wrapper.php.
_findClausesWithTable_rec | ( | $ | table, |
&$ | root, | ||
&$ | clauses | ||
) |
Definition at line 476 of file wrapper.php.
_makeEquivalenceLabels_rec | ( | &$ | labels, |
&$ | values, | ||
&$ | root | ||
) |
Definition at line 678 of file wrapper.php.
_removeClause_rec | ( | $ | clause, |
$ | root | ||
) |
Definition at line 336 of file wrapper.php.
addColumn | ( | $ | columnname, |
$ | columnalias | ||
) |
Adds a column to the select list.
Definition at line 213 of file wrapper.php.
addMetaDataColumn | ( | $ | columnName, |
$ | fullColumnNames = false |
||
) |
Adds columns to describe a particular column. Currently only columns to describe the size of the data in a field are added.
$columnName | The name of the column for which we want meta data. string |
$fullColumnNames | whether to make the meta data column names such that they specify both the table and the column of the referenced columns. boolean |
For example, suppose we have the query "select blurb from Profiles".
We do the following:
$parser = new SQL_Parser(null,'MySQL'); $sql = "select blurb from Profiles"; $parsed = $parser->parse($sql); $wrapper = new SQL_Parser_wrapper($parsed); $wrapper->addMetaDataColumn('blurb'); $compiler = new SQL_Compiler(); $sql = $compiler->compile($parsed); echo $sql; // should output: select blurb, LENGTH(blurb) as __blurb_length from Profiles
In other words it will add another column named __ColumnName_length that contains the length in bytes of the column.
Definition at line 433 of file wrapper.php.
addMetaDataColumns | ( | $ | fullColumnNames = false | ) |
Adds meta data columns for all columns in this query. A meta data column is one that describes the column data, such as its length.
Definition at line 468 of file wrapper.php.
& addSortClause | ( | $ | sortStr | ) |
Definition at line 284 of file wrapper.php.
& addWhereClause | ( | $ | whereStr, |
$ | op = 'and' |
||
) |
Definition at line 253 of file wrapper.php.
& appendClause | ( | $ | clause, |
$ | op = 'or' |
||
) |
Appends a clause to the where clause.
Definition at line 222 of file wrapper.php.
array_ereg_search | ( | $ | needle, |
$ | haystack | ||
) |
like array_search, except the needle is a regular expression so that matches can be done for things other than equality.
Definition at line 153 of file wrapper.php.
findJoinClausesWithPattern | ( | $ | regex | ) |
Definition at line 506 of file wrapper.php.
findJoinClausesWithTable | ( | $ | table | ) |
Definition at line 388 of file wrapper.php.
findWhereClausesWithPattern | ( | $ | regex | ) |
Definition at line 498 of file wrapper.php.
findWhereClausesWithTable | ( | $ | table | ) |
Definition at line 378 of file wrapper.php.
fixColumns | ( | ) |
Definition at line 645 of file wrapper.php.
getTableAlias | ( | $ | tablename | ) |
Gets the alias for a particular tablename. If no alias is found then the tablename itself is returned. If the specified tablename does not exists at all then a PEAR_Error is thrown.
Definition at line 66 of file wrapper.php.
getTableName | ( | $ | columnname | ) |
Extracts the tablename from a requested column name. This will resolve aliases.
columnname | The name of a column as it appears in a select list. Eg: a.b, Student.profileid etc.. |
Definition at line 40 of file wrapper.php.
getTableNames | ( | ) |
Definition at line 688 of file wrapper.php.
getTableNames_rec | ( | &$ | root, |
&$ | tables | ||
) |
Definition at line 694 of file wrapper.php.
makeEquivalenceLabels | ( | &$ | labels, |
&$ | values | ||
) |
Definition at line 657 of file wrapper.php.
packTables | ( | $ | exempt = array() | ) |
Removes unneccessary tables from the query. A table is deemed unnecessary if it doesn't have any columns in the select list and it does not appear in the where clause, and it is not involved with any non-trivial joins.
Definition at line 585 of file wrapper.php.
removeColumn | ( | $ | columnname | ) |
Removes the specified column from the select clause.
Definition at line 179 of file wrapper.php.
removeColumnsFromTable | ( | $ | tablename | ) |
Removes all columns from the query belonging to the given tablename. returns The number of columns removed.
Definition at line 198 of file wrapper.php.
removeJoinClause | ( | $ | clause | ) |
Definition at line 315 of file wrapper.php.
removeJoinClausesWithPattern | ( | $ | regex | ) |
Definition at line 573 of file wrapper.php.
removeJoinClausesWithTable | ( | $ | table | ) |
Definition at line 557 of file wrapper.php.
& removeWhereClause | ( | $ | clause | ) |
Definition at line 305 of file wrapper.php.
removeWhereClausesWithPattern | ( | $ | regex | ) |
Definition at line 565 of file wrapper.php.
removeWhereClausesWithTable | ( | $ | table | ) |
Definition at line 547 of file wrapper.php.
resolveColumnName | ( | $ | columnname | ) |
Given a column name without its associated table or using its table's alias this will returnt he absolute column name in the form 'Tablename.Columnname'
Definition at line 87 of file wrapper.php.
& setSortClause | ( | $ | sortStr | ) |
Definition at line 266 of file wrapper.php.
SQL_Parser_wrapper | ( | &$ | data, |
$ | dialect = 'MySQL' |
||
) |
Definition at line 30 of file wrapper.php.
translate_select_query | ( | ) |
Definition at line 684 of file wrapper.php.
unresolveColumnName | ( | $ | columnname | ) |
Given an absolute column name of the form 'Tablename.Columnname' this will return the column name as it should appear in the select list. This will replace the table name with the table alias if one exists.
For example, in the query "select * from Courses as c",
$this->unresolveColumnName('Courses.id') === 'c.id'
Definition at line 113 of file wrapper.php.
unresolveWhereClauseColumns | ( | &$ | clause | ) |
Definition at line 162 of file wrapper.php.
$_data |
Definition at line 26 of file wrapper.php.
$_parser |
Definition at line 28 of file wrapper.php.
$_tableLookup |
Definition at line 27 of file wrapper.php.