說明
bool
oci_commit ( resource connection )
oci_commit() 將 Oracle 連線 connection
上正在運行的事務中所有未執行的語句送出處理。
例子 1. oci_commit() 例子
<?php // Login to Oracle server $conn = oci_connect('scott', 'tiger');
// Parse SQL $stmt = oci_parse($conn, " INSERT INTO employees (name, surname) VALUES ('Maxim', 'Maletsky') ");
/* Execute statement OCI_DEFAULT tells oci_execute() not to commit statement immediately */ oci_execute($stmt, OCI_DEFAULT);
/* .... Parsing and executing other statements here ... .... */
// Commit transaction $committed = oci_commit($conn);
// Test whether commit was successful. If error occurred, return error message if (!$committed) { $error = oci_error($conn); echo 'Commit failed. Oracle reports: ' . $error['message']; }
?>
|
|
若果成功則返回 TRUE,失敗則返回 FALSE。
注:
當關閉連線或腳本結束時(看哪個先)事務會自動回捲。需要明確地呼叫
oci_commit() 來送出事務,或
oci_rollback() 來中止事務。
注:
在 PHP 5.0.0 之前的版本必須使用 ocicommit()
替代本函數。該函數名仍然可用,為向下相容作為
oci_commit() 的別名。不過其已被廢棄,不推薦使用。
參見 oci_rollback() 和
oci_execute()。