cvs: pear /MDB2/MDB2/Driver ibase.php
| From: | Lorenzo Alberton | Date: | Fri, 14 Oct 2005 21:59:53 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver ibase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35545@lists.php.net to get a copy of this message | ||
quipo Fri Oct 14 17:59:53 2005 EDT
Modified files:
/pear/MDB2/MDB2/Driver ibase.php
Log:
added custom query() and getConnection() methods to support transactions
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/ibase.php?r1=1.106&r2=1.107&ty=u
Index: pear/MDB2/MDB2/Driver/ibase.php
diff -u pear/MDB2/MDB2/Driver/ibase.php:1.106 pear/MDB2/MDB2/Driver/ibase.php:1.107
--- pear/MDB2/MDB2/Driver/ibase.php:1.106 Mon Oct 10 08:23:21 2005
+++ pear/MDB2/MDB2/Driver/ibase.php Fri Oct 14 17:59:52 2005
@@ -43,7 +43,7 @@
// | Author: Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: ibase.php,v 1.106 2005/10/10 12:23:21 quipo Exp $
+// $Id: ibase.php,v 1.107 2005/10/14 21:59:52 quipo Exp $
/**
* MDB2 FireBird/InterBase driver
@@ -208,6 +208,25 @@
}
// }}}
+ // {{{ getConnection()
+
+ /**
+ * Returns a native connection
+ *
+ * @return mixed a valid MDB2 connection object,
+ * or a MDB2 error object on error
+ * @access public
+ */
+ function &getConnection()
+ {
+ $result = $this->connect();
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+ return $this->in_transaction ? $this->transaction_id : $this->connection;
+ }
+
+ // }}}
// {{{ beginTransaction()
/**
@@ -458,6 +477,51 @@
}
// }}}
+ // {{{ query()
+
+ /**
+ * Send a query to the database and return any results
+ *
+ * @param string $query the SQL query
+ * @param mixed $types array that contains the types of the columns in
+ * the result set
+ * @param mixed $result_class string which specifies which result class to use
+ * @param mixed $result_wrap_class string which specifies which class to wrap results in
+ * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
+ * @access public
+ */
+ function &query($query, $types = null, $result_class = true, $result_wrap_class = false)
+ {
+ $isManip = MDB2::isManip($query);
+ $offset = $this->row_offset;
+ $limit = $this->row_limit;
+ $this->row_offset = $this->row_limit = 0;
+ $query = $this->_modifyQuery($query, $isManip, $limit, $offset);
+
+ $connected = $this->connect();
+ if (PEAR::isError($connected)) {
+ return $connected;
+ }
+
+ $connection = $this->in_transaction
+ ? $this->transaction_id : $this->connection;
+
+ $result = $this->_doQuery($query, $isManip, $connection, $this->database_name);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
+
+ // check for integers instead of manip since drivers may do some
+ // custom checks not covered by MDB2::isManip()
+ if (is_int($result)) {
+ return $result;
+ }
+
+ $result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class,
$limit, $offset);
+ return $result;
+ }
+
+ // }}}
// {{{ _modifyQuery()
/**