[Vtigercrm-commits] [vtiger-commits] r5361 - /vtigercrm/branches/4.2/include/utils.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 25 14:44:32 EDT 2006
Author: allanbush
Date: Tue Apr 25 12:44:28 2006
New Revision: 5361
Log:
Fetch all the tab ids in one query and cache the results for subsequent requests. Refs #744.
Modified:
vtigercrm/branches/4.2/include/utils.php
Modified: vtigercrm/branches/4.2/include/utils.php
==============================================================================
--- vtigercrm/branches/4.2/include/utils.php (original)
+++ vtigercrm/branches/4.2/include/utils.php Tue Apr 25 12:44:28 2006
@@ -866,15 +866,21 @@
function getTabid($module)
{
- global $vtlog;
+ global $adb, $vtlog;
+ static $res = null;
$vtlog->logthis("module is ".$module,'info');
- global $adb;
- $sql = "select tabid from tab where name='".$module."'";
+ if(!is_null($res)) return $res[$module];
+
+ $sql = "select tabid, name from tab";
$result = $adb->query($sql);
- $tabid= $adb->query_result($result,0,"tabid");
- return $tabid;
-
+ $tab_count = $adb->num_rows($result);
+ for($i=0; $i<$tab_count; $i++) {
+ $tabid = $adb->query_result($result,$i,"tabid");
+ $tabname = $adb->query_result($result, $i, "name");
+ $res[$tabname] = $tabid;
+ }
+ return $res[$module];
}
function getOutputHtml($uitype, $fieldname, $fieldlabel, $maxlength, $col_fields,$generatedtype)
More information about the vtigercrm-commits
mailing list