mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
fix for postgreSQL bug reported by Anthony Messina (amessina-at-messinet.com): sync_contentid is varchar(60) and need explicit cast: added egw_db->to_int($expr)
This commit is contained in:
parent
ce35264ed9
commit
7f29cd8530
@ -2145,7 +2145,7 @@ function calendar_upgrade1_9_001()
|
||||
),array(
|
||||
'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN '.
|
||||
'(SELECT '.$GLOBALS['egw_setup']->db->unix_timestamp('sync_deleted').
|
||||
" FROM egw_api_content_history WHERE sync_appname='calendar' AND sync_contentid=cal_id)".
|
||||
" FROM egw_api_content_history WHERE sync_appname='calendar' AND ".$GLOBALS['egw_setup']->db->to_int('sync_contentid').'=cal_id)'.
|
||||
' ELSE NULL END',
|
||||
));
|
||||
|
||||
|
@ -1313,6 +1313,22 @@ class egw_db
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a column or sql expression to integer, necessary at least for postgreSQL
|
||||
*
|
||||
* @param string $expr
|
||||
* @return string
|
||||
*/
|
||||
function to_int($expr)
|
||||
{
|
||||
switch($this->Type)
|
||||
{
|
||||
case 'pgsql':
|
||||
return $expr.'::integer';
|
||||
}
|
||||
return $expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correctly Quote Identifiers like table- or colmnnames for use in SQL-statements
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user