phpgroupware-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-tracker] [bug #5599] error when using concat function


From: nobody
Subject: [Phpgroupware-tracker] [bug #5599] error when using concat function
Date: Tue, 30 Sep 2003 09:57:39 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030908 Epiphany/1.0

=================== BUG #5599: LATEST MODIFICATIONS ==================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5599&group_id=509

Changes by: Edgar Luna <address@hidden>
Date: Tue 09/30/2003 at 07:57 (America/Mexico_City)

------------------ Additional Follow-up Comments ----------------------------
This has been corrected in CVS.



To grab a complete update of all fixes:



1)  Check to see if you have cvs installed: 'cvs --help'.

1a) If not, install a copy of cvs-cli from your favorite 

distro.



2)  Then just type:

    'cd <your phpgroupware dir>; cvs update -dP'.



You can do step 2 as many times in a day as you wish, and 

will always get the most current bug fixes.



Thanks,





=================== BUG #5599: FULL BUG SNAPSHOT ===================


Submitted by: jecinc                  Project: phpGroupWare                 
Submitted on: Sat 09/27/2003 at 20:12
Category:  API - phpGWapi             Bug Group:  0.9.16RC1                 
Severity:  5 - Major                  Priority:  None                       
Resolution:  Fixed                    Assigned to:  eald                    
Status:  Closed                       Component Version:  None              
Platform Version:  None               Reproducibility:  None                

Summary:  error when using concat function

Original Submission:  Just starting to test this out



Using this code:

include_once(PHPGW_API_INC . '/class.sql.inc.php');

$my_concatenated_field = sql::concat_null( array('org_name', 'first_name', 
'last_name') );



results in an error:

Warning: Invalid argument supplied for foreach() in 
/home/htdocs/phpgroupware/phpgwapi/inc/class.sql.inc.php on line 422



Follow-up Comments
*******************

-------------------------------------------------------
Date: Tue 09/30/2003 at 07:57       By: eald
This has been corrected in CVS.



To grab a complete update of all fixes:



1)  Check to see if you have cvs installed: 'cvs --help'.

1a) If not, install a copy of cvs-cli from your favorite 

distro.



2)  Then just type:

    'cd <your phpgroupware dir>; cvs update -dP'.



You can do step 2 as many times in a day as you wish, and 

will always get the most current bug fixes.



Thanks,



-------------------------------------------------------
Date: Mon 09/29/2003 at 19:07       By: eald
This has been corrected in CVS.



To grab a complete update of all fixes:



1)  Check to see if you have cvs installed: 'cvs --help'.

1a) If not, install a copy of cvs-cli from your favorite 

distro.



2)  Then just type:

    'cd <your phpgroupware dir>; cvs update -dP'.



You can do step 2 as many times in a day as you wish, and 

will always get the most current bug fixes.



Thanks,



-------------------------------------------------------
Date: Mon 09/29/2003 at 19:05       By: eald
This has been corrected in CVS.



To grab a complete update of all fixes:



1)  Check to see if you have cvs installed: 'cvs --help'.

1a) If not, install a copy of cvs-cli from your favorite 

distro.



2)  Then just type:

    'cd <your phpgroupware dir>; cvs update -dP'.



You can do step 2 as many times in a day as you wish, and 

will always get the most current bug fixes.



Thanks,



-------------------------------------------------------
Date: Mon 09/29/2003 at 19:05       By: eald
This has been corrected in CVS.



To grab a complete update of all fixes:



1)  Check to see if you have cvs installed: 'cvs --help'.

1a) If not, install a copy of cvs-cli from your favorite 

distro.



2)  Then just type:

    'cd <your phpgroupware dir>; cvs update -dP'.



You can do step 2 as many times in a day as you wish, and 

will always get the most current bug fixes.



Thanks,



-------------------------------------------------------
Date: Sun 09/28/2003 at 19:51       By: eald
mmm, I only changed on concat_null function, and seems work here; not necesary 
add the increment in $return_value[] array.



Any comment?

-------------------------------------------------------
Date: Sun 09/28/2003 at 19:46       By: jecinc
I rewrote them (this is the pgsql version, the other dbs should be rewritten 
too):

function concat_null($elements)

                {

                        $elements = sql::safe_null($elements);

                        $str = implode(' || ', $elements);

                        return ($str) ? '(' . $str . ')' : '';

                }







function safe_null($value)

                {

                        if(empty($value))

                        {

                                return ;

                        }

                        $value = is_array($value) ? $value : array($value);

                        $i=0;

                        foreach($value as $data)

                        {

                                $return_value[$i] = '(CASE '.$data.' WHEN NULL 
THEN '' ELSE '.$data.')';

                                $i++;

                        }

                        return $return_value;

                }





When time permits, this should be edited to change elements to a two 
dimensional array (key => value) so that constants can be included in the 
concat and can skip the CASE statement.



I think constants will work with current code, it it just overly complex.


CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=5599&group_id=509

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]