[whups] sql query

Mathieu Arnold arn_mat@club-internet.fr
Thu, 07 Mar 2002 08:49:18 +0100


--On jeudi 7 mars 2002 01:53 -0500 Chuck Hagenbuch <chuck@horde.org> wrote:

>> > I've been mucking out with the whole horde framework tonight, and, hum
>> > the sql queries are quite really mysql compliant, but not sql
>> > compliant.
>
> I test everything against MS-SQL as well. Unfortunately not perfect, but
> usually a pretty good litmus test.
>
> I seem to have missed your original message - what patch?

there is no + between texts fields in sql. if you need to concat them, you 
need to use ||

Index: lib/Driver/sql.php
===================================================================
RCS file: /home/cvs/cvs/dup/horde/whups/lib/Driver/sql.php,v
retrieving revision 1.33
diff -u -r1.33 sql.php
--- lib/Driver/sql.php  6 Mar 2002 04:57:57 -0000       1.33
+++ lib/Driver/sql.php  6 Mar 2002 23:56:50 -0000
@@ -425,7 +425,7 @@
                 'whups_modules.module_name AS _module_name, ' .
                 'whups_priorities.priority_name AS _priority_name, ' .
                 'whups_versions.version_name AS _version_name, ' .
-                'whups_versions.version_name + \': \' +
whups_versions.version_description AS _version_fullname';
+                'whups_versions.version_name || \': \' ||
whups_versions.version_description AS _version_fullname';

             $join  = 'INNER JOIN whups_types ON whups_tickets.type_id =
whups_types.type_id';
             $join .= ' INNER JOIN whups_states ON whups_tickets.state_id =
whups_states.state_id';
@@ -769,7 +769,7 @@
         if (empty($module)) {
             return array();
         }
-        return $this->_getAssoc("SELECT version_id, version_name + ': ' +
version_description FROM whups_versions WHERE module_id = $module");
+        return $this->_getAssoc("SELECT version_id, version_name || ': '
|| version_description FROM whups_versions WHERE module_id = $module");
     }

     function getVersion($versionID)

-- 
Mathieu Arnold


>From chuck@horde.org Date: Thu,  7 Mar 2002 14:40:15 -0500
Return-Path: <chuck@horde.org>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 25744 invoked from network); 7 Mar 2002 19:40:54 -0000
Received: from h00104bc60b3c.ne.mediaone.net (HELO marina.horde.org) (24.91.196.127)
  by clark.horde.org with SMTP; 7 Mar 2002 19:40:54 -0000
Received: by marina.horde.org (Postfix, from userid 33)
	id 09D83397D; Thu,  7 Mar 2002 14:40:16 -0500 (EST)
Received: from 192.168.0.117 ( [192.168.0.117])
	as user chuck@localhost by marina.horde.org with HTTP;
	Thu,  7 Mar 2002 14:40:15 -0500
Message-ID: <1015530015.3c87c21fd39cf@marina.horde.org>
Date: Thu,  7 Mar 2002 14:40:15 -0500
From: Chuck Hagenbuch <chuck@horde.org>
To: whups@lists.horde.org
References: <1015484013.3c870e6dd4f40@marina.horde.org> <2066702781.1015490958@sauron>
In-Reply-To: <2066702781.1015490958@sauron>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 4.0-cvs
Subject: Re: [whups] sql query

Quoting Mathieu Arnold <arn_mat@club-internet.fr>:

> there is no + between texts fields in sql. if you need to concat them, you 
> need to use ||

... though that doesn't work in all databases, either. I've moved that 
particular logic to PHP code.

Do the joins work in Postgres?

-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"A dream which helps you to live your reality with dignity
 and justice is a good dream." - Tariq Ramadan