[PHP-CVS] cvs: php4 /pear/DB common.php
mj Tue Apr 10 01:03:47 2001 EDT Modified files: /php4/pear/DB common.php Log: fixed typo in inline docs Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.42 php4/pear/DB/common.php:1.43 --- php4/pear/DB/common.php:1.42Mon Mar 26 16:57:24 2001 +++ php4/pear/DB/common.php Tue Apr 10 01:03:46 2001 @@ -671,7 +671,7 @@ * '3' = 'three', * ) * - * ...while the call getAssoc('SELECT id,text,date FROM mydate') returns: + * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns: * array( * '1' = array('one', '944679408'), * '2' = array('two', '944679408'), -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/DB common.php ifx.php pgsql.php
cox Mon Mar 26 16:57:25 2001 EDT Modified files: /php4/pear/DB common.php ifx.php pgsql.php Log: ifx.php * Changed default fetchmode to ORDERED * Remove extra checks in connect and added $dns property * fetchRow() now uses fetchInto() common.php pgsql.php style Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.41 php4/pear/DB/common.php:1.42 --- php4/pear/DB/common.php:1.41Fri Mar 23 23:00:45 2001 +++ php4/pear/DB/common.php Mon Mar 26 16:57:24 2001 @@ -51,9 +51,8 @@ function toString() { - $info = get_class($this); - - $info .= ": (phptype=" . $this-phptype . +$info = get_class($this); +$info .= ": (phptype=" . $this-phptype . ", dbsyntax=" . $this-dbsyntax . ")"; @@ -229,7 +228,7 @@ case PEAR_ERROR_TRIGGER: case PEAR_ERROR_DIE: $this-error_mode = $mode; - + if (!$options) { $this-error_level = E_USER_NOTICE; } else { @@ -322,10 +321,10 @@ for ($i = 0; $i strlen($query); $i++) { switch ($query[$i]) { -case "?": +case '?': $types[$token++] = DB_PARAM_SCALAR; break; -case "": +case '': $types[$token++] = DB_PARAM_OPAQUE; break; } @@ -372,18 +371,18 @@ !sizeof($this-prepare_tokens[$stmt])) { return $this-raiseError(DB_ERROR_INVALID); } - + $qq = $this-prepare_tokens[$stmt]; $qp = sizeof($qq) - 1; - + if ((!$data $qp 0) || (!is_array($data) $qp 1) || (is_array($data) $qp sizeof($data))) { return $this-raiseError(DB_ERROR_NEED_MORE_DATA); } - + $realquery = $qq[0]; - + for ($i = 0; $i $qp; $i++) { if ($this-prepare_types[$stmt][$i] == DB_PARAM_OPAQUE) { if (is_array($data)) { @@ -629,7 +628,7 @@ if (isset($sth)) { $this-freeResult($sth); } - + return $ret; } Index: php4/pear/DB/ifx.php diff -u php4/pear/DB/ifx.php:1.3 php4/pear/DB/ifx.php:1.4 --- php4/pear/DB/ifx.php:1.3Sun Mar 25 02:34:31 2001 +++ php4/pear/DB/ifx.phpMon Mar 26 16:57:24 2001 @@ -33,7 +33,8 @@ var $numrows; var $row; var $affected = 0; -var $fetchmode = DB_FETCHMODE_ASSOC; /* Default fetch mode */ +var $dsn = array(); +var $fetchmode = DB_FETCHMODE_ORDERED; /* Default fetch mode */ function DB_ifx() { @@ -54,7 +55,7 @@ '-1206' = DB_ERROR_INVALID_DATE, '-1209' = DB_ERROR_INVALID_DATE, '-1210' = DB_ERROR_INVALID_DATE, -'-1212' = DB_ERROR_INVALID_DATE +'-1212' = DB_ERROR_INVALID_DATE ); } @@ -67,9 +68,9 @@ * * @return int DB_OK on success, a DB error code on failure */ -function connect($dsn, $persistent = false) +function connect($dsninfo, $persistent = false) { -$dsninfo = DB::parseDSN($dsn); +$this-dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? '@' . $dsninfo['hostspec'] : ''; $dbname = $dsninfo['database'] ? $dsninfo['database'] . $dbhost : ''; $user = $dsninfo['username'] ? $dsninfo['username'] : ''; @@ -137,33 +138,56 @@ } /** + * Fetch and return a row of data (it uses fetchInto for that) + * @param $result Informix result identifier + * @param $fetchmode format of fetched row array + * @param $rownumthe absolute row number to fetch + * + * @return array a row of data, or false on error + */ +function fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=0) +{ +if ($fetchmode == DB_FETCHMODE_DEFAULT) { +$fetchmode = $this-fetchmode; +} +$res = $this-fetchInto ($result, $arr, $fetchmode, $rownum); +if ($res !== DB_OK) { +return $res; +} +return $arr; +} + +/** * Fetch a row and return as array. * - * @param $result Informix result identifier - * @param $fetchmode how the resulting array should be indexed - * @param $rownum the row number to fetch + * @param $result Informix result identifier + * @param $row (reference) array where data from the row is stored + * @param $fetchmode how the resulting array should be indexed + * @param $rownum the row number to fetch * * @return int an array on success, a DB error code on failure, NULL * if there is no more data */ -function fetchRow($result, $fetchmode, $rownum=null) +function fetchInto($res,
[PHP-CVS] cvs: php4 /pear/DB common.php
ssb Mon Mar 12 01:33:21 2001 EDT Modified files: /php4/pear/DB common.php Log: * bugfix (thanks to Alexey Borzov) Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.38 php4/pear/DB/common.php:1.39 --- php4/pear/DB/common.php:1.38Mon Feb 19 04:22:25 2001 +++ php4/pear/DB/common.php Mon Mar 12 01:33:21 2001 @@ -721,7 +721,8 @@ } } else { // return scalar values -while (($row = $this-fetchRow($res)) !DB::isError($row)) { +while (($row = $this-fetchRow($res, DB_FETCHMODE_ORDERED)) + !DB::isError($row)) { $results[$row[0]] = $row[1]; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/DB common.php ibase.php msql.php mssql.php mysql.php oci8.php odbc.php pgsql.php sybase.php /pear/DB/tests transactions.inc /pear/DB/tests/pgsql 011.phpt
ssb Mon Feb 19 04:22:31 2001 EDT Added files: /php4/pear/DB/tests transactions.inc /php4/pear/DB/tests/pgsql 011.phpt Modified files: /php4/pear/DB common.php ibase.php msql.php mssql.php mysql.php oci8.php odbc.php pgsql.php sybase.php Log: @Fixed pgsql transaction support (Stig, PEAR/DB) also added "dsn" property in all backends Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.37 php4/pear/DB/common.php:1.38 --- php4/pear/DB/common.php:1.37Sun Feb 18 08:23:03 2001 +++ php4/pear/DB/common.php Mon Feb 19 04:22:25 2001 @@ -44,6 +44,7 @@ 'persistent' = false, // persistent connection? 'optimize' = 'performance', // 'performance' or 'portability' ); +var $dbh; // }}} // {{{ toString() Index: php4/pear/DB/ibase.php diff -u php4/pear/DB/ibase.php:1.16 php4/pear/DB/ibase.php:1.17 --- php4/pear/DB/ibase.php:1.16 Fri Feb 16 09:14:39 2001 +++ php4/pear/DB/ibase.php Mon Feb 19 04:22:26 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes [EMAIL PROTECTED] | // +--+ // -// $Id: ibase.php,v 1.16 2001/02/16 17:14:39 chagenbu Exp $ +// $Id: ibase.php,v 1.17 2001/02/19 12:22:26 ssb Exp $ // // Database independent query interface definition for PHP's Interbase // extension. @@ -53,6 +53,7 @@ if (!$dsninfo || !$dsninfo['phptype']) { return $this-raiseError("invalid data source name"); } +$this-dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? Index: php4/pear/DB/msql.php diff -u php4/pear/DB/msql.php:1.15 php4/pear/DB/msql.php:1.16 --- php4/pear/DB/msql.php:1.15 Fri Feb 16 09:14:39 2001 +++ php4/pear/DB/msql.php Mon Feb 19 04:22:26 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes [EMAIL PROTECTED] | // +--+ // -// $Id: msql.php,v 1.15 2001/02/16 17:14:39 chagenbu Exp $ +// $Id: msql.php,v 1.16 2001/02/19 12:22:26 ssb Exp $ // // Database independent query interface definition for PHP's Mini-SQL // extension. @@ -53,7 +53,7 @@ if (!$dsninfo || !$dsninfo['phptype']) { return $this-raiseError(); } - +$this-dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; Index: php4/pear/DB/mssql.php diff -u php4/pear/DB/mssql.php:1.18 php4/pear/DB/mssql.php:1.19 --- php4/pear/DB/mssql.php:1.18 Fri Feb 16 09:14:39 2001 +++ php4/pear/DB/mssql.php Mon Feb 19 04:22:26 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes [EMAIL PROTECTED] | // +--+ // -// $Id: mssql.php,v 1.18 2001/02/16 17:14:39 chagenbu Exp $ +// $Id: mssql.php,v 1.19 2001/02/19 12:22:26 ssb Exp $ // // Database independent query interface definition for PHP's Microsoft SQL Server // extension. @@ -53,7 +53,7 @@ if (!$dsninfo || !$dsninfo['phptype']) { return $this-raiseError(mssql_get_last_message()); } - +$this-dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; Index: php4/pear/DB/mysql.php diff -u php4/pear/DB/mysql.php:1.48 php4/pear/DB/mysql.php:1.49 --- php4/pear/DB/mysql.php:1.48 Sat Feb 17 08:45:01 2001 +++ php4/pear/DB/mysql.php Mon Feb 19 04:22:26 2001 @@ -102,6 +102,8 @@ return $this-raiseError(); // XXX ERRORMSG } +$this-dsn = $dsninfo; + $dbhost = $dsninfo["hostspec"] ? $dsninfo["hostspec"] : "localhost"; $user = $dsninfo["username"]; $pw = $dsninfo["password"]; Index: php4/pear/DB/oci8.php diff -u php4/pear/DB/oci8.php:1.18 php4/pear/DB/oci8.php:1.19 --- php4/pear/DB/oci8.php:1.18 Sun Feb 18 08:24:00 2001 +++ php4/pear/DB/oci8.php Mon Feb 19 04:22:26 2001 @@ -79,6 +79,7 @@ if (!$dsninfo || !$dsninfo['phptype']) { return $this-raiseError(); } +$this-dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $hostspec = $dsninfo['hostspec']; Index: php4/pear/DB/odbc.php diff -u php4/pear/DB/odbc.php:1.27 php4/pear/DB/odbc.php:1.28 --- php4/pear/DB/odbc.php:1.27 Sun Feb 18 16:14:27 2001 +++ php4/pear/DB/odbc.php Mon Feb 19 04:22:26 2001 @@ -97,6 +97,7 @@ if (!$dsninfo || !$dsninfo['phptype']) { return $this-raiseError(); // XXX ERRORMSG
[PHP-CVS] cvs: php4 /pear/DB common.php
ssb Sun Feb 18 08:23:03 2001 EDT Modified files: /php4/pear/DB common.php Log: * added "persistent" option Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.36 php4/pear/DB/common.php:1.37 --- php4/pear/DB/common.php:1.36Thu Feb 1 12:16:53 2001 +++ php4/pear/DB/common.php Sun Feb 18 08:23:03 2001 @@ -41,6 +41,7 @@ var $last_query = ''; var $fetchmode = DB_FETCHMODE_ORDERED; var $options = array( +'persistent' = false, // persistent connection? 'optimize' = 'performance', // 'performance' or 'portability' ); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/DB common.php
cmv Thu Feb 1 12:16:53 2001 EDT Modified files: /php4/pear/DB common.php Log: fix here too Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.35 php4/pear/DB/common.php:1.36 --- php4/pear/DB/common.php:1.35Tue Jan 9 17:01:53 2001 +++ php4/pear/DB/common.php Thu Feb 1 12:16:53 2001 @@ -242,13 +242,13 @@ is_object($options[0]) is_string($options[1]))) { $this-error_callback = $options; } else { -trigger_error(E_USER_WARNING, "invalid error callback"); +trigger_error("invalid error callback", E_USER_WARNING); } $this-error_level = PEAR_ERROR_RETURN; break; default: -trigger_error(E_USER_WARNING, "invalid error mode"); +trigger_error("invalid error mode", E_USER_WARNING); break; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]