db2_free_stmt

(PECL ibm_db2 >= 1.0.0)

db2_free_stmt Frees resources associated with the indicated statement resource

说明

db2_free_stmt ( resource $stmt ) : bool

Frees the system and database resources that are associated with a statement resource. These resources are freed implicitly when a script finishes, but you can call db2_free_stmt() to explicitly free the statement resources before the end of the script.

参数

stmt

A valid statement resource.

返回值

成功时返回 true, 或者在失败时返回 false

参见

User Contributed Notes

alan at alanseiden dot com 19-Jul-2016 07:29
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);