array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.sqlsrv-free-stmt.php', 1 => 'sqlsrv_free_stmt', 2 => 'Frees all resources for the specified statement', ), 'up' => array ( 0 => 'ref.sqlsrv.php', 1 => 'SQLSRV 関数', ), 'prev' => array ( 0 => 'function.sqlsrv-field-metadata.php', 1 => 'sqlsrv_field_metadata', ), 'next' => array ( 0 => 'function.sqlsrv-get-config.php', 1 => 'sqlsrv_get_config', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/sqlsrv/functions/sqlsrv-free-stmt.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

sqlsrv_free_stmt

(No version information available, might only be in Git)

sqlsrv_free_stmtFrees all resources for the specified statement

説明

sqlsrv_free_stmt(resource $stmt): bool

Frees all resources for the specified statement. The statement cannot be used after sqlsrv_free_stmt() has been called on it. If sqlsrv_free_stmt() is called on an in-progress statement that alters server state, statement execution is terminated and the statement is rolled back.

パラメータ

stmt

The statement for which resources are freed. Note that null is a valid parameter value. This allows the function to be called multiple times in a script.

戻り値

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

例1 sqlsrv_free_stmt() example

<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}

$stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1");
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}

/*-------------------------------
Process query results here.
-------------------------------*/

/* Free the statement resources. */
sqlsrv_free_stmt( $stmt);

?>

注意

The main difference between sqlsrv_free_stmt() and sqlsrv_cancel() is that a statement resource cancelled with sqlsrv_cancel() can be re-executed if it was created with sqlsrv_prepare(). A statement resource cancelled with sqlsrv_free_statement() cannot be re-executed.

参考