From 912f82fd85b09fec55b922323c1720d00b8250ea Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 23 Apr 2006 14:50:48 +0000 Subject: [PATCH] - new capability for outer joins - new/changed param to allow to use db::get_table_definitions() without setting/chaning the definitions loaded by the db-class --- phpgwapi/inc/class.egw_db.inc.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 006e17a75f..768277cee6 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -121,6 +121,7 @@ var $capabilities = array( 'sub_queries' => true, // will be set to false for mysql < 4.1 'union' => true, // will be set to false for mysql < 4.0 + 'outer_join' => false, // does the DB has an outer join, will be set eg. for postgres 'distinct_on_text' => true, // is the DB able to use DISTINCT with a text or blob column 'like_on_text' => true, // is the DB able to use LIKE with text columns 'name_case' => 'upper', // case of returned column- and table-names: upper, lower(pgSql), preserv(MySQL) @@ -339,6 +340,7 @@ case 'postgres': $this->capabilities['name_case'] = 'lower'; $this->capabilities['client_encoding'] = (float) $db_version >= 7.4; + $this->capabilities['outer_join'] = true; break; case 'mssql': @@ -1298,12 +1300,24 @@ * * @author RalfBeckeroutdoor-training.de * - * @param bool/string $app name of the app or default False to use the app set by db::set_app or the current app + * @param bool/string $app name of the app or default False to use the app set by db::set_app or the current app, + * true to search the already loaded table-definitions for $table * @param bool/string $table if set return only defintions of that table, else return all defintions * @return mixed array with table-defintions or False if file not found */ function get_table_definitions($app=False,$table=False) { + if ($app === true && $table && isset($GLOBALS['egw_info']['apps'])) + { + foreach($GLOBALS['egw_info']['apps'] as $app => $app_data) + { + if (isset($data['table_defs'][$table])) + { + return $data['table_defs'][$table]; + } + } + $app = false; + } if (!$app) { $app = $this->app ? $this->app : $GLOBALS['egw_info']['flags']['currentapp']; @@ -1325,7 +1339,8 @@ return $this->app_data['table_defs'] = False; } include($tables_current); - $this->app_data['table_defs'] = &$phpgw_baseline; + $this->app_data['table_defs'] =& $phpgw_baseline; + unset($phpgw_baseline); } if ($table && (!$this->app_data['table_defs'] || !isset($this->app_data['table_defs'][$table]))) {