[Vtigercrm-developers] [PATCH] leads module fix (postgres)
Jens Hamisch
jens at Strawberry.COM
Fri May 11 00:36:01 PDT 2007
Hi,
my Postgres patches already introduced a stored procedure which handles
concats in Postgres. This is IMHO mor performant.
Jens
On Fri, May 11, 2007 at 03:32:07AM +0200, Enrico Weigelt wrote:
>
> Hi folks,
>
>
> the leads module (Tracker.php) suffers from an sql bug: it uses
> mysql specific sql statements for concatenating fields. This ends
> up in empty result objects and so the already mentioned error
> of trying to call Move() on non-object.
>
> This patch solves this by using the new PearDatabas::sql_concat()
> function (see prev. patch) for creating the statement.
>
> Also this patch calls the new PearDatabase::run_query_field()
> for the one-field-query.
>
>
> cu
> --
> ---------------------------------------------------------------------
> Enrico Weigelt == metux IT service
>
> phone: +49 36207 519931 www: http://www.metux.de/
> fax: +49 36207 519932 email: contact at metux.de
> cellphone: +49 174 7066481
> ---------------------------------------------------------------------
> -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
> ---------------------------------------------------------------------
> diff -ruN htdocs.orig/data/Tracker.php htdocs/data/Tracker.php
> --- htdocs.orig/data/Tracker.php 2007-05-09 00:56:24.000000000 +0200
> +++ htdocs/data/Tracker.php 2007-05-11 03:11:37.000000000 +0200
> @@ -80,18 +80,23 @@
> $entityidfield = $adb->query_result($result,0,'entityidfield');
> if(!(strpos($fieldsname,',') === false))
> {
> - $fieldlists = explode(',',$fieldsname);
> - $fieldsname = "concat(";
> - $fieldsname = $fieldsname.implode(",' ',",$fieldlists);
> - $fieldsname = $fieldsname.")";
> + // concatenate multiple fields with an whitespace between them
> + $fieldlists = explode(',',$fieldsname);
> + $fl = array();
> + foreach($fieldlists as $w => $c)
> + {
> + if (count($fl))
> + $fl[] = "' '";
> + $fl[] = $c;
> + }
> + $fieldsname = $adb->sql_concat($fl);
> }
> if($current_module =='Organization') {
> $query1 = "select $fieldsname as entityname from $tablename where $entityidfield='".$item_id."'";
> } else {
> $query1 = "select $fieldsname as entityname from $tablename where $entityidfield=" .$item_id;
> }
> - $result = $adb->query($query1);
> - $item_summary = $adb->query_result($result,0,'entityname');
> + $item_summary = $adb->run_query_field($query1);
> }
>
> ### Check database item sizes
> _______________________________________________
> Reach hundreds of potential candidates - http://jobs.vtiger.com
--
--------------------------------------------------------------------------------
s t r a w b e r r y e d v - s y s t e m e g m b h
SSSSSSSSS Am Flosskanal 7 Jens Hamisch
SSSSSSSSSSSSS D-82515 Wolfratshausen Geschaeftsfuehrer/CEO
SSSSS-----SSSSS
---SSSSS--------- fon (+49 8171) 41805-0
-----SSSSSSS----- fax (+49 8171) 41805-59
---------SSSSS--- info at strawberry.com jens.hamisch at strawberry.com
SSSSS-----SSSSS mobil: (+49 172) 8104162
SSSSSSSSSSSSS Geschaeftsfuehrer/CEO
SSSSSSSSS Jens Hamisch
a g m u e n c h e n H R B 9 3 2 8 7 - D E 1 2 9 4 6 7 5 1 8
More information about the vtigercrm-developers
mailing list