![]() |
Xataface 2.0
Xataface Application Framework
|
Public Member Functions | |
Dataface_QueryTranslator ($lang=null) | |
setParentContext (&$translator) | |
translateQuery ($query, $lang=null, $compile=true) | |
translateSelectQuery ($query, $lang=null, $compile=true) | |
translateColumn (&$col, $column_alias=null, $update=true) | |
translateFunction (&$func, $update=true) | |
translateClause (&$clause) | |
translateBinaryClause (&$clause) | |
translateUnaryClause (&$clause) | |
expandGlob ($glob) | |
translateUpdateQuery ($query) | |
extractQuery (&$data) | |
extractQuery_rec ($clause, &$out) | |
translateInsertQuery ($query) | |
translateDeleteQuery ($query) | |
Data Fields | |
$app | |
$_tableNames = array() | |
$_tableAliases = array() | |
$_tables = array() | |
$_tableNames_tr = array() | |
$_tableAliases_tr = array() | |
$_tableAliasTranslationMap = array() | |
$_columnTranslationMap = array() | |
$_tableTranslations = null | |
$_lang = null | |
$_data | |
$_data_translated | |
$_parser | |
$_compiler | |
$_query | |
$parentContext |
File: Dataface/QueryTranslator.php Author: Steve Hannah <shannah@sfu.ca> Created: May 1, 2006 Description: Class to convert SQL queries into multlingual queries based on table naming conventions.
Definition at line 30 of file QueryTranslator.php.
Dataface_QueryTranslator | ( | $ | lang = null | ) |
Functions defined in this class:
function translateQuery($query, $lang=null){} function translateSelectQuery($query, $lang=null){} function translateUpdateQuery($query, $lang=null){} function translateInsertQuery($query, $lang=null){} function translateIdent($ident, $lang=null){} function translateFunction($func, $lang=null){} function translateJoinClause($func, $lang=null){} function translateWhereClause($func, $lang=null){}
Definition at line 68 of file QueryTranslator.php.
expandGlob | ( | $ | glob | ) |
Expands a glob into its component columns. e.g., '*' is transformed to an array of all columns in the table. Also accepts input of the form <Tablename>.* and <alias>.*.
Definition at line 613 of file QueryTranslator.php.
extractQuery | ( | &$ | data | ) |
Extracts a dataface query array from a data structure for an SQL query. The dataface query array is of the form [Column] -> [Value].
Definition at line 774 of file QueryTranslator.php.
extractQuery_rec | ( | $ | clause, |
&$ | out | ||
) |
Definition at line 781 of file QueryTranslator.php.
setParentContext | ( | &$ | translator | ) |
IF this translator is meant to work within the context of another translator, this this method can be used to set the parent context to the parent translator.
The tables and columns of the parent context should be accessible from the child context.
$translator | A Dataface_QueryTranslator object that is the parent of the current object. |
Definition at line 99 of file QueryTranslator.php.
translateBinaryClause | ( | &$ | clause | ) |
Definition at line 547 of file QueryTranslator.php.
translateClause | ( | &$ | clause | ) |
Translates a clause such as a where clause or a join clause in place. Does not return anything.. only modifies the clause in place.
Definition at line 541 of file QueryTranslator.php.
translateColumn | ( | &$ | col, |
$ | column_alias = null , |
||
$ | update = true |
||
) |
Translates a column.
$col | The name of the column as it appears in the select list. |
$column_alias | The column's alias. |
$updateTables | If true (default) this will cause the tables list to be updated. |
$updateColumns | If true (default) this will cause the columnTranslationMap to be updated. |
Definition at line 272 of file QueryTranslator.php.
translateDeleteQuery | ( | $ | query | ) |
Translates a delete query. Essentially, this just needs to delete all of the translations for the deleted record. This only works if the delete command is deleting a single record using the primary keys in the where clause.
Definition at line 898 of file QueryTranslator.php.
translateFunction | ( | &$ | func, |
$ | update = true |
||
) |
Translates a function in place. Alternatively can be made to return a copy of the function with the modifications made, without modifying the original function, by setting the second parameter to false.
Definition at line 494 of file QueryTranslator.php.
translateInsertQuery | ( | $ | query | ) |
Translates a given insert query into a multilingual insert. I.e. it places translated field values into the translation table. All values are placed into the base table, but the translated values are duplicated in the translation table. This is the preferred functionality because new records should be available to all languages by default - when a translation is made, it will override the default.
Definition at line 811 of file QueryTranslator.php.
translateQuery | ( | $ | query, |
$ | lang = null , |
||
$ | compile = true |
||
) |
Definition at line 103 of file QueryTranslator.php.
translateSelectQuery | ( | $ | query, |
$ | lang = null , |
||
$ | compile = true |
||
) |
Definition at line 170 of file QueryTranslator.php.
translateUnaryClause | ( | &$ | clause | ) |
Definition at line 555 of file QueryTranslator.php.
translateUpdateQuery | ( | $ | query | ) |
Translates the given update query into a multilingual update. This will cause columns with a translation to be updated in the translated table only (not the base table) and key columns are updated in both the translation table and the base table. This will return an array of SQL queries to perform the update.
Definition at line 657 of file QueryTranslator.php.
$_columnTranslationMap = array() |
Definition at line 40 of file QueryTranslator.php.
$_compiler |
Definition at line 49 of file QueryTranslator.php.
$_data |
Definition at line 45 of file QueryTranslator.php.
$_data_translated |
Definition at line 46 of file QueryTranslator.php.
$_lang = null |
Definition at line 44 of file QueryTranslator.php.
$_parser |
Definition at line 48 of file QueryTranslator.php.
$_query |
Definition at line 50 of file QueryTranslator.php.
$_tableAliases = array() |
Definition at line 33 of file QueryTranslator.php.
$_tableAliases_tr = array() |
Definition at line 37 of file QueryTranslator.php.
$_tableAliasTranslationMap = array() |
Definition at line 38 of file QueryTranslator.php.
$_tableNames = array() |
Definition at line 32 of file QueryTranslator.php.
$_tableNames_tr = array() |
Definition at line 36 of file QueryTranslator.php.
$_tables = array() |
Definition at line 34 of file QueryTranslator.php.
$_tableTranslations = null |
Definition at line 42 of file QueryTranslator.php.
$app |
Definition at line 31 of file QueryTranslator.php.
$parentContext |
Definition at line 52 of file QueryTranslator.php.