blob: 5987ee4ce34955a978c835a0994429cec2990a75 (
plain) (
blame)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
<?php
/**
*
* This file is part of Aura for PHP.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*/
namespace Aura\Sql;
use PDO;
/**
*
* An interface to the native PDO object.
*
* @package Aura.Sql
*
*/
interface PdoInterface
{
/**
*
* Begins a transaction and turns off autocommit mode.
*
* @return bool True on success, false on failure.
*
* @see http://php.net/manual/en/pdo.begintransaction.php
*
*/
public function beginTransaction();
/**
*
* Commits the existing transaction and restores autocommit mode.
*
* @return bool True on success, false on failure.
*
* @see http://php.net/manual/en/pdo.commit.php
*
*/
public function commit();
/**
*
* Gets the most recent error code.
*
* @return mixed
*
*/
public function errorCode();
/**
*
* Gets the most recent error info.
*
* @return array
*
*/
public function errorInfo();
/**
*
* Executes an SQL statement and returns the number of affected rows.
*
* @param string $statement The SQL statement to execute.
*
* @return int The number of rows affected.
*
* @see http://php.net/manual/en/pdo.exec.php
*
*/
public function exec($statement);
/**
*
* Gets a PDO attribute value.
*
* @param mixed $attribute The PDO::ATTR_* constant.
*
* @return mixed The value for the attribute.
*
*/
public function getAttribute($attribute);
/**
*
* Is a transaction currently active?
*
* @return bool
*
* @see http://php.net/manual/en/pdo.intransaction.php
*
*/
public function inTransaction();
/**
*
* Returns the last inserted autoincrement sequence value.
*
* @param string $name The name of the sequence to check; typically needed
* only for PostgreSQL, where it takes the form of `<table>_<column>_seq`.
*
* @return int
*
* @see http://php.net/manual/en/pdo.lastinsertid.php
*
*/
public function lastInsertId($name = null);
/**
*
* Prepares an SQL statement for execution.
*
* @param string $statement The SQL statement to prepare for execution.
*
* @param array $options Set these attributes on the returned
* PDOStatement.
*
* @return \PDOStatement
*
* @see http://php.net/manual/en/pdo.prepare.php
*
*/
public function prepare($statement, $options = null);
/**
*
* Queries the database and returns a PDOStatement.
*
* @param string $statement The SQL statement to prepare and execute.
*
* @param int $fetch_mode The `PDO::FETCH_*` type to set on the returned
* `PDOStatement::setFetchMode()`.
*
* @param mixed $fetch_arg1 The first additional argument to send to
* `PDOStatement::setFetchMode()`.
*
* @param mixed $fetch_arg2 The second additional argument to send to
* `PDOStatement::setFetchMode()`.
*
* @return \PDOStatement
*
* @see http://php.net/manual/en/pdo.query.php
*
*/
public function query($statement);
/**
*
* Quotes a value for use in an SQL statement.
*
* @param mixed $value The value to quote.
*
* @param int $parameter_type A data type hint for the database driver.
*
* @return mixed The quoted value.
*
* @see http://php.net/manual/en/pdo.quote.php
*
*/
public function quote($value, $parameter_type = PDO::PARAM_STR);
/**
*
* Rolls back the current transaction and restores autocommit mode.
*
* @return bool True on success, false on failure.
*
* @see http://php.net/manual/en/pdo.rollback.php
*
*/
public function rollBack();
/**
*
* Sets a PDO attribute value.
*
* @param mixed $attribute The PDO::ATTR_* constant.
*
* @param mixed $value The value for the attribute.
*
* @return bool
*
*/
public function setAttribute($attribute, $value);
/**
*
* Returns all currently available PDO drivers.
*
* @return array
*
*/
public static function getAvailableDrivers();
}
|