cvs: php4 /pear/DB common.php

From: Date: Wed, 28 Nov 2001 14:17:57 +0000
Subject: cvs: php4 /pear/DB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1423@lists.php.net to get a copy of this message
cox Wed Nov 28 09:17:57 2001 EDT Modified files: /php4/pear/DB common.php Log: query() now accepts statement/params that acts like prepare-execute, use this instead of executeQuery() Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.71 php4/pear/DB/common.php:1.72 --- php4/pear/DB/common.php:1.71 Fri Nov 23 07:52:11 2001 +++ php4/pear/DB/common.php Wed Nov 28 09:17:54 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: common.php,v 1.71 2001/11/23 12:52:11 cox Exp $ +// $Id: common.php,v 1.72 2001/11/28 14:17:54 cox Exp $ // // Base class for DB implementations. // @@ -435,20 +435,6 @@ } // }}} - // {{{ executeQuery() - - /** - * Prepares and Execute a statement - * @param string $query The query to treat - * @param array $data The data to be added to the query - */ - function executeQuery($query, $data = false) - { - $stmt = $this->prepare($query); - return $this->execute($stmt, $data); - } - - // }}} // {{{ modifyQuery() /** @@ -483,19 +469,29 @@ * * @access public * - * @param the SQL query - * - * @return object a DB_result object or DB_OK on success, a DB - * error on failure + * @param string $query the SQL query or the statement to prepare + * @param string $params the data to be added to the query + * @return mixed a DB_result object or DB_OK on success, a DB + * error on failure * * @see DB::isError + * @see DB_common::prepare + * @see DB_common::execute */ - function &query($query) { - $result = $this->simpleQuery($query); - if (DB::isError($result) || $result === DB_OK) { - return $result; + function &query($query, $params = array()) { + if (sizeof($params) > 0) { + $sth = $this->prepare($query); + if (DB::isError($sth)) { + return $sth; + } + return $this->execute($sth, $params); } else { - return new DB_result($this, $result); + $result = $this->simpleQuery($query); + if (DB::isError($result) || $result === DB_OK) { + return $result; + } else { + return new DB_result($this, $result); + } } }

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