fixed mysql part for system\system::locale::getStrings -> maybe the quotes are wrong for pg

This commit is contained in:
Ulf Gebhardt 2013-05-14 23:46:02 +02:00
parent 790e5d67db
commit 194427c2e0

View File

@ -52,12 +52,12 @@ class locale {
foreach($request as $strid){
if(!\preg_match("^[a-zA-Z0-9_]+$^", $strid) != 0){
throw new \Exception("Requested id contains inpropper symbols: ".$strid);}
$where .= 'OR "'.\SYSTEM\DBD\locale_string::FIELD_ID.'" = $1 ';
$where .= 'OR `'.\SYSTEM\DBD\locale_string::FIELD_ID.'` = $1 ';
}
$where = substr($where,2);
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = $con->prepare( 'localeArrStmt', 'SELECT "'.$lang.'","'.\SYSTEM\DBD\locale_string::FIELD_ID.'" FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\locale_string::NAME_PG : \SYSTEM\DBD\locale_string::NAME_MYS).' WHERE '.$where,
$res = $con->prepare( 'localeArrStmt', 'SELECT `'.$lang.'`,`'.\SYSTEM\DBD\locale_string::FIELD_ID.'` FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\locale_string::NAME_PG : \SYSTEM\DBD\locale_string::NAME_MYS).' WHERE '.$where,
$request);
$result = array();
@ -68,8 +68,8 @@ class locale {
} else if(\intval($request)){
$cat = \intval($request);
$con = new \SYSTEM\DB\Connection(new \DBD\dasensePostgres());
$res = $con->prepare( 'localeStmt', 'SELECT "'.$lang.'","'.\SYSTEM\DBD\locale_string::FIELD_ID.'" FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\locale_string::NAME_PG : \SYSTEM\DBD\locale_string::NAME_MYS).' WHERE '.\SYSTEM\DBD\locale_string::FIELD_CATEGORY.' = $1;',
$con = new \SYSTEM\DB\Connection( \SYSTEM\system::getSystemDBInfo());
$res = $con->prepare( 'localeStmt', 'SELECT `'.$lang.'`,`'.\SYSTEM\DBD\locale_string::FIELD_ID.'` FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\locale_string::NAME_PG : \SYSTEM\DBD\locale_string::NAME_MYS).' WHERE '.\SYSTEM\DBD\locale_string::FIELD_CATEGORY.' = '.(\SYSTEM\system::isSystemDbInfoPG() ? '$1' : '?').';',
array($cat));
$result = array();