fix sql error if link-id (accidently) contains non-ascii chars

This commit is contained in:
Ralf Becker 2015-07-23 11:30:57 +00:00
parent 23d0108df0
commit d59c15582f

View File

@ -8,7 +8,7 @@
*
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright 2001-2014 by RalfBecker@outdoor-training.de
* @copyright 2001-2015 by RalfBecker@outdoor-training.de
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
* @subpackage link
@ -139,6 +139,7 @@ class solink
}
$links = array();
try {
foreach(self::$db->select(self::TABLE, '*', self::$db->expression(self::TABLE, '((', array(
'link_app1' => $app,
'link_id1' => $id,
@ -162,7 +163,12 @@ class solink
}
// if query returns exactly limit rows, we assume there are more and therefore set self::$limit_exceeded
self::$limit_exceeded = $offset !== false && count(is_array($id) ? $links : $links[$id]) == $limit;
}
// catch Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267)
// caused by non-ascii chars compared with ascii field uid
catch(egw_exception_db $e) {
_egw_log_exception($e);
}
return is_array($id) ? $links : ($links[$id] ? $links[$id] : array());
}
@ -226,15 +232,15 @@ class solink
'link_id1' => $id2,
),')');
}
foreach(self::$db->select(self::TABLE,'*',$where,__LINE__,__FILE__) as $row)
{
if (self::DEBUG)
{
_debug_array($row);
try {
return self::$db->select(self::TABLE,'*',$where,__LINE__,__FILE__)->fetch(ADODB_FETCH_ASSOC);
}
return $row;
// catch Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267)
// caused by non-ascii chars compared with ascii field uid
catch(egw_exception_db $e) {
_egw_log_exception($e);
}
return False;
return false;
}
/**