cvs: pear /MDB2/MDB2/Driver ibase.php

From: Date: Sat, 21 May 2005 23:03:02 +0000
Subject: cvs: pear /MDB2/MDB2/Driver ibase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32007@lists.php.net to get a copy of this message
lsmith Sat May 21 19:03:02 2005 EDT Modified files: /pear/MDB2/MDB2/Driver ibase.php Log: - use new quote() parameter - renamed execute() to _execute() since common provides some common functionality via execute() http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/ibase.php?r1=1.90&r2=1.91&ty=u Index: pear/MDB2/MDB2/Driver/ibase.php diff -u pear/MDB2/MDB2/Driver/ibase.php:1.90 pear/MDB2/MDB2/Driver/ibase.php:1.91 --- pear/MDB2/MDB2/Driver/ibase.php:1.90 Mon May 9 14:56:26 2005 +++ pear/MDB2/MDB2/Driver/ibase.php Sat May 21 19:03:02 2005 @@ -43,7 +43,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.90 2005/05/09 18:56:26 lsmith Exp $ +// $Id: ibase.php,v 1.91 2005/05/21 23:03:02 lsmith Exp $ /** * MDB2 FireBird/InterBase driver @@ -562,7 +562,7 @@ $statement = ibase_prepare($connection, $query); $class_name = 'MDB2_Statement_'.$this->phptype; - $obj =& new $class_name($this, $statement, $query, $types, $result_types); + $obj =& new $class_name($this, $statement, $query, $types, $result_types, $this->row_limit, $this->row_offset); return $obj; } @@ -1032,21 +1032,21 @@ class MDB2_Statement_ibase extends MDB2_Statement_Common { - // {{{ execute() + // {{{ _execute() /** - * Execute a prepared query statement. + * Execute a prepared query statement helper method. * * @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 + * @access private */ - function &execute($result_class = true, $result_wrap_class = false) + function &_execute($result_class = true, $result_wrap_class = false) { $isManip = MDB2::isManip($this->query); $this->db->last_query = $this->query; - $this->db->debug($this->query, 'query'); + $this->db->debug($this->query, 'execute'); if ($this->db->getOption('disable_query')) { return $isManip ? MDB2_OK : null; } @@ -1055,21 +1055,23 @@ if (PEAR::isError($connected)) { return $connected; } - $connection = ($this->db->in_transaction ? $this->db->transaction_id : $this->db->connection); - - $parameters = $this->quoteParamsForPreparedQuery(); + $connection = $this->db->in_transaction + ? $this->db->transaction_id : $this->db->connection; - $this->db->row_offset = $this->row_offset; - $this->db->row_limit = $this->row_limit; + $parameters = array(0 => $this->statement); + $values = array_values($this->values); + $types = array_values($this->types); + foreach ($values as $parameter => $value) { + $type = isset($types[$parameter]) ? $types[$parameter] : null; + $parameters[] = $this->db->quote($value, $type, false); + } - array_unshift($parameters, $this->statement); $result = call_user_func_array('ibase_execute', $parameters); if ($result === false) { return $this->db->raiseError(); } if ($isManip) { - //return $result; return (function_exists('ibase_affected_rows') ? ibase_affected_rows($connection) : 0); } @@ -1078,32 +1080,22 @@ } // }}} - // {{{ quoteParamsForPreparedQuery() - function quoteParamsForPreparedQuery() + // }}} + // {{{ free() + + /** + * Release resources allocated for the specified prepared query. + * + * @return mixed MDB2_OK on success, a MDB2 error on failure + * @access public + */ + function free() { - $parameters = array(); - $must_quote = array('decimal', 'boolean', 'blob', 'clob'); - foreach ($this->values as $parameter => $value) { - if (!isset($value)) { - $parameters[] = null; - } else { - $type = isset($this->types[$parameter]) ? $this->types[$parameter] : null; - if (in_array($type, $must_quote)) { - if ($type == 'boolean') { - $value = ($value ? 'Y' : 'N'); - } else { - $value = $this->db->quote($value, $type); - } - } elseif (strpos($value, '?') !== false) { - $value = "'".$this->db->escape($value)."'"; - } - $parameters[] = $value; - } + if (!@ibase_free_query($this->statement)) { + return $this->db->raiseError(); } - return $parameters; + return MDB2_OK; } - - // }}} } ?> \ No newline at end of file

« previous php.pear.cvs (#32007) next »