View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - concat function doesn’t exist in PostgreSQL under 9.1 - ProjeQtOr
 
 

concat function doesn’t exist in PostgreSQL under 9.1

More
27 Nov 2012 14:53 - 27 Nov 2012 14:54 #1 by stephane.clerambault
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;
                  }
Last edit: 27 Nov 2012 14:54 by stephane.clerambault. Reason: change code bb balise to i

Please Log in or Create an account to join the conversation.

More
27 Nov 2012 15:16 #2 by babynus
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.

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
27 Nov 2012 16:38 #3 by stephane.clerambault
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!

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.036 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.