[Vtigercrm-commits] [vtiger-commits] r9169 - /vtigercrm/trunk/modules/Faq/ListView.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Aug 28 15:38:07 EDT 2006


Author: richie
Date: Mon Aug 28 13:38:00 2006
New Revision: 9169

Log:
Support for PostGres DB done

Modified:
    vtigercrm/trunk/modules/Faq/ListView.php

Modified: vtigercrm/trunk/modules/Faq/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Faq/ListView.php (original)
+++ vtigercrm/trunk/modules/Faq/ListView.php Mon Aug 28 13:38:00 2006
@@ -23,6 +23,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;
 $current_module_strings = return_module_language($current_language, 'Faq');
@@ -135,7 +137,9 @@
 {
 	$tablename = getTableNameForField('Faq',$order_by);
 	$tablename = (($tablename != '')?($tablename."."):'');
-
+	if( $adb->dbType == "pgsql")
+ 	    $list_query .= ' GROUP BY '.$tablename.$order_by;	
+	
         $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
 }
 //Constructing the list view 
@@ -149,7 +153,7 @@
 $smarty->assign("SINGLE_MOD",'Note');
 //Retreiving the no of rows
 //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");
 
 if($viewnamedesc['viewname'] == 'All')
@@ -167,6 +171,11 @@
 
 //Retreive the Navigation array
 $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+ //Postgres 8 fixes
+ if( $adb->dbType == "pgsql")
+     $list_query = fixPostgresQuery( $list_query, $log, 0);
+
+
 
 // Setting the record count string
 //modified by rdhital
@@ -180,7 +189,10 @@
 else
 	$limit_start_rec = $start_rec -1;
 	
-$list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
+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);
 
 $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
 





More information about the vtigercrm-commits mailing list