[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10498] api: tweak pdo-fech method
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10498] api: tweak pdo-fech method |
Date: |
Fri, 09 Nov 2012 13:09:04 +0000 |
Revision: 10498
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10498
Author: sigurdne
Date: 2012-11-09 13:09:04 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
api: tweak pdo-fech method
Modified Paths:
--------------
trunk/phpgwapi/inc/class.db.inc.php
trunk/phpgwapi/inc/class.db_adodb.inc.php
trunk/phpgwapi/inc/class.db_pdo.inc.php
Modified: trunk/phpgwapi/inc/class.db.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db.inc.php 2012-11-09 10:33:26 UTC (rev 10497)
+++ trunk/phpgwapi/inc/class.db.inc.php 2012-11-09 13:09:04 UTC (rev 10498)
@@ -198,6 +198,7 @@
return true;
}
+
/**
* Open a connection to a database
*
@@ -209,7 +210,15 @@
*/
abstract public function connect($Database = null, $Host =
null, $User = null, $Password = null, $Port = null);
+ /**
+ * set_fetch_single:fetch single record from pdo-object, no
inpact on adodb
+ *
+ * @param bool $value true/false
+ */
+ abstract public function set_fetch_single($value = false);
+
+
/**
* Close a connection to a database - only needed for persistent
connections
*/
Modified: trunk/phpgwapi/inc/class.db_adodb.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_adodb.inc.php 2012-11-09 10:33:26 UTC (rev
10497)
+++ trunk/phpgwapi/inc/class.db_adodb.inc.php 2012-11-09 13:09:04 UTC (rev
10498)
@@ -41,7 +41,18 @@
parent::__construct($query, $db_type, $delay_connect);
}
+
/**
+ * set_fetch_single:fetch single record from pdo-object, no
inpact on adodb
+ *
+ * @param bool $value true/false
+ */
+ public function set_fetch_single($value = false)
+ {
+ $this->fetch_single = $value;
+ }
+
+ /**
* Called when object is cloned
*/
public function __clone()
Modified: trunk/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.db_pdo.inc.php 2012-11-09 10:33:26 UTC (rev
10497)
+++ trunk/phpgwapi/inc/class.db_pdo.inc.php 2012-11-09 13:09:04 UTC (rev
10498)
@@ -48,7 +48,18 @@
}
+
/**
+ * set_fetch_single:fetch single record from pdo-object
+ *
+ * @param bool $value true/false
+ */
+ public function set_fetch_single($value = false)
+ {
+ $this->fetch_single = $value;
+ }
+
+ /**
* Destructor
*/
public function __destruct()
@@ -337,11 +348,11 @@
* @param bool $fetch_single true for using fetch, false for
fetchAll
* @return integer current query id if sucesful and null if fails
*/
- public function query($sql, $line = '', $file = '', $exec =
false, $fetch_single = false)
+ public function query($sql, $line = '', $file = '', $exec =
false, $_fetch_single = false)
{
//_Debug_Array($sql);
$this->_get_fetchmode();
- $this->fetch_single = $fetch_single;
+ $fetch_single = $_fetch_single ? $_fetch_single :
$this->fetch_single;
if ( !$this->db )
{
@@ -374,16 +385,16 @@
$this->fetch_single =
$fetch_single;
}
*/
- if(!$fetch_single)
+ if($fetch_single)
{
- $this->resultSet =
$statement_object->fetchAll($this->pdo_fetchmode);
- }
- else
- {
$this->resultSet =
$statement_object->fetch($this->pdo_fetchmode);
$this->statement_object =
$statement_object;
unset($statement_object);
}
+ else
+ {
+ $this->resultSet =
$statement_object->fetchAll($this->pdo_fetchmode);
+ }
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10498] api: tweak pdo-fech method,
Sigurd Nes <=