ocicommit

(PHP 3>= 3.0.7, PHP 4 )

ocicommit -- 提交未执行的事务处理

描述

bool ocicommit ( int connection)

OCICommit() 提交 Oracle 连接 connection 所有未执行的语句。 如果成功则返回 TRUE,失败则返回 FALSE

下面的例子说明了 OCICommit 的用法。

例子 1. OCICommit

<?php
    // Login to Oracle server
    $conn = OCILogon('scott', 'tiger');

    // Parse SQL
    $stmt = OCIParse($conn, "INSERT INTO employees (name, surname) VALUES ('Maxim', 'Maletsky')");

    // Execute statement
    OCIExecute($stmt);

    // Commit transaction
    $committed = OCICommit($conn);

    // Test whether commit was successful. If error occurred, return error message
    if(!$committed) {
        $error = OCIError($conn);
        echo 'Commit failed. Oracle reports: ' . $error['message'];
    }

    // Close connection
    OCILogoff($conn);
?>

参见 ocirollback()