|
4 | 4 |
|
5 | 5 | use Safe\Exceptions\IbaseException;
|
6 | 6 |
|
| 7 | +/** |
| 8 | + * This function will discard a BLOB if it has not yet been closed by |
| 9 | + * fbird_blob_close. |
| 10 | + * |
| 11 | + * @param resource $blob_handle A BLOB handle opened with fbird_blob_create. |
| 12 | + * @throws IbaseException |
| 13 | + * |
| 14 | + */ |
| 15 | +function fbird_blob_cancel($blob_handle): void |
| 16 | +{ |
| 17 | + error_clear_last(); |
| 18 | + $result = \fbird_blob_cancel($blob_handle); |
| 19 | + if ($result === false) { |
| 20 | + throw IbaseException::createFromPhpError(); |
| 21 | + } |
| 22 | +} |
| 23 | + |
| 24 | + |
7 | 25 | /**
|
8 | 26 | *
|
9 | 27 | *
|
@@ -34,6 +52,44 @@ function ibase_add_user($service_handle, string $user_name, string $password, st
|
34 | 52 | }
|
35 | 53 |
|
36 | 54 |
|
| 55 | +/** |
| 56 | + * This function passes the arguments to the (remote) database server. There it starts a new backup process. Therefore you |
| 57 | + * won't get any responses. |
| 58 | + * |
| 59 | + * @param resource $service_handle A previously opened connection to the database server. |
| 60 | + * @param string $source_db The absolute file path to the database on the database server. You can also use a database alias. |
| 61 | + * @param string $dest_file The path to the backup file on the database server. |
| 62 | + * @param int $options Additional options to pass to the database server for backup. |
| 63 | + * The options parameter can be a combination |
| 64 | + * of the following constants: |
| 65 | + * IBASE_BKP_IGNORE_CHECKSUMS, |
| 66 | + * IBASE_BKP_IGNORE_LIMBO, |
| 67 | + * IBASE_BKP_METADATA_ONLY, |
| 68 | + * IBASE_BKP_NO_GARBAGE_COLLECT, |
| 69 | + * IBASE_BKP_OLD_DESCRIPTIONS, |
| 70 | + * IBASE_BKP_NON_TRANSPORTABLE or |
| 71 | + * IBASE_BKP_CONVERT. |
| 72 | + * Read the section about for further information. |
| 73 | + * @param bool $verbose Since the backup process is done on the database server, you don't have any chance |
| 74 | + * to get its output. This argument is useless. |
| 75 | + * @return mixed Returns TRUE on success. |
| 76 | + * |
| 77 | + * Since the backup process is done on the (remote) server, this function just passes the arguments to it. |
| 78 | + * While the arguments are legal, you won't get FALSE. |
| 79 | + * @throws IbaseException |
| 80 | + * |
| 81 | + */ |
| 82 | +function ibase_backup($service_handle, string $source_db, string $dest_file, int $options = 0, bool $verbose = false) |
| 83 | +{ |
| 84 | + error_clear_last(); |
| 85 | + $result = \ibase_backup($service_handle, $source_db, $dest_file, $options, $verbose); |
| 86 | + if ($result === false) { |
| 87 | + throw IbaseException::createFromPhpError(); |
| 88 | + } |
| 89 | + return $result; |
| 90 | +} |
| 91 | + |
| 92 | + |
37 | 93 | /**
|
38 | 94 | * This function will discard a BLOB if it has not yet been closed by
|
39 | 95 | * ibase_blob_close.
|
@@ -453,6 +509,47 @@ function ibase_pconnect(string $database = null, string $username = null, string
|
453 | 509 | }
|
454 | 510 |
|
455 | 511 |
|
| 512 | +/** |
| 513 | + * This function passes the arguments to the (remote) database server. There it starts a new restore process. Therefore you |
| 514 | + * won't get any responses. |
| 515 | + * |
| 516 | + * @param resource $service_handle A previously opened connection to the database server. |
| 517 | + * @param string $source_file The absolute path on the server where the backup file is located. |
| 518 | + * @param string $dest_db The path to create the new database on the server. You can also use database alias. |
| 519 | + * @param int $options Additional options to pass to the database server for restore. |
| 520 | + * The options parameter can be a combination |
| 521 | + * of the following constants: |
| 522 | + * IBASE_RES_DEACTIVATE_IDX, |
| 523 | + * IBASE_RES_NO_SHADOW, |
| 524 | + * IBASE_RES_NO_VALIDITY, |
| 525 | + * IBASE_RES_ONE_AT_A_TIME, |
| 526 | + * IBASE_RES_REPLACE, |
| 527 | + * IBASE_RES_CREATE, |
| 528 | + * IBASE_RES_USE_ALL_SPACE, |
| 529 | + * IBASE_PRP_PAGE_BUFFERS, |
| 530 | + * IBASE_PRP_SWEEP_INTERVAL, |
| 531 | + * IBASE_RES_CREATE. |
| 532 | + * Read the section about for further information. |
| 533 | + * @param bool $verbose Since the restore process is done on the database server, you don't have any chance |
| 534 | + * to get its output. This argument is useless. |
| 535 | + * @return mixed Returns TRUE on success. |
| 536 | + * |
| 537 | + * Since the restore process is done on the (remote) server, this function just passes the arguments to it. |
| 538 | + * While the arguments are legal, you won't get FALSE. |
| 539 | + * @throws IbaseException |
| 540 | + * |
| 541 | + */ |
| 542 | +function ibase_restore($service_handle, string $source_file, string $dest_db, int $options = 0, bool $verbose = false) |
| 543 | +{ |
| 544 | + error_clear_last(); |
| 545 | + $result = \ibase_restore($service_handle, $source_file, $dest_db, $options, $verbose); |
| 546 | + if ($result === false) { |
| 547 | + throw IbaseException::createFromPhpError(); |
| 548 | + } |
| 549 | + return $result; |
| 550 | +} |
| 551 | + |
| 552 | + |
456 | 553 | /**
|
457 | 554 | * Rolls back a transaction without closing it.
|
458 | 555 | *
|
@@ -500,7 +597,29 @@ function ibase_rollback($link_or_trans_identifier = null): void
|
500 | 597 | /**
|
501 | 598 | *
|
502 | 599 | *
|
503 |
| - * @param resource $service_handle |
| 600 | + * @param string $host The name or ip address of the database host. You can define the port by adding |
| 601 | + * '/' and port number. If no port is specified, port 3050 will be used. |
| 602 | + * @param string $dba_username The name of any valid user. |
| 603 | + * @param string $dba_password The user's password. |
| 604 | + * @return resource Returns a Interbase / Firebird link identifier on success. |
| 605 | + * @throws IbaseException |
| 606 | + * |
| 607 | + */ |
| 608 | +function ibase_service_attach(string $host, string $dba_username, string $dba_password) |
| 609 | +{ |
| 610 | + error_clear_last(); |
| 611 | + $result = \ibase_service_attach($host, $dba_username, $dba_password); |
| 612 | + if ($result === false) { |
| 613 | + throw IbaseException::createFromPhpError(); |
| 614 | + } |
| 615 | + return $result; |
| 616 | +} |
| 617 | + |
| 618 | + |
| 619 | +/** |
| 620 | + * |
| 621 | + * |
| 622 | + * @param resource $service_handle A previously created connection to the database server. |
504 | 623 | * @throws IbaseException
|
505 | 624 | *
|
506 | 625 | */
|
|
0 commit comments