[Vtigercrm-commits] [vtiger-commits] r9162 - /vtigercrm/trunk/modules/Campaigns/ListView.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Aug 28 15:13:50 EDT 2006
Author: richie
Date: Mon Aug 28 13:13:43 2006
New Revision: 9162
Log:
Support for PostGres DB done
Modified:
vtigercrm/trunk/modules/Campaigns/ListView.php
Modified: vtigercrm/trunk/modules/Campaigns/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Campaigns/ListView.php (original)
+++ vtigercrm/trunk/modules/Campaigns/ListView.php Mon Aug 28 13:13:43 2006
@@ -18,6 +18,8 @@
require_once('themes/'.$theme.'/layout_utils.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,$mod_strings,$current_language;
$current_module_strings = return_module_language($current_language, 'Campaigns');
@@ -129,25 +131,31 @@
{
if($order_by == 'smownerid')
{
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY vtiger_users.user_name';
$list_query .= ' ORDER BY vtiger_users.user_name '.$sorder;
}
else
{
$tablename = getTableNameForField('Campaigns',$order_by);
$tablename = (($tablename != '')?($tablename."."):'');
-
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY '.$tablename.$order_by;
+
$list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
}
}
else
{
- $list_query .= ' order by vtiger_campaign.campaignid DESC';
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY vtiger_campaign.campaignid';
+ $list_query .= ' ORDER BY vtiger_campaign.campaignid DESC';
}
//Constructing the list view
//Retreiving the no of rows
-$count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
+$count_result = $adb->query( mkCountQuery( $list_query));
$noofrows = $adb->query_result($count_result,0,"count");
//Storing Listview session object
@@ -167,11 +175,22 @@
$end_rec = $navigation_array['end_val'];
//By Raju Ends
+
+ //Postgres 8 fixes
+ if( $adb->dbType == "pgsql")
+ $list_query = fixPostgresQuery( $list_query, $log, 0);
+
+
//limiting the query
if ($start_rec ==0)
$limit_start_rec = 0;
else
$limit_start_rec = $start_rec -1;
+
+ if( $adb->dbType == "pgsql")
+ $list_result = $adb->query($list_query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
+ else
+ $list_result = $adb->query($list_query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
More information about the vtigercrm-commits
mailing list