PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.0.0
Defender Security – Malware Scanner, Login Security & Firewall v6.0.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 / uodbc.php

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

1,017 lines 28.6 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\UodbcException;
6
7 /**
8 * Toggles autocommit behaviour.
9 *
10 * By default, auto-commit is on for a connection. Disabling
11 * auto-commit is equivalent with starting a transaction.
12 *
13 * @param resource $connection_id The ODBC connection identifier,
14 * see odbc_connect for details.
15 * @param bool $OnOff If OnOff is TRUE, auto-commit is enabled, if
16 * it is FALSE auto-commit is disabled.
17 * @return mixed Without the OnOff parameter, this function returns
18 * auto-commit status for connection_id. Non-zero is
19 * returned if auto-commit is on, 0 if it is off, or FALSE if an error
20 * occurs.
21 *
22 * If OnOff is set, this function returns TRUE on
23 * success.
24 * @throws UodbcException
25 *
26 */
27 function odbc_autocommit($connection_id, bool $OnOff = false)
28 {
29 error_clear_last();
30 $result = \odbc_autocommit($connection_id, $OnOff);
31 if ($result === false) {
32 throw UodbcException::createFromPhpError();
33 }
34 return $result;
35 }
36
37
38 /**
39 * Controls handling of binary column data. ODBC SQL types affected are
40 * BINARY, VARBINARY, and
41 * LONGVARBINARY.
42 * The default mode can be set using the
43 * uodbc.defaultbinmode php.ini directive.
44 *
45 * When binary SQL data is converted to character C data (ODBC_BINMODE_CONVERT), each byte
46 * (8 bits) of source data is represented as two ASCII characters.
47 * These characters are the ASCII character representation of the
48 * number in its hexadecimal form. For example, a binary
49 * 00000001 is converted to
50 * "01" and a binary 11111111
51 * is converted to "FF".
52 *
53 * While the handling of BINARY and VARBINARY
54 * columns only depend on the binmode, the handling of LONGVARBINARY
55 * columns also depends on the longreadlen as well:
56 *
57 * LONGVARBINARY handling
58 *
59 *
60 *
61 * binmode
62 * longreadlen
63 * result
64 *
65 *
66 *
67 *
68 * ODBC_BINMODE_PASSTHRU
69 * 0
70 * passthru
71 *
72 *
73 * ODBC_BINMODE_RETURN
74 * 0
75 * passthru
76 *
77 *
78 * ODBC_BINMODE_CONVERT
79 * 0
80 * passthru
81 *
82 *
83 * ODBC_BINMODE_PASSTHRU
84 * &gt;0
85 * passthru
86 *
87 *
88 * ODBC_BINMODE_RETURN
89 * &gt;0
90 * return as is
91 *
92 *
93 * ODBC_BINMODE_CONVERT
94 * &gt;0
95 * return as char
96 *
97 *
98 *
99 *
100 *
101 * If odbc_fetch_into is used, passthru means that an
102 * empty string is returned for these columns.
103 * If odbc_result is used, passthru means that the data are
104 * sent directly to the client (i.e. printed).
105 *
106 * @param int $result_id The result identifier.
107 *
108 * If result_id is 0, the
109 * settings apply as default for new results.
110 * @param int $mode Possible values for mode are:
111 *
112 *
113 *
114 * ODBC_BINMODE_PASSTHRU: Passthru BINARY data
115 *
116 *
117 *
118 *
119 * ODBC_BINMODE_RETURN: Return as is
120 *
121 *
122 *
123 *
124 * ODBC_BINMODE_CONVERT: Convert to char and return
125 *
126 *
127 *
128 *
129 *
130 * Handling of binary long
131 * columns is also affected by odbc_longreadlen.
132 *
133 *
134 * @throws UodbcException
135 *
136 */
137 function odbc_binmode(int $result_id, int $mode): void
138 {
139 error_clear_last();
140 $result = \odbc_binmode($result_id, $mode);
141 if ($result === false) {
142 throw UodbcException::createFromPhpError();
143 }
144 }
145
146
147 /**
148 * Lists columns and associated privileges for the given table.
149 *
150 * @param resource $connection_id The ODBC connection identifier,
151 * see odbc_connect for details.
152 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
153 * @param string $schema The schema ('owner' in ODBC 2 parlance).
154 * This parameter accepts the following search patterns:
155 * % to match zero or more characters,
156 * and _ to match a single character.
157 * @param string $table_name The table name.
158 * This parameter accepts the following search patterns:
159 * % to match zero or more characters,
160 * and _ to match a single character.
161 * @param string $column_name The column name.
162 * This parameter accepts the following search patterns:
163 * % to match zero or more characters,
164 * and _ to match a single character.
165 * @return resource Returns an ODBC result identifier.
166 * This result identifier can be used to fetch a list of columns and
167 * associated privileges.
168 *
169 * The result set has the following columns:
170 *
171 * TABLE_CAT
172 * TABLE_SCHEM
173 * TABLE_NAME
174 * COLUMN_NAME
175 * GRANTOR
176 * GRANTEE
177 * PRIVILEGE
178 * IS_GRANTABLE
179 *
180 * Drivers can report additional columns.
181 * @throws UodbcException
182 *
183 */
184 function odbc_columnprivileges($connection_id, string $catalog, string $schema, string $table_name, string $column_name)
185 {
186 error_clear_last();
187 $result = \odbc_columnprivileges($connection_id, $catalog, $schema, $table_name, $column_name);
188 if ($result === false) {
189 throw UodbcException::createFromPhpError();
190 }
191 return $result;
192 }
193
194
195 /**
196 * Lists all columns in the requested range.
197 *
198 * @param resource $connection_id The ODBC connection identifier,
199 * see odbc_connect for details.
200 * @param string|null $catalog The catalog ('qualifier' in ODBC 2 parlance).
201 * @param string|null $schema The schema ('owner' in ODBC 2 parlance).
202 * This parameter accepts the following search patterns:
203 * % to match zero or more characters,
204 * and _ to match a single character.
205 * @param string|null $table_name The table name.
206 * This parameter accepts the following search patterns:
207 * % to match zero or more characters,
208 * and _ to match a single character.
209 * @param string|null $column_name The column name.
210 * This parameter accepts the following search patterns:
211 * % to match zero or more characters,
212 * and _ to match a single character.
213 *
214 * @return resource Returns an ODBC result identifier.
215 *
216 * The result set has the following columns:
217 *
218 * TABLE_CAT
219 * TABLE_SCHEM
220 * TABLE_NAME
221 * COLUMN_NAME
222 * DATA_TYPE
223 * TYPE_NAME
224 * COLUMN_SIZE
225 * BUFFER_LENGTH
226 * DECIMAL_DIGITS
227 * NUM_PREC_RADIX
228 * NULLABLE
229 * REMARKS
230 * COLUMN_DEF
231 * SQL_DATA_TYPE
232 * SQL_DATETIME_SUB
233 * CHAR_OCTET_LENGTH
234 * ORDINAL_POSITION
235 * IS_NULLABLE
236 *
237 * Drivers can report additional columns.
238 * @throws UodbcException
239 *
240 */
241 function odbc_columns($connection_id, ?string $catalog = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null)
242 {
243 error_clear_last();
244 if ($column_name !== null) {
245 $result = \odbc_columns($connection_id, $catalog, $schema, $table_name, $column_name);
246 } elseif ($table_name !== null) {
247 $result = \odbc_columns($connection_id, $catalog, $schema, $table_name);
248 } elseif ($schema !== null) {
249 $result = \odbc_columns($connection_id, $catalog, $schema);
250 } elseif ($catalog !== null) {
251 $result = \odbc_columns($connection_id, $catalog);
252 } else {
253 $result = \odbc_columns($connection_id);
254 }
255 if ($result === false) {
256 throw UodbcException::createFromPhpError();
257 }
258 return $result;
259 }
260
261
262 /**
263 * Commits all pending transactions on the connection.
264 *
265 * @param resource $connection_id The ODBC connection identifier,
266 * see odbc_connect for details.
267 * @throws UodbcException
268 *
269 */
270 function odbc_commit($connection_id): void
271 {
272 error_clear_last();
273 $result = \odbc_commit($connection_id);
274 if ($result === false) {
275 throw UodbcException::createFromPhpError();
276 }
277 }
278
279
280 /**
281 * This function will return the list of available DSN (after calling it
282 * several times).
283 *
284 * @param resource $connection_id The ODBC connection identifier,
285 * see odbc_connect for details.
286 * @param int $fetch_type The fetch_type can be one of two constant types:
287 * SQL_FETCH_FIRST, SQL_FETCH_NEXT.
288 * Use SQL_FETCH_FIRST the first time this function is
289 * called, thereafter use the SQL_FETCH_NEXT.
290 * @return array Returns FALSE on error, an array upon success, and NULL after fetching
291 * the last available DSN.
292 * @throws UodbcException
293 *
294 */
295 function odbc_data_source($connection_id, int $fetch_type): array
296 {
297 error_clear_last();
298 $result = \odbc_data_source($connection_id, $fetch_type);
299 if ($result === false) {
300 throw UodbcException::createFromPhpError();
301 }
302 return $result;
303 }
304
305
306 /**
307 * Sends an SQL statement to the database server.
308 *
309 * @param resource $connection_id The ODBC connection identifier,
310 * see odbc_connect for details.
311 * @param string $query_string The SQL statement.
312 * @param int|null $flags This parameter is currently not used.
313 *
314 * @return resource Returns an ODBC result identifier if the SQL command was executed
315 * successfully.
316 * @throws UodbcException
317 *
318 */
319 function odbc_exec($connection_id, string $query_string, ?int $flags = null)
320 {
321 error_clear_last();
322 if ($flags !== null) {
323 $result = \odbc_exec($connection_id, $query_string, $flags);
324 } else {
325 $result = \odbc_exec($connection_id, $query_string);
326 }
327 if ($result === false) {
328 throw UodbcException::createFromPhpError();
329 }
330 return $result;
331 }
332
333
334 /**
335 * Executes a statement prepared with odbc_prepare.
336 *
337 * @param resource $result_id The result id resource, from odbc_prepare.
338 * @param array|null $parameters_array Parameters in parameter_array will be
339 * substituted for placeholders in the prepared statement in order.
340 * Elements of this array will be converted to strings by calling this
341 * function.
342 *
343 * Any parameters in parameter_array which
344 * start and end with single quotes will be taken as the name of a
345 * file to read and send to the database server as the data for the
346 * appropriate placeholder.
347 *
348 * @throws UodbcException
349 *
350 */
351 function odbc_execute($result_id, ?array $parameters_array = null): void
352 {
353 error_clear_last();
354 if ($parameters_array !== null) {
355 $result = \odbc_execute($result_id, $parameters_array);
356 } else {
357 $result = \odbc_execute($result_id);
358 }
359 if ($result === false) {
360 throw UodbcException::createFromPhpError();
361 }
362 }
363
364
365 /**
366 * Fetch one result row into array.
367 *
368 * @param resource $result_id The result resource.
369 * @param array|null $result_array The result array
370 * that can be of any type since it will be converted to type
371 * array. The array will contain the column values starting at array
372 * index 0.
373 * @param int|null $rownumber The row number.
374 *
375 * @return int Returns the number of columns in the result;
376 * FALSE on error.
377 * @throws UodbcException
378 *
379 */
380 function odbc_fetch_into($result_id, ?array &$result_array, ?int $rownumber = null): int
381 {
382 error_clear_last();
383 if ($rownumber !== null) {
384 $result = \odbc_fetch_into($result_id, $result_array, $rownumber);
385 } else {
386 $result = \odbc_fetch_into($result_id, $result_array);
387 }
388 if ($result === false) {
389 throw UodbcException::createFromPhpError();
390 }
391 return $result;
392 }
393
394
395 /**
396 * Gets the length of the field referenced by number in the given result
397 * identifier.
398 *
399 * @param resource $result_id The result identifier.
400 * @param int $field_number The field number. Field numbering starts at 1.
401 * @return int Returns the field length.
402 * @throws UodbcException
403 *
404 */
405 function odbc_field_len($result_id, int $field_number): int
406 {
407 error_clear_last();
408 $result = \odbc_field_len($result_id, $field_number);
409 if ($result === false) {
410 throw UodbcException::createFromPhpError();
411 }
412 return $result;
413 }
414
415
416 /**
417 * Gets the name of the field occupying the given column number in the given
418 * result identifier.
419 *
420 * @param resource $result_id The result identifier.
421 * @param int $field_number The field number. Field numbering starts at 1.
422 * @return string Returns the field name as a string.
423 * @throws UodbcException
424 *
425 */
426 function odbc_field_name($result_id, int $field_number): string
427 {
428 error_clear_last();
429 $result = \odbc_field_name($result_id, $field_number);
430 if ($result === false) {
431 throw UodbcException::createFromPhpError();
432 }
433 return $result;
434 }
435
436
437 /**
438 * Gets the number of the column slot that corresponds to the named field in
439 * the given result identifier.
440 *
441 * @param resource $result_id The result identifier.
442 * @param string $field_name The field name.
443 * @return int Returns the field number as a integer.
444 * Field numbering starts at 1.
445 * @throws UodbcException
446 *
447 */
448 function odbc_field_num($result_id, string $field_name): int
449 {
450 error_clear_last();
451 $result = \odbc_field_num($result_id, $field_name);
452 if ($result === false) {
453 throw UodbcException::createFromPhpError();
454 }
455 return $result;
456 }
457
458
459 /**
460 * Gets the scale of the field referenced by number in the given result
461 * identifier.
462 *
463 * @param resource $result_id The result identifier.
464 * @param int $field_number The field number. Field numbering starts at 1.
465 * @return int Returns the field scale as a integer.
466 * @throws UodbcException
467 *
468 */
469 function odbc_field_scale($result_id, int $field_number): int
470 {
471 error_clear_last();
472 $result = \odbc_field_scale($result_id, $field_number);
473 if ($result === false) {
474 throw UodbcException::createFromPhpError();
475 }
476 return $result;
477 }
478
479
480 /**
481 * Gets the SQL type of the field referenced by number in the given result
482 * identifier.
483 *
484 * @param resource $result_id The result identifier.
485 * @param int $field_number The field number. Field numbering starts at 1.
486 * @return string Returns the field type as a string.
487 * @throws UodbcException
488 *
489 */
490 function odbc_field_type($result_id, int $field_number): string
491 {
492 error_clear_last();
493 $result = \odbc_field_type($result_id, $field_number);
494 if ($result === false) {
495 throw UodbcException::createFromPhpError();
496 }
497 return $result;
498 }
499
500
501 /**
502 * Retrieves a list of foreign keys in the specified table or a list of
503 * foreign keys in other tables that refer to the primary key in the
504 * specified table
505 *
506 * @param resource $connection_id The ODBC connection identifier,
507 * see odbc_connect for details.
508 * @param string $pk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the primary key table.
509 * @param string $pk_schema The schema ('owner' in ODBC 2 parlance) of the primary key table.
510 * @param string $pk_table The primary key table.
511 * @param string $fk_catalog The catalog ('qualifier' in ODBC 2 parlance) of the foreign key table.
512 * @param string $fk_schema The schema ('owner' in ODBC 2 parlance) of the foreign key table.
513 * @param string $fk_table The foreign key table.
514 * @return resource Returns an ODBC result identifier.
515 *
516 * The result set has the following columns:
517 *
518 * PKTABLE_CAT
519 * PKTABLE_SCHEM
520 * PKTABLE_NAME
521 * PKCOLUMN_NAME
522 * FKTABLE_CAT
523 * FKTABLE_SCHEM
524 * FKTABLE_NAME
525 * FKCOLUMN_NAME
526 * KEY_SEQ
527 * UPDATE_RULE
528 * DELETE_RULE
529 * FK_NAME
530 * PK_NAME
531 * DEFERRABILITY
532 *
533 * Drivers can report additional columns.
534 * @throws UodbcException
535 *
536 */
537 function odbc_foreignkeys($connection_id, string $pk_catalog, string $pk_schema, string $pk_table, string $fk_catalog, string $fk_schema, string $fk_table)
538 {
539 error_clear_last();
540 $result = \odbc_foreignkeys($connection_id, $pk_catalog, $pk_schema, $pk_table, $fk_catalog, $fk_schema, $fk_table);
541 if ($result === false) {
542 throw UodbcException::createFromPhpError();
543 }
544 return $result;
545 }
546
547
548 /**
549 * Retrieves information about data types supported by the data source.
550 *
551 * @param resource $connection_id The ODBC connection identifier,
552 * see odbc_connect for details.
553 * @param int|null $data_type The data type, which can be used to restrict the information to a
554 * single data type.
555 *
556 * @return resource Returns an ODBC result identifier.
557 *
558 * The result set has the following columns:
559 *
560 * TYPE_NAME
561 * DATA_TYPE
562 * PRECISION
563 * LITERAL_PREFIX
564 * LITERAL_SUFFIX
565 * CREATE_PARAMS
566 * NULLABLE
567 * CASE_SENSITIVE
568 * SEARCHABLE
569 * UNSIGNED_ATTRIBUTE
570 * MONEY
571 * AUTO_INCREMENT
572 * LOCAL_TYPE_NAME
573 * MINIMUM_SCALE
574 * MAXIMUM_SCALE
575 *
576 *
577 * The result set is ordered by DATA_TYPE and TYPE_NAME.
578 * @throws UodbcException
579 *
580 */
581 function odbc_gettypeinfo($connection_id, ?int $data_type = null)
582 {
583 error_clear_last();
584 if ($data_type !== null) {
585 $result = \odbc_gettypeinfo($connection_id, $data_type);
586 } else {
587 $result = \odbc_gettypeinfo($connection_id);
588 }
589 if ($result === false) {
590 throw UodbcException::createFromPhpError();
591 }
592 return $result;
593 }
594
595
596 /**
597 * Controls handling of LONG, LONGVARCHAR and LONGVARBINARY columns.
598 * The default length can be set using the
599 * uodbc.defaultlrl php.ini directive.
600 *
601 * @param resource $result_id The result identifier.
602 * @param int $length The number of bytes returned to PHP is controlled by the parameter
603 * length. If it is set to 0, long column data is passed through to the
604 * client (i.e. printed) when retrieved with odbc_result.
605 * @throws UodbcException
606 *
607 */
608 function odbc_longreadlen($result_id, int $length): void
609 {
610 error_clear_last();
611 $result = \odbc_longreadlen($result_id, $length);
612 if ($result === false) {
613 throw UodbcException::createFromPhpError();
614 }
615 }
616
617
618 /**
619 * Prepares a statement for execution. The result identifier can be used
620 * later to execute the statement with odbc_execute.
621 *
622 * Some databases (such as IBM DB2, MS SQL Server, and Oracle) support
623 * stored procedures that accept parameters of type IN, INOUT, and OUT as
624 * defined by the ODBC specification. However, the Unified ODBC driver
625 * currently only supports parameters of type IN to stored procedures.
626 *
627 * @param resource $connection_id The ODBC connection identifier,
628 * see odbc_connect for details.
629 * @param string $query_string The query string statement being prepared.
630 * @return resource Returns an ODBC result identifier if the SQL command was prepared
631 * successfully.
632 * @throws UodbcException
633 *
634 */
635 function odbc_prepare($connection_id, string $query_string)
636 {
637 error_clear_last();
638 $result = \odbc_prepare($connection_id, $query_string);
639 if ($result === false) {
640 throw UodbcException::createFromPhpError();
641 }
642 return $result;
643 }
644
645
646 /**
647 * Returns a result identifier that can be used to fetch the column names
648 * that comprise the primary key for a table.
649 *
650 * @param resource $connection_id The ODBC connection identifier,
651 * see odbc_connect for details.
652 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
653 * @param string $schema The schema ('owner' in ODBC 2 parlance).
654 * @param string $table
655 * @return resource Returns an ODBC result identifier.
656 *
657 * The result set has the following columns:
658 *
659 * TABLE_CAT
660 * TABLE_SCHEM
661 * TABLE_NAME
662 * COLUMN_NAME
663 * KEY_SEQ
664 * PK_NAME
665 *
666 * Drivers can report additional columns.
667 * @throws UodbcException
668 *
669 */
670 function odbc_primarykeys($connection_id, string $catalog, string $schema, string $table)
671 {
672 error_clear_last();
673 $result = \odbc_primarykeys($connection_id, $catalog, $schema, $table);
674 if ($result === false) {
675 throw UodbcException::createFromPhpError();
676 }
677 return $result;
678 }
679
680
681 /**
682 * Prints all rows from a result identifier produced by
683 * odbc_exec. The result is printed in HTML table format.
684 * The data is not escaped.
685 *
686 * This function is not supposed to be used in production environments; it is
687 * merely meant for development purposes, to get a result set quickly rendered.
688 *
689 * @param resource $result_id The result identifier.
690 * @param string|null $format Additional overall table formatting.
691 *
692 * @return int Returns the number of rows in the result.
693 * @throws UodbcException
694 *
695 */
696 function odbc_result_all($result_id, ?string $format = null): int
697 {
698 error_clear_last();
699 if ($format !== null) {
700 $result = \odbc_result_all($result_id, $format);
701 } else {
702 $result = \odbc_result_all($result_id);
703 }
704 if ($result === false) {
705 throw UodbcException::createFromPhpError();
706 }
707 return $result;
708 }
709
710
711 /**
712 * Get result data
713 *
714 * @param resource $result_id The ODBC resource.
715 * @param mixed $field The field name being retrieved. It can either be an integer containing
716 * the column number of the field you want; or it can be a string
717 * containing the name of the field.
718 * @return mixed Returns the string contents of the field, FALSE on error, NULL for
719 * NULL data, or TRUE for binary data.
720 * @throws UodbcException
721 *
722 */
723 function odbc_result($result_id, $field)
724 {
725 error_clear_last();
726 $result = \odbc_result($result_id, $field);
727 if ($result === false) {
728 throw UodbcException::createFromPhpError();
729 }
730 return $result;
731 }
732
733
734 /**
735 * Rolls back all pending statements on the connection.
736 *
737 * @param resource $connection_id The ODBC connection identifier,
738 * see odbc_connect for details.
739 * @throws UodbcException
740 *
741 */
742 function odbc_rollback($connection_id): void
743 {
744 error_clear_last();
745 $result = \odbc_rollback($connection_id);
746 if ($result === false) {
747 throw UodbcException::createFromPhpError();
748 }
749 }
750
751
752 /**
753 * This function allows fiddling with the ODBC options for a
754 * particular connection or query result. It was written to help
755 * find work around to problems in quirky ODBC drivers. You should
756 * probably only use this function if you are an ODBC programmer and
757 * understand the effects the various options will have. You will
758 * certainly need a good ODBC reference to explain all the different
759 * options and values that can be used. Different driver versions
760 * support different options.
761 *
762 * Because the effects may vary depending on the ODBC driver, use of
763 * this function in scripts to be made publicly available is
764 * strongly discouraged. Also, some ODBC options are not available
765 * to this function because they must be set before the connection
766 * is established or the query is prepared. However, if on a
767 * particular job it can make PHP work so your boss doesn't tell you
768 * to use a commercial product, that's all that really
769 * matters.
770 *
771 * @param resource $id Is a connection id or result id on which to change the settings.
772 * For SQLSetConnectOption(), this is a connection id.
773 * For SQLSetStmtOption(), this is a result id.
774 * @param int $function Is the ODBC function to use. The value should be
775 * 1 for SQLSetConnectOption() and
776 * 2 for SQLSetStmtOption().
777 * @param int $option The option to set.
778 * @param int $param The value for the given option.
779 * @throws UodbcException
780 *
781 */
782 function odbc_setoption($id, int $function, int $option, int $param): void
783 {
784 error_clear_last();
785 $result = \odbc_setoption($id, $function, $option, $param);
786 if ($result === false) {
787 throw UodbcException::createFromPhpError();
788 }
789 }
790
791
792 /**
793 * Retrieves either the optimal set of columns that uniquely identifies a
794 * row in the table, or columns that are automatically updated when any
795 * value in the row is updated by a transaction.
796 *
797 * @param resource $connection_id The ODBC connection identifier,
798 * see odbc_connect for details.
799 * @param int $type
800 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
801 * @param string $schema The schema ('owner' in ODBC 2 parlance).
802 * @param string $table The table.
803 * @param int $scope The scope, which orders the result set.
804 * One of SQL_SCOPE_CURROW, SQL_SCOPE_TRANSACTION
805 * or SQL_SCOPE_SESSION.
806 * @param int $nullable Determines whether to return special columns that can have a NULL value.
807 * One of SQL_NO_NULLS or SQL_NULLABLE .
808 * @return resource Returns an ODBC result identifier.
809 *
810 * The result set has the following columns:
811 *
812 * SCOPE
813 * COLUMN_NAME
814 * DATA_TYPE
815 * TYPE_NAME
816 * COLUMN_SIZE
817 * BUFFER_LENGTH
818 * DECIMAL_DIGITS
819 * PSEUDO_COLUMN
820 *
821 * Drivers can report additional columns.
822 * @throws UodbcException
823 *
824 */
825 function odbc_specialcolumns($connection_id, int $type, string $catalog, string $schema, string $table, int $scope, int $nullable)
826 {
827 error_clear_last();
828 $result = \odbc_specialcolumns($connection_id, $type, $catalog, $schema, $table, $scope, $nullable);
829 if ($result === false) {
830 throw UodbcException::createFromPhpError();
831 }
832 return $result;
833 }
834
835
836 /**
837 * Get statistics about a table and its indexes.
838 *
839 * @param resource $connection_id The ODBC connection identifier,
840 * see odbc_connect for details.
841 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
842 * @param string $schema The schema ('owner' in ODBC 2 parlance).
843 * @param string $table_name The table name.
844 * @param int $unique The type of the index.
845 * One of SQL_INDEX_UNIQUE or SQL_INDEX_ALL.
846 * @param int $accuracy One of SQL_ENSURE or SQL_QUICK.
847 * The latter requests that the driver retrieve the CARDINALITY and
848 * PAGES only if they are readily available from the server.
849 * @return resource Returns an ODBC result identifier.
850 *
851 * The result set has the following columns:
852 *
853 * TABLE_CAT
854 * TABLE_SCHEM
855 * TABLE_NAME
856 * NON_UNIQUE
857 * INDEX_QUALIFIER
858 * INDEX_NAME
859 * TYPE
860 * ORDINAL_POSITION
861 * COLUMN_NAME
862 * ASC_OR_DESC
863 * CARDINALITY
864 * PAGES
865 * FILTER_CONDITION
866 *
867 * Drivers can report additional columns.
868 * @throws UodbcException
869 *
870 */
871 function odbc_statistics($connection_id, string $catalog, string $schema, string $table_name, int $unique, int $accuracy)
872 {
873 error_clear_last();
874 $result = \odbc_statistics($connection_id, $catalog, $schema, $table_name, $unique, $accuracy);
875 if ($result === false) {
876 throw UodbcException::createFromPhpError();
877 }
878 return $result;
879 }
880
881
882 /**
883 * Lists tables in the requested range and the privileges associated
884 * with each table.
885 *
886 * @param resource $connection_id The ODBC connection identifier,
887 * see odbc_connect for details.
888 * @param string $catalog The catalog ('qualifier' in ODBC 2 parlance).
889 * @param string $schema The schema ('owner' in ODBC 2 parlance).
890 * This parameter accepts the following search patterns:
891 * % to match zero or more characters,
892 * and _ to match a single character.
893 * @param string $name The name.
894 * This parameter accepts the following search patterns:
895 * % to match zero or more characters,
896 * and _ to match a single character.
897 * @return resource An ODBC result identifier.
898 *
899 * The result set has the following columns:
900 *
901 * TABLE_CAT
902 * TABLE_SCHEM
903 * TABLE_NAME
904 * GRANTOR
905 * GRANTEE
906 * PRIVILEGE
907 * IS_GRANTABLE
908 *
909 * Drivers can report additional columns.
910 * @throws UodbcException
911 *
912 */
913 function odbc_tableprivileges($connection_id, string $catalog, string $schema, string $name)
914 {
915 error_clear_last();
916 $result = \odbc_tableprivileges($connection_id, $catalog, $schema, $name);
917 if ($result === false) {
918 throw UodbcException::createFromPhpError();
919 }
920 return $result;
921 }
922
923
924 /**
925 * Lists all tables in the requested range.
926 *
927 * To support enumeration of qualifiers, owners, and table types,
928 * the following special semantics for the
929 * catalog, schema,
930 * name, and
931 * table_type are available:
932 *
933 *
934 *
935 * If catalog is a single percent
936 * character (%) and schema and
937 * name are empty strings, then the result
938 * set contains a list of valid qualifiers for the data
939 * source. (All columns except the TABLE_QUALIFIER column contain
940 * NULLs.)
941 *
942 *
943 *
944 *
945 * If schema is a single percent character
946 * (%) and catalog and
947 * name are empty strings, then the result
948 * set contains a list of valid owners for the data source. (All
949 * columns except the TABLE_OWNER column contain
950 * NULLs.)
951 *
952 *
953 *
954 *
955 * If table_type is a single percent
956 * character (%) and catalog,
957 * schema and name
958 * are empty strings, then the result set contains a list of
959 * valid table types for the data source. (All columns except the
960 * TABLE_TYPE column contain NULLs.)
961 *
962 *
963 *
964 *
965 * @param resource $connection_id The ODBC connection identifier,
966 * see odbc_connect for details.
967 * @param string|null $catalog The catalog ('qualifier' in ODBC 2 parlance).
968 * @param string|null $schema The schema ('owner' in ODBC 2 parlance).
969 * This parameter accepts the following search patterns:
970 * % to match zero or more characters,
971 * and _ to match a single character.
972 * @param string|null $name The name.
973 * This parameter accepts the following search patterns:
974 * % to match zero or more characters,
975 * and _ to match a single character.
976 * @param string|null $types If table_type is not an empty string, it
977 * must contain a list of comma-separated values for the types of
978 * interest; each value may be enclosed in single quotes (') or
979 * unquoted. For example, 'TABLE','VIEW' or TABLE, VIEW. If the
980 * data source does not support a specified table type,
981 * odbc_tables does not return any results for
982 * that type.
983 *
984 * @return resource Returns an ODBC result identifier containing the information.
985 *
986 * The result set has the following columns:
987 *
988 * TABLE_CAT
989 * TABLE_SCHEM
990 * TABLE_NAME
991 * TABLE_TYPE
992 * REMARKS
993 *
994 * Drivers can report additional columns.
995 * @throws UodbcException
996 *
997 */
998 function odbc_tables($connection_id, ?string $catalog = null, ?string $schema = null, ?string $name = null, ?string $types = null)
999 {
1000 error_clear_last();
1001 if ($types !== null) {
1002 $result = \odbc_tables($connection_id, $catalog, $schema, $name, $types);
1003 } elseif ($name !== null) {
1004 $result = \odbc_tables($connection_id, $catalog, $schema, $name);
1005 } elseif ($schema !== null) {
1006 $result = \odbc_tables($connection_id, $catalog, $schema);
1007 } elseif ($catalog !== null) {
1008 $result = \odbc_tables($connection_id, $catalog);
1009 } else {
1010 $result = \odbc_tables($connection_id);
1011 }
1012 if ($result === false) {
1013 throw UodbcException::createFromPhpError();
1014 }
1015 return $result;
1016 }
1017