cvs: pear /MDB2/MDB2/Driver/Function Common.php mssql.php pgsql.php

From: Date: Mon, 17 Oct 2005 08:28:52 +0000
Subject: cvs: pear /MDB2/MDB2/Driver/Function Common.php mssql.php pgsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35637@lists.php.net to get a copy of this message
lsmith Mon Oct 17 04:28:52 2005 EDT Modified files: /pear/MDB2/MDB2/Driver/Function Common.php mssql.php pgsql.php Log: - added executeStoredProc() http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Function/Common.php?r1=1.3&r2=1.4&ty=u Index: pear/MDB2/MDB2/Driver/Function/Common.php diff -u pear/MDB2/MDB2/Driver/Function/Common.php:1.3 pear/MDB2/MDB2/Driver/Function/Common.php:1.4 --- pear/MDB2/MDB2/Driver/Function/Common.php:1.3 Mon Oct 17 04:17:49 2005 +++ pear/MDB2/MDB2/Driver/Function/Common.php Mon Oct 17 04:28:52 2005 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.3 2005/10/17 08:17:49 lsmith Exp $ +// $Id: Common.php,v 1.4 2005/10/17 08:28:52 lsmith Exp $ // /** @@ -60,6 +60,34 @@ */ class MDB2_Driver_Function_Common extends MDB2_Module_Common { + // }}} + // {{{ executeStoredProc() + + /** + * Execute a stored procedure and return any results + * + * @param string $name string that identifies the function to execute + * @param mixed $params array that contains the paramaters to pass the stored proc + * @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 &executeStoredProc($name, $params = null, $types = null, $result_class = false, $result_wrap_class = false) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + + $db->debug($query, 'query'); + $error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'query: method not implemented'); + return $error; + } + // }}} // {{{ functionTable() http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Function/mssql.php?r1=1.2&r2=1.3&ty=u Index: pear/MDB2/MDB2/Driver/Function/mssql.php diff -u pear/MDB2/MDB2/Driver/Function/mssql.php:1.2 pear/MDB2/MDB2/Driver/Function/mssql.php:1.3 --- pear/MDB2/MDB2/Driver/Function/mssql.php:1.2 Mon Oct 17 04:17:49 2005 +++ pear/MDB2/MDB2/Driver/Function/mssql.php Mon Oct 17 04:28:52 2005 @@ -42,7 +42,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.2 2005/10/17 08:17:49 lsmith Exp $ +// $Id: mssql.php,v 1.3 2005/10/17 08:28:52 lsmith Exp $ // require_once 'MDB2/Driver/Function/Common.php'; @@ -56,6 +56,34 @@ */ class MDB2_Driver_Function_mssql extends MDB2_Driver_Function_Common { + // }}} + // {{{ executeStoredProc() + + /** + * Execute a stored procedure and return any results + * + * @param string $name string that identifies the function to execute + * @param mixed $params array that contains the paramaters to pass the stored proc + * @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 &executeStoredProc($name, $params = null, $types = null, $result_class = false, $result_wrap_class = false) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + + $db->debug($query, 'query'); + $query = 'EXECUTE '.$name; + $query .= $params ? '('.implode(', ', $params).')' : ''; + return $db->query($query, $types, $result_class, $result_wrap_class); + } + // }}} // {{{ concat() http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Function/pgsql.php?r1=1.1&r2=1.2&ty=u Index: pear/MDB2/MDB2/Driver/Function/pgsql.php diff -u pear/MDB2/MDB2/Driver/Function/pgsql.php:1.1 pear/MDB2/MDB2/Driver/Function/pgsql.php:1.2 --- pear/MDB2/MDB2/Driver/Function/pgsql.php:1.1 Sun Oct 16 04:56:51 2005 +++ pear/MDB2/MDB2/Driver/Function/pgsql.php Mon Oct 17 04:28:52 2005 @@ -42,7 +42,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.1 2005/10/16 08:56:51 lsmith Exp $ +// $Id: pgsql.php,v 1.2 2005/10/17 08:28:52 lsmith Exp $ require_once 'MDB2/Driver/Function/Common.php'; @@ -55,5 +55,32 @@ */ class MDB2_Driver_Function_pgsql extends MDB2_Driver_Function_Common { + // }}} + // {{{ executeStoredProc() + + /** + * Execute a stored procedure and return any results + * + * @param string $name string that identifies the function to execute + * @param mixed $params array that contains the paramaters to pass the stored proc + * @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 &executeStoredProc($name, $params = null, $types = null, $result_class = false, $result_wrap_class = false) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + + $db->debug($query, 'query'); + $query = 'SELECT * FROM '.$name; + $query .= $params ? '('.implode(', ', $params).')' : '()'; + return $db->query($query, $types, $result_class, $result_wrap_class); + } } ?>

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