[Vtigercrm-commits] [vtiger-commits] r9160 - /vtigercrm/trunk/modules/Leads/ListView.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Aug 28 15:12:16 EDT 2006
Author: richie
Date: Mon Aug 28 13:12:09 2006
New Revision: 9160
Log:
Support for PostGres DB done
Modified:
vtigercrm/trunk/modules/Leads/ListView.php
Modified: vtigercrm/trunk/modules/Leads/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Leads/ListView.php (original)
+++ vtigercrm/trunk/modules/Leads/ListView.php Mon Aug 28 13:12:09 2006
@@ -27,6 +27,9 @@
require_once('include/ComboUtil.php');
require_once('include/utils/utils.php');
require_once('modules/CustomView/CustomView.php');
+require_once('include/database/Postgres8.php');
+require_once('include/DatabaseUtil.php');
+
global $app_strings;
global $list_max_entries_per_page;
@@ -167,12 +170,15 @@
{
$tablename = getTableNameForField('Leads',$order_by);
$tablename = (($tablename != '')?($tablename."."):'');
-
+ if( $adb->dbType == "pgsql")
+ $query .= ' GROUP BY '.$tablename.$order_by;
+
+
$query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
}
//Retreiving the no of rows
-$count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
+$count_result = $adb->query( mkCountQuery( $query));
$noofrows = $adb->query_result($count_result,0,"count");
//Storing Listview session object
@@ -185,6 +191,11 @@
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+
+//Postgres 8 fixes
+if( $adb->dbType == "pgsql")
+ $query = fixPostgresQuery( $query, $log, 0);
+
//limiting the query
if ($start_rec ==0)
@@ -192,7 +203,10 @@
else
$limit_start_rec = $start_rec -1;
-$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
+ if( $adb->dbType == "pgsql")
+ $list_result = $adb->query($query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
+ else
+ $list_result = $adb->query($query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
//mass merge for word templates -- *Raj*17/11
@@ -231,7 +245,10 @@
else
$limit_start_rec = $start_rec -1;
-$list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
+ if( $adb->dbType == "pgsql")
+ $list_result = $adb->query($query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
+ else
+ $list_result = $adb->query($query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
$record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
More information about the vtigercrm-commits
mailing list