• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • oci_set_call_timeout()

    (PHP 7 >= 7.2.14, PHP 7.3.1 > 7.3 PECL OCI8 >= 2.2.0)

    Sets a millisecond timeout for database calls

    说明

    oci_set_call_timeout(resource $connection,int $time_out): bool

    Sets a timeout limiting the maxium time a database round-trip using this connection may take.

    Each OCI8 operation may make zero or more calls to Oracle's client library. These internal calls may then may make zero or more round-trips to Oracle Database. If any one of those round-trips takes more thantime_outmilliseconds, then the operation is cancelled and an error is returned to the application.

    Thetime_outvalue applies to each round-trip individually, not to the sum of all round-trips. Time spent processing in PHP OCI8 before or after the completion of each round-trip is not counted.

    When a call is interrupted, Oracle will attempt to clean up the connection for reuse. This operation is allowed to run for anothertime_outperiod. Depending on the outcome of the cleanup, the connection may or may not be reusable.

    When persistent connections are used, the timeout value will be retained across PHP requests.

    The oci_set_call_timeout() function is available when OCI8 uses Oracle 18(or later)Client libraries.

    参数

    $connection

    Oracle 连接标识,由oci_connect(),oci_pconnect(),或oci_new_connect()返回。

    $time_out

    The maximum time in milliseconds that any single round-trip between PHP and Oracle Database may take.

    返回值

    成功时返回TRUE,或者在失败时返回FALSE

    范例

    Example #1 Setting the timeout

    <?php
    $conn = oci_connect('hr', 'welcome', 'localhost/XE');
    oci_set_call_timeout($conn, 5000);
    ?>