Ibm.class.php
3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Util
* @package Util_Db
* @subpackage Statement
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Ibm.class.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Util_Db_Statement_Pdo
*/
// require_once 'Util/Db/Statement/Pdo.php';
/**
* Proxy class to wrap a PDOStatement object for IBM Databases.
* Matches the interface of PDOStatement. All methods simply proxy to the
* matching method in PDOStatement. PDOExceptions thrown by PDOStatement
* are re-thrown as Util_Db_Statement_Exception.
*
* @category Util
* @package Util_Db
* @subpackage Statement
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Util_Db_Statement_Pdo_Ibm extends Util_Db_Statement_Pdo
{
/**
* Returns an array containing all of the result set rows.
*
* Behaves like parent, but if limit()
* is used, the final result removes the extra column
* 'Util_db_rownum'
*
* @param int $style OPTIONAL Fetch mode.
* @param int $col OPTIONAL Column number, if fetch mode is by column.
* @return array Collection of rows, each in a format by the fetch mode.
* @throws Util_Db_Statement_Exception
*/
public function fetchAll($style = null, $col = null)
{
$data = parent::fetchAll($style, $col);
$results = array();
$remove = $this->_adapter->foldCase('Util_DB_ROWNUM');
foreach ($data as $row) {
if (is_array($row) && array_key_exists($remove, $row)) {
unset($row[$remove]);
}
$results[] = $row;
}
return $results;
}
/**
* Binds a parameter to the specified variable name.
*
* @param mixed $parameter Name the parameter, either integer or string.
* @param mixed $variable Reference to PHP variable containing the value.
* @param mixed $type OPTIONAL Datatype of SQL parameter.
* @param mixed $length OPTIONAL Length of SQL parameter.
* @param mixed $options OPTIONAL Other options.
* @return bool
* @throws Util_Db_Statement_Exception
*/
public function _bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
{
try {
if (($type === null) && ($length === null) && ($options === null)) {
return $this->_stmt->bindParam($parameter, $variable);
} else {
return $this->_stmt->bindParam($parameter, $variable, $type, $length, $options);
}
} catch (PDOException $e) {
// require_once 'Util/Db/Statement/Exception.php';
throw new Util_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
}
}
}