Index: dbase.php =================================================================== RCS file: /repository/pear/DB/DB/dbase.php,v retrieving revision 1.6 diff -u -r1.6 dbase.php --- dbase.php 5 Dec 2003 22:00:14 -0000 1.6 +++ dbase.php 10 Dec 2003 17:48:15 -0000 @@ -114,6 +114,33 @@ // }}} // {{{ fetchInto() + /** + * Fetch a row and insert the data into an existing array. + * + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result PostgreSQL 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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public + */ function fetchInto($res, &$row, $fetchmode, $rownum = null) { if ($rownum === null) { @@ -121,6 +148,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $row = @dbase_get_record_with_names($this->connection, $rownum); + if ($this->options['optimize'] == 'portability' && $row) { + $row = array_change_key_case($row, CASE_LOWER); + } } else { $row = @dbase_get_record($this->connection, $rownum); } Index: fbsql.php =================================================================== RCS file: /repository/pear/DB/DB/fbsql.php,v retrieving revision 1.8 diff -u -r1.8 fbsql.php --- fbsql.php 18 Sep 2003 13:32:58 -0000 1.8 +++ fbsql.php 10 Dec 2003 17:48:16 -0000 @@ -210,13 +210,29 @@ /** * Fetch a row and insert the data into an existing array. * - * @param $result fbsql result identifier - * @param $arr (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed - * @param $rownum the row number to fetch + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result fbsql result identifier + * @param $arr (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 mixed DB_OK on success, NULL when end of result set is + * reached, DB error on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() * @access public - * - * @return int DB_OK on success, a DB error on failure */ function fetchInto($result, &$arr, $fetchmode, $rownum=null) { @@ -227,6 +243,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $arr = @fbsql_fetch_array($result, FBSQL_ASSOC); + if ($this->options['optimize'] == 'portability' && $arr) { + $arr = array_change_key_case($arr, CASE_LOWER); + } } else { $arr = @fbsql_fetch_row($result); } Index: ibase.php =================================================================== RCS file: /repository/pear/DB/DB/ibase.php,v retrieving revision 1.17 diff -u -r1.17 ibase.php --- ibase.php 6 Dec 2003 09:04:13 -0000 1.17 +++ ibase.php 10 Dec 2003 17:48:16 -0000 @@ -216,6 +216,33 @@ // }}} // {{{ fetchInto() + /** + * Fetch a row and insert the data into an existing array. + * + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result PostgreSQL result identifier + * @param $ar (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 mixed DB_OK on success, NULL when end of result set is + * reached, DB error on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public + */ function fetchInto($result, &$ar, $fetchmode, $rownum = null) { if ($rownum !== NULL) { @@ -227,7 +254,7 @@ } else { $ar = get_object_vars(ibase_fetch_object($result)); } - if ($ar && $this->options['optimize'] == 'portability') { + if ($this->options['optimize'] == 'portability' && $ar) { $ar = array_change_key_case($ar, CASE_LOWER); } } else { Index: ifx.php =================================================================== RCS file: /repository/pear/DB/DB/ifx.php,v retrieving revision 1.15 diff -u -r1.15 ifx.php --- ifx.php 18 Sep 2003 13:32:58 -0000 1.15 +++ ifx.php 10 Dec 2003 17:48:16 -0000 @@ -197,16 +197,33 @@ // }}} // {{{ fetchInto() + /** - * Fetch a row and return as array. - * - * @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 + * Fetch a row and insert the data into an existing array. * - * @return int an array on success, a DB error code on failure, NULL - * if there is no more data + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public */ function fetchInto($result, &$row, $fetchmode, $rownum=null) { @@ -224,6 +241,9 @@ $order[$i++] = $val; } $row = $order; + } elseif ($fetchmode == DB_FETCHMODE_ASSOC + && $this->options['optimize'] == 'portability') { + $row = array_change_key_case($row, CASE_LOWER); } return DB_OK; } Index: msql.php =================================================================== RCS file: /repository/pear/DB/DB/msql.php,v retrieving revision 1.9 diff -u -r1.9 msql.php --- msql.php 18 Sep 2003 19:29:46 -0000 1.9 +++ msql.php 10 Dec 2003 17:48:17 -0000 @@ -135,6 +135,33 @@ // }}} // {{{ fetchInto() + /** + * Fetch a row and insert the data into an existing array. + * + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result PostgreSQL result identifier + * @param $ar (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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public + */ function fetchInto($result, &$ar, $fetchmode, $rownum=null) { if ($rownum !== null) { @@ -144,6 +171,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $ar = @msql_fetch_array($result, MSQL_ASSOC); + if ($this->options['optimize'] == 'portability' && $ar) { + $ar = array_change_key_case($ar, CASE_LOWER); + } } else { $ar = @msql_fetch_row($result); } Index: mssql.php =================================================================== RCS file: /repository/pear/DB/DB/mssql.php,v retrieving revision 1.19 diff -u -r1.19 mssql.php --- mssql.php 5 Dec 2003 22:00:14 -0000 1.19 +++ mssql.php 10 Dec 2003 17:48:17 -0000 @@ -170,6 +170,33 @@ // }}} // {{{ fetchInto() + /** + * Fetch a row and insert the data into an existing array. + * + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result PostgreSQL result identifier + * @param $ar (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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public + */ function fetchInto($result, &$ar, $fetchmode, $rownum=null) { if ($rownum !== null) { @@ -179,6 +206,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $ar = @mssql_fetch_array($result, MSSQL_ASSOC); + if ($this->options['optimize'] == 'portability' && $ar) { + $ar = array_change_key_case($ar, CASE_LOWER); + } } else { $ar = @mssql_fetch_row($result); } Index: mysql.php =================================================================== RCS file: /repository/pear/DB/DB/mysql.php,v retrieving revision 1.25 diff -u -r1.25 mysql.php --- mysql.php 18 Sep 2003 19:29:46 -0000 1.25 +++ mysql.php 10 Dec 2003 17:48:18 -0000 @@ -266,13 +266,29 @@ /** * Fetch a row and insert the data into an existing array. * - * @param $result MySQL result identifier - * @param $arr (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed - * @param $rownum the row number to fetch + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result MySQL result identifier + * @param $arr (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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() * @access public - * - * @return int DB_OK on success, a DB error on failure */ function fetchInto($result, &$arr, $fetchmode, $rownum=null) { @@ -283,6 +299,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $arr = @mysql_fetch_array($result, MYSQL_ASSOC); + if ($this->options['optimize'] == 'portability' && $arr) { + $arr = array_change_key_case($arr, CASE_LOWER); + } } else { $arr = @mysql_fetch_row($result); } Index: mysql4.php =================================================================== RCS file: /repository/pear/DB/DB/mysql4.php,v retrieving revision 1.9 diff -u -r1.9 mysql4.php --- mysql4.php 18 Sep 2003 19:29:46 -0000 1.9 +++ mysql4.php 10 Dec 2003 17:48:18 -0000 @@ -265,13 +265,29 @@ /** * Fetch a row and insert the data into an existing array. * - * @param $result MySQL result identifier - * @param $arr (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed - * @param $rownum the row number to fetch + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result MySQL result identifier + * @param $arr (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 mixed DB_OK on success, NULL when end of result set is + * reached, DB error on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() * @access public - * - * @return int DB_OK on success, a DB error on failure */ function fetchInto($result, &$arr, $fetchmode, $rownum=null) { @@ -282,6 +298,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $arr = @mysql_fetch_array($result, MYSQL_ASSOC); + if ($this->options['optimize'] == 'portability' && $arr) { + $arr = array_change_key_case($arr, CASE_LOWER); + } } else { $arr = @mysql_fetch_row($result); } Index: oci8.php =================================================================== RCS file: /repository/pear/DB/DB/oci8.php,v retrieving revision 1.17 diff -u -r1.17 oci8.php --- oci8.php 6 Dec 2003 09:04:13 -0000 1.17 +++ oci8.php 10 Dec 2003 17:48:19 -0000 @@ -184,12 +184,29 @@ /** * Fetch a row and insert the data into an existing array. * - * @param $result oci8 result identifier - * @param $arr (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed - * @param $rownum the row number to fetch (not yet supported) - * - * @return int DB_OK on success, a DB error code on failure + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result oci8 result identifier + * @param $arr (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 (not yet supported) + * + * @return mixed DB_OK on success, NULL when end of result set is + * reached, DB error on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public */ function fetchInto($result, &$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=NULL) { @@ -198,7 +215,7 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $moredata = @OCIFetchInto($result,$arr,OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS); - if ($moredata && $this->options['optimize'] == 'portability') { + if ($this->options['optimize'] == 'portability' && $moredata) { $arr = array_change_key_case($arr, CASE_LOWER); } } else { Index: odbc.php =================================================================== RCS file: /repository/pear/DB/DB/odbc.php,v retrieving revision 1.9 diff -u -r1.9 odbc.php --- odbc.php 18 Sep 2003 13:32:58 -0000 1.9 +++ odbc.php 10 Dec 2003 17:48:19 -0000 @@ -201,6 +201,33 @@ // }}} // {{{ fetchInto() + /** + * Fetch a row and insert the data into an existing array. + * + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result PostgreSQL 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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public + */ function fetchInto($result, &$row, $fetchmode, $rownum=null) { $row = array(); Index: pgsql.php =================================================================== RCS file: /repository/pear/DB/DB/pgsql.php,v retrieving revision 1.30 diff -u -r1.30 pgsql.php --- pgsql.php 5 Dec 2003 22:00:14 -0000 1.30 +++ pgsql.php 10 Dec 2003 17:48:20 -0000 @@ -266,12 +266,29 @@ /** * Fetch a row and insert the data into an existing array. * - * @param $result PostgreSQL result identifier - * @param $row (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed - * @param $rownum the row number to fetch - * - * @return int DB_OK on success, a DB error code on failure + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result PostgreSQL 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 mixed DB_OK on success, NULL when end of result set is + * reached, DB error on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public */ function fetchInto($result, &$row, $fetchmode, $rownum=null) { @@ -281,6 +298,9 @@ } if ($fetchmode & DB_FETCHMODE_ASSOC) { $row = @pg_fetch_array($result, $rownum, PGSQL_ASSOC); + if ($this->options['optimize'] == 'portability' && $row) { + $row = array_change_key_case($row, CASE_LOWER); + } } else { $row = @pg_fetch_row($result, $rownum); } Index: sqlite.php =================================================================== RCS file: /repository/pear/DB/DB/sqlite.php,v retrieving revision 1.24 diff -u -r1.24 sqlite.php --- sqlite.php 5 Dec 2003 21:47:00 -0000 1.24 +++ sqlite.php 10 Dec 2003 17:48:20 -0000 @@ -285,17 +285,31 @@ // {{{ fetchInto() /** - * Fetch a row and insert the data into an existing array. Availabe modes - * are SQLITE_ASSOC, SQLITE_NUM and SQLITE_BOTH. An object type is not - * available. + * Fetch a row and insert the data into an existing array. + * + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). * * @param $result SQLite result identifier * @param $arr (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed + * @param $fetchmode how the resulting array should be indexed * @param $rownum the row number to fetch - * @access public * - * @return int DB_OK on success, a DB error on failure + * @return mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() + * @access public */ function fetchInto($result, &$arr, $fetchmode, $rownum=null) { if ($rownum !== null) { @@ -303,8 +317,11 @@ return null; } } - if ($fetchmode & DB_FETCHMODE_ASSOC ) { + if ($fetchmode & DB_FETCHMODE_ASSOC) { $arr = sqlite_fetch_array($result, SQLITE_ASSOC); + if ($this->options['optimize'] == 'portability' && $arr) { + $arr = array_change_key_case($arr, CASE_LOWER); + } } else { $arr = sqlite_fetch_array($result, SQLITE_NUM); } Index: sybase.php =================================================================== RCS file: /repository/pear/DB/DB/sybase.php,v retrieving revision 1.15 diff -u -r1.15 sybase.php --- sybase.php 18 Sep 2003 19:29:46 -0000 1.15 +++ sybase.php 10 Dec 2003 17:48:21 -0000 @@ -278,13 +278,29 @@ /** * Fetch a row and insert the data into an existing array. * - * @param $result Sybase result identifier - * @param $arr (reference) array where data from the row is stored - * @param $fetchmode how the array data should be indexed - * @param $rownum the row number to fetch + * The array's keys will be converted to lower case if + * $options['optimize'] is set to portability + * AND $fetchmode is set to DB_FETCHMODE_ASSOC. + * + * $options['optimize'] can be set when instantiating the + * DB class via DB::connect(), but can be changed using + * DB_common::setOption. + * + * $fetchmode is usually set via DB_common::setFetchMode(). + * + * @param $result Sybase result identifier + * @param $ar (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 mixed DB_OK on success, NULL when end of result set is + * reached or on failure + * + * @see DB::connect() + * @see DB_common::setOption + * @see DB_common::$options + * @see DB_common::setFetchMode() * @access public - * - * @return int DB_OK on success, a null on failure */ function fetchInto($result, &$ar, $fetchmode, $rownum=null) { @@ -293,7 +309,14 @@ return null; } } - $ar = ($fetchmode & DB_FETCHMODE_ASSOC) ? @sybase_fetch_array($result) : @sybase_fetch_row($result); + if ($fetchmode & DB_FETCHMODE_ASSOC) { + $ar = @sybase_fetch_array($result); + if ($this->options['optimize'] == 'portability' && $ar) { + $ar = array_change_key_case($ar, CASE_LOWER); + } + } else { + $ar = @sybase_fetch_row($result); + } if (!$ar) { // reported not work as seems that sybase_get_last_message() // always return a message here