[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [21013] Improvement: Use fetchmode assoc when possibl
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] [21013] Improvement: Use fetchmode assoc when possible 4686:4711 |
Date: |
Sun, 07 Feb 2010 10:11:39 +0000 |
Revision: 21013
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21013
Author: sigurdne
Date: 2010-02-07 10:11:39 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
Improvement: Use fetchmode assoc when possible 4686:4711
Modified Paths:
--------------
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.categories.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.interserver.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.setup_translation.inc.php
people/sigurdne/modules/phpgwapi/trunk/inc/class.translation.inc.php
people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php
Modified:
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php
===================================================================
---
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -287,7 +287,7 @@
static $by_id;
static $by_lid;
- $sql = 'SELECT count(account_id) FROM phpgw_accounts
WHERE ';
+ $sql = 'SELECT count(account_id) as cnt FROM
phpgw_accounts WHERE ';
if ( is_int($account_lid) )
{
if(@isset($by_id[$account_lid]) &&
$by_id[$account_lid] != '')
@@ -307,7 +307,7 @@
$this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
- $ret_val = $this->db->f(0) > 0;
+ $ret_val = $this->db->f('cnt') > 0;
if(is_int($account_lid))
{
$by_id[$account_lid] = $ret_val;
@@ -532,9 +532,9 @@
$accounts[$id]->init($record);
}
- $this->db->query("SELECT count(account_id) FROM
phpgw_accounts $whereclause");
+ $this->db->query("SELECT count(account_id) as cnt FROM
phpgw_accounts $whereclause");
$this->db->next_record();
- $this->total = $this->db->f(0);
+ $this->total = $this->db->f('cnt');
return $accounts;
}
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.categories.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.categories.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.categories.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -236,7 +236,7 @@
{
$cats[] = array
(
- "$column" => $this->db->f(0)
+ "$column" =>
$this->db->f($column)
);
}
else
@@ -914,11 +914,11 @@
$cat_exists = " cat_name='" .
$this->db->db_addslashes($cat_name) . "' AND cat_id != $cat_id ";
}
- $this->db->query("SELECT COUNT(cat_id) FROM
phpgw_categories WHERE $cat_exists $filter",__LINE__,__FILE__);
+ $this->db->query("SELECT COUNT(cat_id) as cnt FROM
phpgw_categories WHERE $cat_exists $filter",__LINE__,__FILE__);
$this->db->next_record();
- if ($this->db->f(0))
+ if ($this->db->f('cnt'))
{
return True;
}
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php 2010-02-02
13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.db.inc.php 2010-02-07
10:11:39 UTC (rev 21013)
@@ -100,7 +100,7 @@
var $resultSet;
- var $fetchmode = 'BOTH';
+ var $fetchmode = 'ASSOC';//'BOTH';
var $Transaction = false;
/**
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.db_adodb.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -116,7 +116,10 @@
$type = 'mysqlt';
}
$this->adodb = newADOConnection($this->Type);
- $this->adodb->SetFetchMode(ADODB_FETCH_BOTH);
+ if( $this->fetchmode != 'ASSOC')
+ {
+ $this->adodb->SetFetchMode(ADODB_FETCH_BOTH);
+ }
if(isset($GLOBALS['phpgw_info']['server']['db_persistent']) &&
$GLOBALS['phpgw_info']['server']['db_persistent'])
{
return @$this->adodb->PConnect($this->Host,
$this->User, $this->Password, $this->Database);
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.db_pdo.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -531,6 +531,8 @@
$ret =
$this->db->lastInsertId($sequence);
break;
case 'mssql':
+ //FIXME
+ $this->fetchmode = 'BOTH';
$this->query("SELECT @@identity",
__LINE__, __FILE__);
$this->next_record();
$ret = $this->f(0);
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.interserver.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.interserver.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.interserver.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -354,7 +354,7 @@
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record())
{
- $server_info['server_id'] = $this->db->f(0);
+ $server_info['server_id'] =
$this->db->f('server_id');
$this->serverid = $server_info['server_id'];
$this->server = $server_info;
return $this->serverid;
@@ -470,7 +470,7 @@
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record())
{
- $serverid = $this->db->f(0);
+ $serverid = $this->db->f('server_id');
return $serverid;
}
}
@@ -489,7 +489,7 @@
$this->db->query($sql,__LINE__,__FILE__);
if($this->db->next_record())
{
- $server_name = $this->db->f(0);
+ $server_name =
$this->db->f('server_name');
return $server_name;
}
}
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.setup.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -66,6 +66,7 @@
$GLOBALS['phpgw_info']['server']['db_user'] =
$GLOBALS['phpgw_domain'][$ConfigDomain]['db_user'];
$GLOBALS['phpgw_info']['server']['db_pass'] =
$GLOBALS['phpgw_domain'][$ConfigDomain]['db_pass'];
$this->db = createObject('phpgwapi.db');
+ $this->db->fetchmode= 'BOTH';
$GLOBALS['phpgw']->db =& $this->db;
$GLOBALS['ConfigDomain'] = $ConfigDomain;
@@ -407,9 +408,9 @@
// _debug_array($setup_info[$appname]);
}
- $this->db->query("SELECT COUNT(app_name) FROM
phpgw_applications WHERE app_name='".$appname."'",__LINE__,__FILE__);
+ $this->db->query("SELECT COUNT(app_name) as cnt FROM
phpgw_applications WHERE app_name='".$appname."'",__LINE__,__FILE__);
$this->db->next_record();
- if($this->db->f(0))
+ if($this->db->f('cnt'))
{
if(@$GLOBALS['DEBUG'])
{
@@ -454,9 +455,9 @@
// _debug_array($setup_info[$appname]);
}
- $this->db->query("SELECT COUNT(app_name) FROM $appstbl
WHERE app_name='".$appname."'",__LINE__,__FILE__);
+ $this->db->query("SELECT COUNT(app_name) as cnt FROM
$appstbl WHERE app_name='".$appname."'",__LINE__,__FILE__);
$this->db->next_record();
- if(!$this->db->f(0))
+ if(!$this->db->f('cnt'))
{
return False;
}
Modified:
people/sigurdne/modules/phpgwapi/trunk/inc/class.setup_translation.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.setup_translation.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.setup_translation.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -109,9 +109,9 @@
{
if($DEBUG)
{
- echo '<br>get_langs(): found ' .
$GLOBALS['phpgw_setup']->db->f(0);
+ echo '<br>get_langs(): found ' .
$GLOBALS['phpgw_setup']->db->f('lang');
}
- $langs[] = $GLOBALS['phpgw_setup']->db->f(0);
+ $langs[] =
$GLOBALS['phpgw_setup']->db->f('lang');
}
return $langs;
}
@@ -127,9 +127,9 @@
{
echo '<br>drop_langs(): Working on: ' .
$appname;
}
- $GLOBALS['phpgw_setup']->db->query("SELECT
COUNT(message_id) FROM phpgw_lang WHERE app_name='$appname'",__LINE__,__FILE__);
+ $GLOBALS['phpgw_setup']->db->query("SELECT
COUNT(message_id) as cnt FROM phpgw_lang WHERE
app_name='$appname'",__LINE__,__FILE__);
$GLOBALS['phpgw_setup']->db->next_record();
- if($GLOBALS['phpgw_setup']->db->f(0))
+ if($GLOBALS['phpgw_setup']->db->f('cnt'))
{
if(function_exists('sem_get'))
{
@@ -197,9 +197,9 @@
$app_name =
$GLOBALS['phpgw_setup']->db->db_addslashes($line['app_name']);
$content =
$GLOBALS['phpgw_setup']->db->db_addslashes($line['content']);
-
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE
message_id='$message_id' and lang='{$lang}' ", __LINE__, __FILE__);
+
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) as cnt FROM phpgw_lang
WHERE message_id='$message_id' and lang='{$lang}' ", __LINE__, __FILE__);
$GLOBALS['phpgw_setup']->db->next_record();
- if
($GLOBALS['phpgw_setup']->db->f(0) == 0)
+ if
($GLOBALS['phpgw_setup']->db->f('cnt') == 0)
{
if($message_id &&
$content)
{
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.translation.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.translation.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.translation.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -351,10 +351,10 @@
if ($upgrademethod == 'addonlynew')
{
-
$GLOBALS['phpgw']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE
lang='".$lang."'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->db->query("SELECT COUNT(*) as cnt FROM phpgw_lang WHERE
lang='".$lang."'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
- if ($GLOBALS['phpgw']->db->f(0)
!= 0)
+ if
($GLOBALS['phpgw']->db->f('cnt') != 0)
{
$error .= "Lang code
'{$lang}' already installed: skipping<br>\n";
continue;
@@ -423,10 +423,10 @@
if ($upgrademethod ==
'addmissing')
{
//echo '<br
/>Test: addmissing';
-
$GLOBALS['phpgw']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE
message_id='$message_id' AND lang='$lang' AND
app_name='$app_name'",__LINE__,__FILE__);
+
$GLOBALS['phpgw']->db->query("SELECT COUNT(*) as cnt FROM phpgw_lang WHERE
message_id='$message_id' AND lang='$lang' AND
app_name='$app_name'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
- if (
$GLOBALS['phpgw']->db->f(0) != 0)
+ if (
$GLOBALS['phpgw']->db->f('cnt') != 0)
{
continue;
}
Modified: people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php
2010-02-02 13:36:15 UTC (rev 21012)
+++ people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php
2010-02-07 10:11:39 UTC (rev 21013)
@@ -1036,7 +1036,7 @@
/* Check if addressmaster exist */
$GLOBALS['phpgw_setup']->db->query("SELECT config_name,
config_value FROM phpgw_config WHERE config_name = 'addressmaster'");
$GLOBALS['phpgw_setup']->db->next_record();
- if($GLOBALS['phpgw_setup']->db->f(0))
+ if($GLOBALS['phpgw_setup']->db->f('config_name'))
{
$addressmaster_id =
$GLOBALS['phpgw_setup']->db->f('config_value');
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [21013] Improvement: Use fetchmode assoc when possible 4686:4711,
Sigurd Nes <=