PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / msql.php

msql.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at vendor/thecodingmachine/safe/generated/msql.php

444 lines 12.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\MsqlException;
6
7 /**
8 * Returns number of affected rows by the last SELECT, UPDATE or DELETE
9 * query associated with result.
10 *
11 * @param resource $result The result resource that
12 * is being evaluated. This result comes from a call to
13 * msql_query.
14 * @return int Returns the number of affected rows on success.
15 * @throws MsqlException
16 *
17 */
18 function msql_affected_rows($result): int
19 {
20 error_clear_last();
21 $result = \msql_affected_rows($result);
22 if ($result === false) {
23 throw MsqlException::createFromPhpError();
24 }
25 return $result;
26 }
27
28
29 /**
30 * msql_close closes the non-persistent connection to
31 * the mSQL server that's associated with the specified link identifier.
32 *
33 * Using msql_close isn't usually necessary, as
34 * non-persistent open links are automatically closed at the end of the
35 * script's execution. See also freeing resources.
36 *
37 * @param resource|null $link_identifier The mSQL connection.
38 * If not specified, the last link opened by msql_connect
39 * is assumed. If no such link is found, the function will try to establish a
40 * link as if msql_connect was called, and use it.
41 * @throws MsqlException
42 *
43 */
44 function msql_close($link_identifier = null): void
45 {
46 error_clear_last();
47 if ($link_identifier !== null) {
48 $result = \msql_close($link_identifier);
49 } else {
50 $result = \msql_close();
51 }
52 if ($result === false) {
53 throw MsqlException::createFromPhpError();
54 }
55 }
56
57
58 /**
59 * msql_connect establishes a connection to a mSQL
60 * server.
61 *
62 * If a second call is made to msql_connect with
63 * the same arguments, no new link will be established, but instead, the
64 * link identifier of the already opened link will be returned.
65 *
66 * The link to the server will be closed as soon as the execution of the
67 * script ends, unless it's closed earlier by explicitly calling
68 * msql_close.
69 *
70 * @param string $hostname The hostname can also include a port number. e.g.
71 * hostname,port.
72 *
73 * If not specified, the connection is established by the means of a Unix
74 * domain socket, being then more efficient then a localhost TCP socket
75 * connection.
76 *
77 * While this function will accept a colon (:) as a
78 * host/port separator, a comma (,) is the preferred
79 * method.
80 * @return resource Returns a positive mSQL link identifier on success.
81 * @throws MsqlException
82 *
83 */
84 function msql_connect(string $hostname = null)
85 {
86 error_clear_last();
87 if ($hostname !== null) {
88 $result = \msql_connect($hostname);
89 } else {
90 $result = \msql_connect();
91 }
92 if ($result === false) {
93 throw MsqlException::createFromPhpError();
94 }
95 return $result;
96 }
97
98
99 /**
100 * msql_create_db attempts to create a new database on
101 * the mSQL server.
102 *
103 * @param string $database_name The name of the mSQL database.
104 * @param resource|null $link_identifier The mSQL connection.
105 * If not specified, the last link opened by msql_connect
106 * is assumed. If no such link is found, the function will try to establish a
107 * link as if msql_connect was called, and use it.
108 * @throws MsqlException
109 *
110 */
111 function msql_create_db(string $database_name, $link_identifier = null): void
112 {
113 error_clear_last();
114 if ($link_identifier !== null) {
115 $result = \msql_create_db($database_name, $link_identifier);
116 } else {
117 $result = \msql_create_db($database_name);
118 }
119 if ($result === false) {
120 throw MsqlException::createFromPhpError();
121 }
122 }
123
124
125 /**
126 * msql_data_seek moves the internal row
127 * pointer of the mSQL result associated with the specified query
128 * identifier to point to the specified row number. The next call
129 * to msql_fetch_row would return that
130 * row.
131 *
132 * @param resource $result The result resource that
133 * is being evaluated. This result comes from a call to
134 * msql_query.
135 * @param int $row_number The seeked row number.
136 * @throws MsqlException
137 *
138 */
139 function msql_data_seek($result, int $row_number): void
140 {
141 error_clear_last();
142 $result = \msql_data_seek($result, $row_number);
143 if ($result === false) {
144 throw MsqlException::createFromPhpError();
145 }
146 }
147
148
149 /**
150 * msql_db_query selects a database and executes a query
151 * on it.
152 *
153 * @param string $database The name of the mSQL database.
154 * @param string $query The SQL query.
155 * @param resource|null $link_identifier The mSQL connection.
156 * If not specified, the last link opened by msql_connect
157 * is assumed. If no such link is found, the function will try to establish a
158 * link as if msql_connect was called, and use it.
159 * @return resource Returns a positive mSQL query identifier to the query result.
160 * @throws MsqlException
161 *
162 */
163 function msql_db_query(string $database, string $query, $link_identifier = null)
164 {
165 error_clear_last();
166 if ($link_identifier !== null) {
167 $result = \msql_db_query($database, $query, $link_identifier);
168 } else {
169 $result = \msql_db_query($database, $query);
170 }
171 if ($result === false) {
172 throw MsqlException::createFromPhpError();
173 }
174 return $result;
175 }
176
177
178 /**
179 * msql_drop_db attempts to drop (remove) a database
180 * from the mSQL server.
181 *
182 * @param string $database_name The name of the database.
183 * @param resource|null $link_identifier The mSQL connection.
184 * If not specified, the last link opened by msql_connect
185 * is assumed. If no such link is found, the function will try to establish a
186 * link as if msql_connect was called, and use it.
187 * @throws MsqlException
188 *
189 */
190 function msql_drop_db(string $database_name, $link_identifier = null): void
191 {
192 error_clear_last();
193 if ($link_identifier !== null) {
194 $result = \msql_drop_db($database_name, $link_identifier);
195 } else {
196 $result = \msql_drop_db($database_name);
197 }
198 if ($result === false) {
199 throw MsqlException::createFromPhpError();
200 }
201 }
202
203
204 /**
205 * msql_field_len returns the length of the specified
206 * field.
207 *
208 * @param resource $result The result resource that
209 * is being evaluated. This result comes from a call to
210 * msql_query.
211 * @param int $field_offset The numerical field offset. The
212 * field_offset starts at 1.
213 * @return int Returns the length of the specified field.
214 * @throws MsqlException
215 *
216 */
217 function msql_field_len($result, int $field_offset): int
218 {
219 error_clear_last();
220 $result = \msql_field_len($result, $field_offset);
221 if ($result === false) {
222 throw MsqlException::createFromPhpError();
223 }
224 return $result;
225 }
226
227
228 /**
229 * msql_field_name gets the name of the specified field
230 * index.
231 *
232 * @param resource $result The result resource that
233 * is being evaluated. This result comes from a call to
234 * msql_query.
235 * @param int $field_offset The numerical field offset. The
236 * field_offset starts at 1.
237 * @return string The name of the field.
238 * @throws MsqlException
239 *
240 */
241 function msql_field_name($result, int $field_offset): string
242 {
243 error_clear_last();
244 $result = \msql_field_name($result, $field_offset);
245 if ($result === false) {
246 throw MsqlException::createFromPhpError();
247 }
248 return $result;
249 }
250
251
252 /**
253 * Seeks to the specified field offset. If the next call to
254 * msql_fetch_field won't include a field offset, this
255 * field would be returned.
256 *
257 * @param resource $result The result resource that
258 * is being evaluated. This result comes from a call to
259 * msql_query.
260 * @param int $field_offset The numerical field offset. The
261 * field_offset starts at 1.
262 * @throws MsqlException
263 *
264 */
265 function msql_field_seek($result, int $field_offset): void
266 {
267 error_clear_last();
268 $result = \msql_field_seek($result, $field_offset);
269 if ($result === false) {
270 throw MsqlException::createFromPhpError();
271 }
272 }
273
274
275 /**
276 * Returns the name of the table that the specified field is in.
277 *
278 * @param resource $result The result resource that
279 * is being evaluated. This result comes from a call to
280 * msql_query.
281 * @param int $field_offset The numerical field offset. The
282 * field_offset starts at 1.
283 * @return int The name of the table on success.
284 * @throws MsqlException
285 *
286 */
287 function msql_field_table($result, int $field_offset): int
288 {
289 error_clear_last();
290 $result = \msql_field_table($result, $field_offset);
291 if ($result === false) {
292 throw MsqlException::createFromPhpError();
293 }
294 return $result;
295 }
296
297
298 /**
299 * msql_field_type gets the type of the specified field
300 * index.
301 *
302 * @param resource $result The result resource that
303 * is being evaluated. This result comes from a call to
304 * msql_query.
305 * @param int $field_offset The numerical field offset. The
306 * field_offset starts at 1.
307 * @return string The type of the field. One of int,
308 * char, real, ident,
309 * null or unknown. This functions will
310 * return FALSE on failure.
311 * @throws MsqlException
312 *
313 */
314 function msql_field_type($result, int $field_offset): string
315 {
316 error_clear_last();
317 $result = \msql_field_type($result, $field_offset);
318 if ($result === false) {
319 throw MsqlException::createFromPhpError();
320 }
321 return $result;
322 }
323
324
325 /**
326 * msql_free_result frees the memory associated
327 * with query_identifier. When PHP completes a
328 * request, this memory is freed automatically, so you only need to
329 * call this function when you want to make sure you don't use too
330 * much memory while the script is running.
331 *
332 * @param resource $result The result resource that
333 * is being evaluated. This result comes from a call to
334 * msql_query.
335 * @throws MsqlException
336 *
337 */
338 function msql_free_result($result): void
339 {
340 error_clear_last();
341 $result = \msql_free_result($result);
342 if ($result === false) {
343 throw MsqlException::createFromPhpError();
344 }
345 }
346
347
348 /**
349 * msql_pconnect acts very much like
350 * msql_connect with two major differences.
351 *
352 * First, when connecting, the function would first try to find a
353 * (persistent) link that's already open with the same host.
354 * If one is found, an identifier for it will be returned instead of opening
355 * a new connection.
356 *
357 * Second, the connection to the SQL server will not be closed when the
358 * execution of the script ends. Instead, the link will remain open for
359 * future use (msql_close will not close links
360 * established by this function).
361 *
362 * @param string $hostname The hostname can also include a port number. e.g.
363 * hostname,port.
364 *
365 * If not specified, the connection is established by the means of a Unix
366 * domain socket, being more efficient than a localhost TCP socket
367 * connection.
368 * @return resource Returns a positive mSQL link identifier on success.
369 * @throws MsqlException
370 *
371 */
372 function msql_pconnect(string $hostname = null)
373 {
374 error_clear_last();
375 if ($hostname !== null) {
376 $result = \msql_pconnect($hostname);
377 } else {
378 $result = \msql_pconnect();
379 }
380 if ($result === false) {
381 throw MsqlException::createFromPhpError();
382 }
383 return $result;
384 }
385
386
387 /**
388 * msql_query sends a query to the currently active
389 * database on the server that's associated with the specified link
390 * identifier.
391 *
392 * @param string $query The SQL query.
393 * @param resource|null $link_identifier The mSQL connection.
394 * If not specified, the last link opened by msql_connect
395 * is assumed. If no such link is found, the function will try to establish a
396 * link as if msql_connect was called, and use it.
397 * @return resource Returns a positive mSQL query identifier on success.
398 * @throws MsqlException
399 *
400 */
401 function msql_query(string $query, $link_identifier = null)
402 {
403 error_clear_last();
404 if ($link_identifier !== null) {
405 $result = \msql_query($query, $link_identifier);
406 } else {
407 $result = \msql_query($query);
408 }
409 if ($result === false) {
410 throw MsqlException::createFromPhpError();
411 }
412 return $result;
413 }
414
415
416 /**
417 * msql_select_db sets the current active database on
418 * the server that's associated with the specified
419 * link_identifier.
420 *
421 * Subsequent calls to msql_query will be made on the
422 * active database.
423 *
424 * @param string $database_name The database name.
425 * @param resource|null $link_identifier The mSQL connection.
426 * If not specified, the last link opened by msql_connect
427 * is assumed. If no such link is found, the function will try to establish a
428 * link as if msql_connect was called, and use it.
429 * @throws MsqlException
430 *
431 */
432 function msql_select_db(string $database_name, $link_identifier = null): void
433 {
434 error_clear_last();
435 if ($link_identifier !== null) {
436 $result = \msql_select_db($database_name, $link_identifier);
437 } else {
438 $result = \msql_select_db($database_name);
439 }
440 if ($result === false) {
441 throw MsqlException::createFromPhpError();
442 }
443 }
444