[dev] patch for Group.php

Paul Cooper pgc@ucecom.com
Thu, 6 Dec 2001 18:56:58 -0500


---------------------- multipart/mixed attachment
On Thu, Dec 06, 2001 at 11:51:31PM +0000, Paul Cooper wrote:
> I put together a test script to play with a group object and found an 
> error in the Category/sql.php - see attaced patch - the word 'as' was 
> missing twice in the sql statement.

Doh, with more testing I found some more missing as's - see the new patch 
attached,

Paul

-- 
-----------------------------------------------------------------
Paul Cooper                             |  Tel: 0121 331 7858
Senior Programmer and Database Engineer |  Fax: 0121 331 7859
UCEcom                                  |  mailto:pgc@ucecom.com
University of Central England           |  http://www.ucecom.com
Birmingham, B4 7DX                      |
-----------------------------------------------------------------

---------------------- multipart/mixed attachment
Index: sql.php
===================================================================
RCS file: /repository/horde/lib/Category/sql.php,v
retrieving revision 1.10
diff -u -r1.10 sql.php
--- sql.php	15 Nov 2001 16:58:14 -0000	1.10
+++ sql.php	6 Dec 2001 18:49:36 -0000
@@ -138,7 +138,7 @@
      */
     function fullyload()
     {
-        $query = sprintf('SELECT t.category_name name, t2.category_name category_id_parent FROM %s t, %s t2, %s cp' .
+        $query = sprintf('SELECT t.category_name as name, t2.category_name as category_id_parent FROM %s t, %s t2, %s cp' .
                          ' WHERE t.group_uid=%s AND cp.category_id_parent=t2.category_id AND cp.category_id_child=t.category_id' .
                          ' AND t2.group_uid=%s ',
                          $this->params['table'], $this->params['table'], $this->params['tableRelations'],
@@ -151,7 +151,7 @@
             return $result;
         }
         
-        $query = sprintf('SELECT t.category_name name, \'-1\' parent FROM %s t, %s cp' .
+        $query = sprintf('SELECT t.category_name as name, \'-1\' as parent FROM %s t, %s cp' .
                          ' WHERE t.group_uid=%s AND t.category_id=cp.category_id_child AND cp.category_id_parent=\'-1\'',
                          $this->params['table'], $this->params['tableRelations'], $this->db->quote($this->params['group']));
         
@@ -202,7 +202,7 @@
         if ('-1' == $parent) {
             $parentid = '-1';
         } else {
-            $query = sprintf('SELECT t.category_id id FROM %s t WHERE t.category_name=%s',
+            $query = sprintf('SELECT t.category_id as id FROM %s t WHERE t.category_name=%s',
                              $this->params['table'], $this->db->quote($parent));
             $parentid = $this->db->getCol($query);
             if (DB::isError($parentid)) {
@@ -316,7 +316,7 @@
         if ('-1' == $new_parent) {
             $parentid = '-1';
         } else {
-            $query = sprintf('SELECT t.category_id id FROM %s t WHERE t.category_name=%s AND t.group_uid=%s',
+            $query = sprintf('SELECT t.category_id as id FROM %s t WHERE t.category_name=%s AND t.group_uid=%s',
                              $this->params['table'], $this->db->quote($new_parent),
                              $this->db->quote($this->params['group']));
             $parentid = $this->db->getCol($query);
@@ -330,7 +330,7 @@
             }
         }
 
-        $query = sprintf('SELECT cp.category_id_child child, cp.category_id_parent parent FROM %s cp, %s t, %s told' .
+        $query = sprintf('SELECT cp.category_id_child as child, cp.category_id_parent as parent FROM %s cp, %s t, %s told' .
                          ' WHERE t.group_uid=%s AND t.category_name=%s AND t.category_serialized=%s' . 
                          ' AND t.category_id=cp.category_id_child AND cp.category_id_parent=told.category_id' . 
                          ' AND t.group_uid=told.group_uid AND told.category_name=%s',

---------------------- multipart/mixed attachment--