Hello,
I recently installed Project’Or RIA on debian Squeeze with nginx Web server under postgreSQL 8.4 database. I found some problems in jsonQuery.php because concat function is not declared in this Postgres version.
The concat SQL function is defined for PostgreSQL version >= 9.1.
I patch this file but I don’t know if it is still compatible with MySQL. I don’t know either if you plan to be compatible with this version of Postgres but it can be usefull for other people.
--- a/tool/jsonQuery.php 2012-11-25 21:42:02.000000000 +0100
+++ b/tool/jsonQuery.php 2012-11-26 16:23:46.000000000 +0100
@@ -238,19 +238,19 @@
$externalTable = $externalObj->getDatabaseTableName();
$externalTableAlias = 'T' . $idTab;
if (Sql::isPgsql()) {
- $querySelect .= 'concat(';
+ $querySelect .= '';
} else {
$querySelect .= 'convert(concat(';
}
if (property_exists($externalObj,'sortOrder')) {
$querySelect .= $externalTableAlias . '.' . $externalObj->getDatabaseColumnName('sortOrder');
- $querySelect .= ",'#split#',";
+ $querySelect .= "|| '#split#' ||";
}
$querySelect .= $externalTableAlias . '.' . $externalObj->getDatabaseColumnName('name');
- $querySelect .= ",'#split#',";
+ $querySelect .= "|| '#split#' || ";
$querySelect .= $externalTableAlias . '.' . $externalObj->getDatabaseColumnName('color');
if (Sql::isPgsql()) {
- $querySelect .= ') as "' . $fld .'"';
+ $querySelect .= ' as "' . $fld .'"';
} else {
$querySelect .= ') using utf8) as ' . $fld;
}
Thanks for pointing out this issue and proposing solution.
Unfortunately ||is not MySql compliant.
I'll look for a workaround dealing with db type to be both compatible.
Is it possible to use if (Sql::isPgsql()) test and a $concatOperator variable set with the right value, '||' for postgres request and ',' for others?
I’am not familiar with php, so it’s just a suggestion!