an other PostgreSQL compatibility problem: cast to varchar necessary

This commit is contained in:
Ralf Becker 2010-10-28 08:47:52 +00:00
parent 5cd2b962ea
commit de903d8957

View File

@ -1251,7 +1251,7 @@ class egw_db
case 'mssql':
return "DATEDIFF(second,'1970-01-01',($expr))";
}
}
/**
@ -1312,10 +1312,10 @@ class egw_db
}
return false;
}
/**
* Cast a column or sql expression to integer, necessary at least for postgreSQL
*
*
* @param string $expr
* @return string
*/
@ -1329,6 +1329,22 @@ class egw_db
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
*