5 * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
8 * @link https://adodb.org Project's web site and documentation
9 * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
11 * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
12 * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
13 * any later version. This means you can use it in proprietary products.
14 * See the LICENSE.md file distributed with this source code for details.
15 * @license BSD-3-Clause
16 * @license LGPL-2.1-or-later
18 * @copyright 2000-2013 John Lim
19 * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
23 Filter all fields and all rows in a recordset and returns the
24 processed recordset. We scroll to the beginning of the new recordset
27 We pass a recordset and function name to RSFilter($rs,'rowfunc');
28 and the function will be called multiple times, once
29 for each row in the recordset. The function will be passed
30 an array containing one row repeatedly.
34 // ucwords() every element in the recordset
35 function do_ucwords(&$arr,$rs)
37 foreach($arr as $k => $v) {
38 $arr[$k] = ucwords($v);
41 $rs = RSFilter($rs,'do_ucwords');
43 function RSFilter($rs,$fn)
45 if ($rs->databaseType
!= 'array') {
46 if (!$rs->connection
) return false;
48 $rs = $rs->connection
->_rs2rs($rs);
50 $rows = $rs->RecordCount();
51 for ($i=0; $i < $rows; $i++
) {
55 $obj->$method ($rs->_array
[$i],$rs);
57 $fn($rs->_array
[$i],$rs);
63 $rs->fields
= $rs->_array
[0];