DbiExtension.php
5.8 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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<?php
/**
* Contract for every database extension supported by phpMyAdmin
*
* @package PhpMyAdmin-DBI
*/
namespace PhpMyAdmin\Dbi;
/**
* Contract for every database extension supported by phpMyAdmin
*
* @package PhpMyAdmin-DBI
*/
interface DbiExtension
{
/**
* connects to the database server
*
* @param string $user user name
* @param string $password user password
* @param array $server host/port/socket/persistent
*
* @return mixed false on error or a connection object on success
*/
public function connect(
$user, $password, array $server
);
/**
* selects given database
*
* @param string $dbname database name to select
* @param resource $link connection object
*
* @return boolean
*/
public function selectDb($dbname, $link);
/**
* runs a query and returns the result
*
* @param string $query query to execute
* @param resource $link connection object
* @param int $options query options
*
* @return mixed result
*/
public function realQuery($query, $link, $options);
/**
* Run the multi query and output the results
*
* @param resource $link connection object
* @param string $query multi query statement to execute
*
* @return array|bool
*/
public function realMultiQuery($link, $query);
/**
* returns array of rows with associative and numeric keys from $result
*
* @param object $result result set identifier
*
* @return array
*/
public function fetchArray($result);
/**
* returns array of rows with associative keys from $result
*
* @param object $result result set identifier
*
* @return array
*/
public function fetchAssoc($result);
/**
* returns array of rows with numeric keys from $result
*
* @param object $result result set identifier
*
* @return array
*/
public function fetchRow($result);
/**
* Adjusts the result pointer to an arbitrary row in the result
*
* @param object $result database result
* @param integer $offset offset to seek
*
* @return bool true on success, false on failure
*/
public function dataSeek($result, $offset);
/**
* Frees memory associated with the result
*
* @param object $result database result
*
* @return void
*/
public function freeResult($result);
/**
* Check if there are any more query results from a multi query
*
* @param resource $link the connection object
*
* @return bool true or false
*/
public function moreResults($link);
/**
* Prepare next result from multi_query
*
* @param resource $link the connection object
*
* @return bool true or false
*/
public function nextResult($link);
/**
* Store the result returned from multi query
*
* @param resource $link mysql link
*
* @return mixed false when empty results / result set when not empty
*/
public function storeResult($link);
/**
* Returns a string representing the type of connection used
*
* @param resource $link mysql link
*
* @return string type of connection used
*/
public function getHostInfo($link);
/**
* Returns the version of the MySQL protocol used
*
* @param resource $link mysql link
*
* @return integer version of the MySQL protocol used
*/
public function getProtoInfo($link);
/**
* returns a string that represents the client library version
*
* @return string MySQL client library version
*/
public function getClientInfo();
/**
* returns last error message or false if no errors occurred
*
* @param resource $link connection link
*
* @return string|bool $error or false
*/
public function getError($link);
/**
* returns the number of rows returned by last query
*
* @param object $result result set identifier
*
* @return string|int
*/
public function numRows($result);
/**
* returns the number of rows affected by last query
*
* @param resource $link the connection object
*
* @return int
*/
public function affectedRows($link);
/**
* returns metainfo for fields in $result
*
* @param object $result result set identifier
*
* @return array meta info for fields in $result
*/
public function getFieldsMeta($result);
/**
* return number of fields in given $result
*
* @param object $result result set identifier
*
* @return int field count
*/
public function numFields($result);
/**
* returns the length of the given field $i in $result
*
* @param object $result result set identifier
* @param int $i field
*
* @return int length of field
*/
public function fieldLen($result, $i);
/**
* returns name of $i. field in $result
*
* @param object $result result set identifier
* @param int $i field
*
* @return string name of $i. field in $result
*/
public function fieldName($result, $i);
/**
* returns concatenated string of human readable field flags
*
* @param object $result result set identifier
* @param int $i field
*
* @return string field flags
*/
public function fieldFlags($result, $i);
/**
* returns properly escaped string for use in MySQL queries
*
* @param mixed $link database link
* @param string $str string to be escaped
*
* @return string a MySQL escaped string
*/
public function escapeString($link, $str);
}