CakeFest 2024: The Official CakePHP Conference

db2_free_stmt

(PECL ibm_db2 >= 1.0.0)

db2_free_stmt 指定されたステートメントリソースに関連付けられたリソースを開放する

説明

db2_free_stmt(resource $stmt): bool

ステートメントリソースに関連付けられたシステムリソースおよびデータベースリソースを 開放します。これらのリソースはスクリプトの終了時に暗黙的に開放されますが、 スクリプトの終了前に db2_stmt_result() をコールすることで、明示的にステートメントリソースを開放することができます。

パラメータ

stmt

有効なステートメントリソース。

戻り値

成功した場合に true を、失敗した場合に false を返します。

参考

  • db2_free_result() - 結果セットに関連付けられたリソースを開放する

add a note

User Contributed Notes 1 note

up
1
alan at alanseiden dot com
7 years ago
Update: as of version 1.9.2, db2_free_stmt() was not only deprecated, but its functionality removed completely. It returns TRUE but does nothing.

Instead of db2_free_stmt(), use the aforementioned $stmt = ''; to trigger the statement's destructor.

It is advised to destroy the statement resource in this way if the statement variable is later re-used with another db2_prepare in the same request.

Example:
$stmt = db2_prepare($conn, $sql1);
// more code goes here
$stmt = ''; // destroy statement resource before assigning another statement to the same variable.
$stmt = db2_prepare($conn, $sql2);
To Top