forked from extern/egroupware
an other PostgreSQL compatibility problem: cast to varchar necessary
This commit is contained in:
parent
1e82a48e37
commit
e30a515824
@ -1251,7 +1251,7 @@ class egw_db
|
||||
case 'mssql':
|
||||
return "DATEDIFF(second,'1970-01-01',($expr))";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1313,6 +1313,38 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast a column or sql expression to varchar, necessary at least for postgreSQL
|
||||
*
|
||||
* @param string $expr
|
||||
* @return string
|
||||
*/
|
||||
function to_varchar($expr)
|
||||
{
|
||||
switch($this->Type)
|
||||
{
|
||||
case 'pgsql':
|
||||
return 'CAST('.$expr.' AS varchar)';
|
||||
}
|
||||
return $expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correctly Quote Identifiers like table- or colmnnames for use in SQL-statements
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user