PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated / uodbc.php
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated Last commit date
Exceptions 6 days ago apache.php 6 days ago apcu.php 6 days ago array.php 6 days ago bzip2.php 6 days ago calendar.php 6 days ago classobj.php 6 days ago com.php 6 days ago cubrid.php 6 days ago curl.php 6 days ago datetime.php 6 days ago dir.php 6 days ago eio.php 6 days ago errorfunc.php 6 days ago exec.php 6 days ago fileinfo.php 6 days ago filesystem.php 6 days ago filter.php 6 days ago fpm.php 6 days ago ftp.php 6 days ago funchand.php 6 days ago functionsList.php 6 days ago gmp.php 6 days ago gnupg.php 6 days ago hash.php 6 days ago ibase.php 6 days ago ibmDb2.php 6 days ago iconv.php 6 days ago image.php 6 days ago imap.php 6 days ago info.php 6 days ago ingres-ii.php 6 days ago inotify.php 6 days ago json.php 6 days ago ldap.php 6 days ago libxml.php 6 days ago lzf.php 6 days ago mailparse.php 6 days ago mbstring.php 6 days ago misc.php 6 days ago msql.php 6 days ago mysql.php 6 days ago mysqli.php 6 days ago mysqlndMs.php 6 days ago mysqlndQc.php 6 days ago network.php 6 days ago oci8.php 6 days ago opcache.php 6 days ago openssl.php 6 days ago outcontrol.php 6 days ago password.php 6 days ago pcntl.php 6 days ago pcre.php 6 days ago pdf.php 6 days ago pgsql.php 6 days ago posix.php 6 days ago ps.php 6 days ago pspell.php 6 days ago readline.php 6 days ago rpminfo.php 6 days ago rrd.php 6 days ago sem.php 6 days ago session.php 6 days ago shmop.php 6 days ago simplexml.php 6 days ago sockets.php 6 days ago sodium.php 6 days ago solr.php 6 days ago spl.php 6 days ago sqlsrv.php 6 days ago ssdeep.php 6 days ago ssh2.php 6 days ago stream.php 6 days ago strings.php 6 days ago swoole.php 6 days ago uodbc.php 6 days ago uopz.php 6 days ago url.php 6 days ago var.php 6 days ago xdiff.php 6 days ago xml.php 6 days ago xmlrpc.php 6 days ago yaml.php 6 days ago yaz.php 6 days ago zip.php 6 days ago zlib.php 6 days ago
uodbc.php
957 lines
1 <?php
2
3 namespace ProfilePressVendor\Safe;
4
5 use ProfilePressVendor\Safe\Exceptions\UodbcException;
6 /**
7 * Toggles autocommit behaviour.
8 *
9 * By default, auto-commit is on for a connection. Disabling
10 * auto-commit is equivalent with starting a transaction.
11 *
12 * @param resource $connection_id The ODBC connection identifier,
13 * see odbc_connect for details.
14 * @param bool $OnOff If OnOff is TRUE, auto-commit is enabled, if
15 * it is FALSE auto-commit is disabled.
16 * @return mixed Without the OnOff parameter, this function returns
17 * auto-commit status for connection_id. Non-zero is
18 * returned if auto-commit is on, 0 if it is off, or FALSE if an error
19 * occurs.
20 *
21 * If OnOff is set, this function returns TRUE on
22 * success.
23 * @throws UodbcException
24 *
25 */
26 function odbc_autocommit($connection_id, bool $OnOff = \false)
27 {
28 error_clear_last();
29 $result = \odbc_autocommit($connection_id, $OnOff);
30 if ($result === \false) {
31 throw UodbcException::createFromPhpError();
32 }
33 return $result;
34 }
35 /**
36 * Controls handling of binary column data. ODBC SQL types affected are
37 * BINARY, VARBINARY, and
38 * LONGVARBINARY.
39 * The default mode can be set using the
40 * uodbc.defaultbinmode php.ini directive.
41 *
42 * When binary SQL data is converted to character C data (ODBC_BINMODE_CONVERT), each byte
43 * (8 bits) of source data is represented as two ASCII characters.
44 * These characters are the ASCII character representation of the
45 * number in its hexadecimal form. For example, a binary
46 * 00000001 is converted to
47 * "01" and a binary 11111111
48 * is converted to "FF".
49 *
50 * While the handling of BINARY and VARBINARY
51 * columns only depend on the binmode, the handling of LONGVARBINARY
52 * columns also depends on the longreadlen as well:
53 *
54 * LONGVARBINARY handling
55 *
56 *
57 *
58 * binmode
59 * longreadlen
60 * result
61 *
62 *
63 *
64 *
65 * ODBC_BINMODE_PASSTHRU
66 * 0
67 * passthru
68 *
69 *
70 * ODBC_BINMODE_RETURN
71 * 0
72 * passthru
73 *
74 *
75 * ODBC_BINMODE_CONVERT
76 * 0
77 * passthru
78 *
79 *
80 * ODBC_BINMODE_PASSTHRU
81 * &gt;0
82 * passthru
83 *
84 *
85 * ODBC_BINMODE_RETURN
86 * &gt;0
87 * return as is
88 *
89 *
90 * ODBC_BINMODE_CONVERT
91 * &gt;0
92 * return as char
93 *
94 *
95 *
96 *
97 *
98 * If odbc_fetch_into is used, passthru means that an
99 * empty string is returned for these columns.
100 * If odbc_result is used, passthru means that the data are
101 * sent directly to the client (i.e. printed).
102 *
103 * @param int $result_id The result identifier.
104 *
105 * If result_id is 0, the
106 * settings apply as default for new results.
107 * @param int $mode Possible values for mode are:
108 *
109 *
110 *
111 * ODBC_BINMODE_PASSTHRU: Passthru BINARY data
112 *
113 *
114 *
115 *
116 * ODBC_BINMODE_RETURN: Return as is
117 *
118 *
119 *
120 *
121 * ODBC_BINMODE_CONVERT: Convert to char and return
122 *
123 *
124 *
125 *
126 *
127 * Handling of binary long
128 * columns is also affected by odbc_longreadlen.
129 *
130 *
131 * @throws UodbcException
132 *
133 */
134 function odbc_binmode(int $result_id, int $mode): void
135 {
136 error_clear_last();
137 $result = \odbc_binmode($result_id, $mode);
138 if ($result === \false) {
139 throw UodbcException::createFromPhpError();
140 }
141 }
142 /**
143 * Lists columns and associated privileges for the given table.
144 *
145 * @param resource $connection_id The ODBC connection identifier,
146 * see odbc_connect for details.
147 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
148 * @param string $schema The schema ('owner' in ODBC 2 parlance).
149 * This parameter accepts the following search patterns:
150 * % to match zero or more characters,
151 * and _ to match a single character.
152 * @param string $table_name The table name.
153 * This parameter accepts the following search patterns:
154 * % to match zero or more characters,
155 * and _ to match a single character.
156 * @param string $column_name The column name.
157 * This parameter accepts the following search patterns:
158 * % to match zero or more characters,
159 * and _ to match a single character.
160 * @return resource Returns an ODBC result identifier.
161 * This result identifier can be used to fetch a list of columns and
162 * associated privileges.
163 *
164 * The result set has the following columns:
165 *
166 * TABLE_CAT
167 * TABLE_SCHEM
168 * TABLE_NAME
169 * COLUMN_NAME
170 * GRANTOR
171 * GRANTEE
172 * PRIVILEGE
173 * IS_GRANTABLE
174 *
175 * Drivers can report additional columns.
176 * @throws UodbcException
177 *
178 */
179 function odbc_columnprivileges($connection_id, string $catalog, string $schema, string $table_name, string $column_name)
180 {
181 error_clear_last();
182 $result = \odbc_columnprivileges($connection_id, $catalog, $schema, $table_name, $column_name);
183 if ($result === \false) {
184 throw UodbcException::createFromPhpError();
185 }
186 return $result;
187 }
188 /**
189 * Lists all columns in the requested range.
190 *
191 * @param resource $connection_id The ODBC connection identifier,
192 * see odbc_connect for details.
193 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
194 * @param string $schema The schema ('owner' in ODBC 2 parlance).
195 * This parameter accepts the following search patterns:
196 * % to match zero or more characters,
197 * and _ to match a single character.
198 * @param string $table_name The table name.
199 * This parameter accepts the following search patterns:
200 * % to match zero or more characters,
201 * and _ to match a single character.
202 * @param string $column_name The column name.
203 * This parameter accepts the following search patterns:
204 * % to match zero or more characters,
205 * and _ to match a single character.
206 * @return resource Returns an ODBC result identifier.
207 *
208 * The result set has the following columns:
209 *
210 * TABLE_CAT
211 * TABLE_SCHEM
212 * TABLE_NAME
213 * COLUMN_NAME
214 * DATA_TYPE
215 * TYPE_NAME
216 * COLUMN_SIZE
217 * BUFFER_LENGTH
218 * DECIMAL_DIGITS
219 * NUM_PREC_RADIX
220 * NULLABLE
221 * REMARKS
222 * COLUMN_DEF
223 * SQL_DATA_TYPE
224 * SQL_DATETIME_SUB
225 * CHAR_OCTET_LENGTH
226 * ORDINAL_POSITION
227 * IS_NULLABLE
228 *
229 * Drivers can report additional columns.
230 * @throws UodbcException
231 *
232 */
233 function odbc_columns($connection_id, string $catalog = null, string $schema = null, string $table_name = null, string $column_name = null)
234 {
235 error_clear_last();
236 if ($column_name !== null) {
237 $result = \odbc_columns($connection_id, $catalog, $schema, $table_name, $column_name);
238 } elseif ($table_name !== null) {
239 $result = \odbc_columns($connection_id, $catalog, $schema, $table_name);
240 } elseif ($schema !== null) {
241 $result = \odbc_columns($connection_id, $catalog, $schema);
242 } elseif ($catalog !== null) {
243 $result = \odbc_columns($connection_id, $catalog);
244 } else {
245 $result = \odbc_columns($connection_id);
246 }
247 if ($result === \false) {
248 throw UodbcException::createFromPhpError();
249 }
250 return $result;
251 }
252 /**
253 * Commits all pending transactions on the connection.
254 *
255 * @param resource $connection_id The ODBC connection identifier,
256 * see odbc_connect for details.
257 * @throws UodbcException
258 *
259 */
260 function odbc_commit($connection_id): void
261 {
262 error_clear_last();
263 $result = \odbc_commit($connection_id);
264 if ($result === \false) {
265 throw UodbcException::createFromPhpError();
266 }
267 }
268 /**
269 * This function will return the list of available DSN (after calling it
270 * several times).
271 *
272 * @param resource $connection_id The ODBC connection identifier,
273 * see odbc_connect for details.
274 * @param int $fetch_type The fetch_type can be one of two constant types:
275 * SQL_FETCH_FIRST, SQL_FETCH_NEXT.
276 * Use SQL_FETCH_FIRST the first time this function is
277 * called, thereafter use the SQL_FETCH_NEXT.
278 * @return array Returns FALSE on error, an array upon success, and NULL after fetching
279 * the last available DSN.
280 * @throws UodbcException
281 *
282 */
283 function odbc_data_source($connection_id, int $fetch_type): array
284 {
285 error_clear_last();
286 $result = \odbc_data_source($connection_id, $fetch_type);
287 if ($result === \false) {
288 throw UodbcException::createFromPhpError();
289 }
290 return $result;
291 }
292 /**
293 * Sends an SQL statement to the database server.
294 *
295 * @param resource $connection_id The ODBC connection identifier,
296 * see odbc_connect for details.
297 * @param string $query_string The SQL statement.
298 * @param int $flags This parameter is currently not used.
299 * @return resource Returns an ODBC result identifier if the SQL command was executed
300 * successfully.
301 * @throws UodbcException
302 *
303 */
304 function odbc_exec($connection_id, string $query_string, int $flags = null)
305 {
306 error_clear_last();
307 if ($flags !== null) {
308 $result = \odbc_exec($connection_id, $query_string, $flags);
309 } else {
310 $result = \odbc_exec($connection_id, $query_string);
311 }
312 if ($result === \false) {
313 throw UodbcException::createFromPhpError();
314 }
315 return $result;
316 }
317 /**
318 * Executes a statement prepared with odbc_prepare.
319 *
320 * @param resource $result_id The result id resource, from odbc_prepare.
321 * @param array $parameters_array Parameters in parameter_array will be
322 * substituted for placeholders in the prepared statement in order.
323 * Elements of this array will be converted to strings by calling this
324 * function.
325 *
326 * Any parameters in parameter_array which
327 * start and end with single quotes will be taken as the name of a
328 * file to read and send to the database server as the data for the
329 * appropriate placeholder.
330 * @throws UodbcException
331 *
332 */
333 function odbc_execute($result_id, array $parameters_array = null): void
334 {
335 error_clear_last();
336 if ($parameters_array !== null) {
337 $result = \odbc_execute($result_id, $parameters_array);
338 } else {
339 $result = \odbc_execute($result_id);
340 }
341 if ($result === \false) {
342 throw UodbcException::createFromPhpError();
343 }
344 }
345 /**
346 * Fetch one result row into array.
347 *
348 * @param resource $result_id The result resource.
349 * @param array|null $result_array The result array
350 * that can be of any type since it will be converted to type
351 * array. The array will contain the column values starting at array
352 * index 0.
353 * @param int $rownumber The row number.
354 * @return int Returns the number of columns in the result;
355 * FALSE on error.
356 * @throws UodbcException
357 *
358 */
359 function odbc_fetch_into($result_id, ?array &$result_array, int $rownumber = null): int
360 {
361 error_clear_last();
362 if ($rownumber !== null) {
363 $result = \odbc_fetch_into($result_id, $result_array, $rownumber);
364 } else {
365 $result = \odbc_fetch_into($result_id, $result_array);
366 }
367 if ($result === \false) {
368 throw UodbcException::createFromPhpError();
369 }
370 return $result;
371 }
372 /**
373 * Gets the length of the field referenced by number in the given result
374 * identifier.
375 *
376 * @param resource $result_id The result identifier.
377 * @param int $field_number The field number. Field numbering starts at 1.
378 * @return int Returns the field length.
379 * @throws UodbcException
380 *
381 */
382 function odbc_field_len($result_id, int $field_number): int
383 {
384 error_clear_last();
385 $result = \odbc_field_len($result_id, $field_number);
386 if ($result === \false) {
387 throw UodbcException::createFromPhpError();
388 }
389 return $result;
390 }
391 /**
392 * Gets the name of the field occupying the given column number in the given
393 * result identifier.
394 *
395 * @param resource $result_id The result identifier.
396 * @param int $field_number The field number. Field numbering starts at 1.
397 * @return string Returns the field name as a string.
398 * @throws UodbcException
399 *
400 */
401 function odbc_field_name($result_id, int $field_number): string
402 {
403 error_clear_last();
404 $result = \odbc_field_name($result_id, $field_number);
405 if ($result === \false) {
406 throw UodbcException::createFromPhpError();
407 }
408 return $result;
409 }
410 /**
411 * Gets the number of the column slot that corresponds to the named field in
412 * the given result identifier.
413 *
414 * @param resource $result_id The result identifier.
415 * @param string $field_name The field name.
416 * @return int Returns the field number as a integer.
417 * Field numbering starts at 1.
418 * @throws UodbcException
419 *
420 */
421 function odbc_field_num($result_id, string $field_name): int
422 {
423 error_clear_last();
424 $result = \odbc_field_num($result_id, $field_name);
425 if ($result === \false) {
426 throw UodbcException::createFromPhpError();
427 }
428 return $result;
429 }
430 /**
431 * Gets the scale of the field referenced by number in the given result
432 * identifier.
433 *
434 * @param resource $result_id The result identifier.
435 * @param int $field_number The field number. Field numbering starts at 1.
436 * @return int Returns the field scale as a integer.
437 * @throws UodbcException
438 *
439 */
440 function odbc_field_scale($result_id, int $field_number): int
441 {
442 error_clear_last();
443 $result = \odbc_field_scale($result_id, $field_number);
444 if ($result === \false) {
445 throw UodbcException::createFromPhpError();
446 }
447 return $result;
448 }
449 /**
450 * Gets the SQL type of the field referenced by number in the given result
451 * identifier.
452 *
453 * @param resource $result_id The result identifier.
454 * @param int $field_number The field number. Field numbering starts at 1.
455 * @return string Returns the field type as a string.
456 * @throws UodbcException
457 *
458 */
459 function odbc_field_type($result_id, int $field_number): string
460 {
461 error_clear_last();
462 $result = \odbc_field_type($result_id, $field_number);
463 if ($result === \false) {
464 throw UodbcException::createFromPhpError();
465 }
466 return $result;
467 }
468 /**
469 * Retrieves a list of foreign keys in the specified table or a list of
470 * foreign keys in other tables that refer to the primary key in the
471 * specified table
472 *
473 * @param resource $connection_id The ODBC connection identifier,
474 * see odbc_connect for details.
475 * @param string $pk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the primary key table.
476 * @param string $pk_schema The schema ('owner' in ODBC 2 parlance) of the primary key table.
477 * @param string $pk_table The primary key table.
478 * @param string $fk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the foreign key table.
479 * @param string $fk_schema The schema ('owner' in ODBC 2 parlance) of the foreign key table.
480 * @param string $fk_table The foreign key table.
481 * @return resource Returns an ODBC result identifier.
482 *
483 * The result set has the following columns:
484 *
485 * PKTABLE_CAT
486 * PKTABLE_SCHEM
487 * PKTABLE_NAME
488 * PKCOLUMN_NAME
489 * FKTABLE_CAT
490 * FKTABLE_SCHEM
491 * FKTABLE_NAME
492 * FKCOLUMN_NAME
493 * KEY_SEQ
494 * UPDATE_RULE
495 * DELETE_RULE
496 * FK_NAME
497 * PK_NAME
498 * DEFERRABILITY
499 *
500 * Drivers can report additional columns.
501 * @throws UodbcException
502 *
503 */
504 function odbc_foreignkeys($connection_id, string $pk_catalog, string $pk_schema, string $pk_table, string $fk_catalog, string $fk_schema, string $fk_table)
505 {
506 error_clear_last();
507 $result = \odbc_foreignkeys($connection_id, $pk_catalog, $pk_schema, $pk_table, $fk_catalog, $fk_schema, $fk_table);
508 if ($result === \false) {
509 throw UodbcException::createFromPhpError();
510 }
511 return $result;
512 }
513 /**
514 * Retrieves information about data types supported by the data source.
515 *
516 * @param resource $connection_id The ODBC connection identifier,
517 * see odbc_connect for details.
518 * @param int $data_type The data type, which can be used to restrict the information to a
519 * single data type.
520 * @return resource Returns an ODBC result identifier.
521 *
522 * The result set has the following columns:
523 *
524 * TYPE_NAME
525 * DATA_TYPE
526 * PRECISION
527 * LITERAL_PREFIX
528 * LITERAL_SUFFIX
529 * CREATE_PARAMS
530 * NULLABLE
531 * CASE_SENSITIVE
532 * SEARCHABLE
533 * UNSIGNED_ATTRIBUTE
534 * MONEY
535 * AUTO_INCREMENT
536 * LOCAL_TYPE_NAME
537 * MINIMUM_SCALE
538 * MAXIMUM_SCALE
539 *
540 *
541 * The result set is ordered by DATA_TYPE and TYPE_NAME.
542 * @throws UodbcException
543 *
544 */
545 function odbc_gettypeinfo($connection_id, int $data_type = null)
546 {
547 error_clear_last();
548 if ($data_type !== null) {
549 $result = \odbc_gettypeinfo($connection_id, $data_type);
550 } else {
551 $result = \odbc_gettypeinfo($connection_id);
552 }
553 if ($result === \false) {
554 throw UodbcException::createFromPhpError();
555 }
556 return $result;
557 }
558 /**
559 * Controls handling of LONG, LONGVARCHAR and LONGVARBINARY columns.
560 * The default length can be set using the
561 * uodbc.defaultlrl php.ini directive.
562 *
563 * @param resource $result_id The result identifier.
564 * @param int $length The number of bytes returned to PHP is controlled by the parameter
565 * length. If it is set to 0, long column data is passed through to the
566 * client (i.e. printed) when retrieved with odbc_result.
567 * @throws UodbcException
568 *
569 */
570 function odbc_longreadlen($result_id, int $length): void
571 {
572 error_clear_last();
573 $result = \odbc_longreadlen($result_id, $length);
574 if ($result === \false) {
575 throw UodbcException::createFromPhpError();
576 }
577 }
578 /**
579 * Prepares a statement for execution. The result identifier can be used
580 * later to execute the statement with odbc_execute.
581 *
582 * Some databases (such as IBM DB2, MS SQL Server, and Oracle) support
583 * stored procedures that accept parameters of type IN, INOUT, and OUT as
584 * defined by the ODBC specification. However, the Unified ODBC driver
585 * currently only supports parameters of type IN to stored procedures.
586 *
587 * @param resource $connection_id The ODBC connection identifier,
588 * see odbc_connect for details.
589 * @param string $query_string The query string statement being prepared.
590 * @return resource Returns an ODBC result identifier if the SQL command was prepared
591 * successfully.
592 * @throws UodbcException
593 *
594 */
595 function odbc_prepare($connection_id, string $query_string)
596 {
597 error_clear_last();
598 $result = \odbc_prepare($connection_id, $query_string);
599 if ($result === \false) {
600 throw UodbcException::createFromPhpError();
601 }
602 return $result;
603 }
604 /**
605 * Returns a result identifier that can be used to fetch the column names
606 * that comprise the primary key for a table.
607 *
608 * @param resource $connection_id The ODBC connection identifier,
609 * see odbc_connect for details.
610 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
611 * @param string $schema The schema ('owner' in ODBC 2 parlance).
612 * @param string $table
613 * @return resource Returns an ODBC result identifier.
614 *
615 * The result set has the following columns:
616 *
617 * TABLE_CAT
618 * TABLE_SCHEM
619 * TABLE_NAME
620 * COLUMN_NAME
621 * KEY_SEQ
622 * PK_NAME
623 *
624 * Drivers can report additional columns.
625 * @throws UodbcException
626 *
627 */
628 function odbc_primarykeys($connection_id, string $catalog, string $schema, string $table)
629 {
630 error_clear_last();
631 $result = \odbc_primarykeys($connection_id, $catalog, $schema, $table);
632 if ($result === \false) {
633 throw UodbcException::createFromPhpError();
634 }
635 return $result;
636 }
637 /**
638 * Prints all rows from a result identifier produced by
639 * odbc_exec. The result is printed in HTML table format.
640 * The data is not escaped.
641 *
642 * This function is not supposed to be used in production environments; it is
643 * merely meant for development purposes, to get a result set quickly rendered.
644 *
645 * @param resource $result_id The result identifier.
646 * @param string $format Additional overall table formatting.
647 * @return int Returns the number of rows in the result.
648 * @throws UodbcException
649 *
650 */
651 function odbc_result_all($result_id, string $format = null): int
652 {
653 error_clear_last();
654 if ($format !== null) {
655 $result = \odbc_result_all($result_id, $format);
656 } else {
657 $result = \odbc_result_all($result_id);
658 }
659 if ($result === \false) {
660 throw UodbcException::createFromPhpError();
661 }
662 return $result;
663 }
664 /**
665 * Get result data
666 *
667 * @param resource $result_id The ODBC resource.
668 * @param mixed $field The field name being retrieved. It can either be an integer containing
669 * the column number of the field you want; or it can be a string
670 * containing the name of the field.
671 * @return mixed Returns the string contents of the field, FALSE on error, NULL for
672 * NULL data, or TRUE for binary data.
673 * @throws UodbcException
674 *
675 */
676 function odbc_result($result_id, $field)
677 {
678 error_clear_last();
679 $result = \odbc_result($result_id, $field);
680 if ($result === \false) {
681 throw UodbcException::createFromPhpError();
682 }
683 return $result;
684 }
685 /**
686 * Rolls back all pending statements on the connection.
687 *
688 * @param resource $connection_id The ODBC connection identifier,
689 * see odbc_connect for details.
690 * @throws UodbcException
691 *
692 */
693 function odbc_rollback($connection_id): void
694 {
695 error_clear_last();
696 $result = \odbc_rollback($connection_id);
697 if ($result === \false) {
698 throw UodbcException::createFromPhpError();
699 }
700 }
701 /**
702 * This function allows fiddling with the ODBC options for a
703 * particular connection or query result. It was written to help
704 * find work around to problems in quirky ODBC drivers. You should
705 * probably only use this function if you are an ODBC programmer and
706 * understand the effects the various options will have. You will
707 * certainly need a good ODBC reference to explain all the different
708 * options and values that can be used. Different driver versions
709 * support different options.
710 *
711 * Because the effects may vary depending on the ODBC driver, use of
712 * this function in scripts to be made publicly available is
713 * strongly discouraged. Also, some ODBC options are not available
714 * to this function because they must be set before the connection
715 * is established or the query is prepared. However, if on a
716 * particular job it can make PHP work so your boss doesn't tell you
717 * to use a commercial product, that's all that really
718 * matters.
719 *
720 * @param resource $id Is a connection id or result id on which to change the settings.
721 * For SQLSetConnectOption(), this is a connection id.
722 * For SQLSetStmtOption(), this is a result id.
723 * @param int $function Is the ODBC function to use. The value should be
724 * 1 for SQLSetConnectOption() and
725 * 2 for SQLSetStmtOption().
726 * @param int $option The option to set.
727 * @param int $param The value for the given option.
728 * @throws UodbcException
729 *
730 */
731 function odbc_setoption($id, int $function, int $option, int $param): void
732 {
733 error_clear_last();
734 $result = \odbc_setoption($id, $function, $option, $param);
735 if ($result === \false) {
736 throw UodbcException::createFromPhpError();
737 }
738 }
739 /**
740 * Retrieves either the optimal set of columns that uniquely identifies a
741 * row in the table, or columns that are automatically updated when any
742 * value in the row is updated by a transaction.
743 *
744 * @param resource $connection_id The ODBC connection identifier,
745 * see odbc_connect for details.
746 * @param int $type
747 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
748 * @param string $schema The schema ('owner' in ODBC 2 parlance).
749 * @param string $table The table.
750 * @param int $scope The scope, which orders the result set.
751 * One of SQL_SCOPE_CURROW, SQL_SCOPE_TRANSACTION
752 * or SQL_SCOPE_SESSION.
753 * @param int $nullable Determines whether to return special columns that can have a NULL value.
754 * One of SQL_NO_NULLS or SQL_NULLABLE .
755 * @return resource Returns an ODBC result identifier.
756 *
757 * The result set has the following columns:
758 *
759 * SCOPE
760 * COLUMN_NAME
761 * DATA_TYPE
762 * TYPE_NAME
763 * COLUMN_SIZE
764 * BUFFER_LENGTH
765 * DECIMAL_DIGITS
766 * PSEUDO_COLUMN
767 *
768 * Drivers can report additional columns.
769 * @throws UodbcException
770 *
771 */
772 function odbc_specialcolumns($connection_id, int $type, string $catalog, string $schema, string $table, int $scope, int $nullable)
773 {
774 error_clear_last();
775 $result = \odbc_specialcolumns($connection_id, $type, $catalog, $schema, $table, $scope, $nullable);
776 if ($result === \false) {
777 throw UodbcException::createFromPhpError();
778 }
779 return $result;
780 }
781 /**
782 * Get statistics about a table and its indexes.
783 *
784 * @param resource $connection_id The ODBC connection identifier,
785 * see odbc_connect for details.
786 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
787 * @param string $schema The schema ('owner' in ODBC 2 parlance).
788 * @param string $table_name The table name.
789 * @param int $unique The type of the index.
790 * One of SQL_INDEX_UNIQUE or SQL_INDEX_ALL.
791 * @param int $accuracy One of SQL_ENSURE or SQL_QUICK.
792 * The latter requests that the driver retrieve the CARDINALITY and
793 * PAGES only if they are readily available from the server.
794 * @return resource Returns an ODBC result identifier.
795 *
796 * The result set has the following columns:
797 *
798 * TABLE_CAT
799 * TABLE_SCHEM
800 * TABLE_NAME
801 * NON_UNIQUE
802 * INDEX_QUALIFIER
803 * INDEX_NAME
804 * TYPE
805 * ORDINAL_POSITION
806 * COLUMN_NAME
807 * ASC_OR_DESC
808 * CARDINALITY
809 * PAGES
810 * FILTER_CONDITION
811 *
812 * Drivers can report additional columns.
813 * @throws UodbcException
814 *
815 */
816 function odbc_statistics($connection_id, string $catalog, string $schema, string $table_name, int $unique, int $accuracy)
817 {
818 error_clear_last();
819 $result = \odbc_statistics($connection_id, $catalog, $schema, $table_name, $unique, $accuracy);
820 if ($result === \false) {
821 throw UodbcException::createFromPhpError();
822 }
823 return $result;
824 }
825 /**
826 * Lists tables in the requested range and the privileges associated
827 * with each table.
828 *
829 * @param resource $connection_id The ODBC connection identifier,
830 * see odbc_connect for details.
831 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
832 * @param string $schema The schema ('owner' in ODBC 2 parlance).
833 * This parameter accepts the following search patterns:
834 * % to match zero or more characters,
835 * and _ to match a single character.
836 * @param string $name The name.
837 * This parameter accepts the following search patterns:
838 * % to match zero or more characters,
839 * and _ to match a single character.
840 * @return resource An ODBC result identifier.
841 *
842 * The result set has the following columns:
843 *
844 * TABLE_CAT
845 * TABLE_SCHEM
846 * TABLE_NAME
847 * GRANTOR
848 * GRANTEE
849 * PRIVILEGE
850 * IS_GRANTABLE
851 *
852 * Drivers can report additional columns.
853 * @throws UodbcException
854 *
855 */
856 function odbc_tableprivileges($connection_id, string $catalog, string $schema, string $name)
857 {
858 error_clear_last();
859 $result = \odbc_tableprivileges($connection_id, $catalog, $schema, $name);
860 if ($result === \false) {
861 throw UodbcException::createFromPhpError();
862 }
863 return $result;
864 }
865 /**
866 * Lists all tables in the requested range.
867 *
868 * To support enumeration of qualifiers, owners, and table types,
869 * the following special semantics for the
870 * catalog, schema,
871 * name, and
872 * table_type are available:
873 *
874 *
875 *
876 * If catalog is a single percent
877 * character (%) and schema and
878 * name are empty strings, then the result
879 * set contains a list of valid qualifiers for the data
880 * source. (All columns except the TABLE_QUALIFIER column contain
881 * NULLs.)
882 *
883 *
884 *
885 *
886 * If schema is a single percent character
887 * (%) and catalog and
888 * name are empty strings, then the result
889 * set contains a list of valid owners for the data source. (All
890 * columns except the TABLE_OWNER column contain
891 * NULLs.)
892 *
893 *
894 *
895 *
896 * If table_type is a single percent
897 * character (%) and catalog,
898 * schema and name
899 * are empty strings, then the result set contains a list of
900 * valid table types for the data source. (All columns except the
901 * TABLE_TYPE column contain NULLs.)
902 *
903 *
904 *
905 *
906 * @param resource $connection_id The ODBC connection identifier,
907 * see odbc_connect for details.
908 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
909 * @param string $schema The schema ('owner' in ODBC 2 parlance).
910 * This parameter accepts the following search patterns:
911 * % to match zero or more characters,
912 * and _ to match a single character.
913 * @param string $name The name.
914 * This parameter accepts the following search patterns:
915 * % to match zero or more characters,
916 * and _ to match a single character.
917 * @param string $types If table_type is not an empty string, it
918 * must contain a list of comma-separated values for the types of
919 * interest; each value may be enclosed in single quotes (') or
920 * unquoted. For example, 'TABLE','VIEW' or TABLE, VIEW. If the
921 * data source does not support a specified table type,
922 * odbc_tables does not return any results for
923 * that type.
924 * @return resource Returns an ODBC result identifier containing the information.
925 *
926 * The result set has the following columns:
927 *
928 * TABLE_CAT
929 * TABLE_SCHEM
930 * TABLE_NAME
931 * TABLE_TYPE
932 * REMARKS
933 *
934 * Drivers can report additional columns.
935 * @throws UodbcException
936 *
937 */
938 function odbc_tables($connection_id, string $catalog = null, string $schema = null, string $name = null, string $types = null)
939 {
940 error_clear_last();
941 if ($types !== null) {
942 $result = \odbc_tables($connection_id, $catalog, $schema, $name, $types);
943 } elseif ($name !== null) {
944 $result = \odbc_tables($connection_id, $catalog, $schema, $name);
945 } elseif ($schema !== null) {
946 $result = \odbc_tables($connection_id, $catalog, $schema);
947 } elseif ($catalog !== null) {
948 $result = \odbc_tables($connection_id, $catalog);
949 } else {
950 $result = \odbc_tables($connection_id);
951 }
952 if ($result === \false) {
953 throw UodbcException::createFromPhpError();
954 }
955 return $result;
956 }
957