Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqlsrv_field_metadata(3) [php man page]

SQLSRV_FIELD_METADATA(3)												  SQLSRV_FIELD_METADATA(3)

sqlsrv_field_metadata - Retrieves metadata for the fields of a statement prepared bysqlsrv_prepare(3)orsqlsrv_query(3)

SYNOPSIS
mixed sqlsrv_field_metadata (resource $stmt) DESCRIPTION
Retrieves metadata for the fields of a statement prepared by sqlsrv_prepare(3) or sqlsrv_query(3). sqlsrv_field_metadata(3) can be called on a statement before or after statement execution. PARAMETERS
o $stmt - The statment resource for which metadata is returned. RETURN VALUES
Returns an array of arrays is returned on success. Otherwise, FALSE is returned. Each returned array is described by the following table: Array returned by sqlsrv_field_metadata +----------+---------------------------------------------------+ | Key | | | | | | | Description | | | | +----------+---------------------------------------------------+ | Name | | | | | | | The name of the field. | | | | | Type | | | | | | | The numeric value for the SQL type. | | | | | Size | | | | | | | The number of characters for fields of character | | | type, the number of bytes for fields of binary | | | type, or NULL for other types. | | | | |Precision | | | | | | | The precision for types of variable precision, | | | NULL for other types. | | | | | Scale | | | | | | | The scale for types of variable scale, NULL for | | | other types. | | | | |Nullable | | | | | | | An enumeration indicating whether the column is | | | nullable, not nullable, or if it is not known. | | | | +----------+---------------------------------------------------+ For more information, see sqlsrv_field_metadata in the Microsoft SQLSRV documentation. EXAMPLES
Example #1 sqlsrv_field_metadata(3) example <?php $serverName = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"AdventureWorks", "UID"=>"username", "PWD"=>"password"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT * FROM Table_1"; $stmt = sqlsrv_prepare( $conn, $sql ); foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) { foreach( $fieldMetadata as $name => $value) { echo "$name: $value<br />"; } echo "<br />"; } ?> SEE ALSO
sqlsrv_client_info(3). PHP Documentation Group SQLSRV_FIELD_METADATA(3)

Check Out this Related Man Page

SQLSRV_FREE_STMT(3)													       SQLSRV_FREE_STMT(3)

sqlsrv_free_stmt - Frees all resources for the specified statement

SYNOPSIS
bool sqlsrv_free_stmt (resource $stmt) DESCRIPTION
Frees all resources for the specified statement. The statement cannot be used after sqlsrv_free_stmt(3) has been called on it. If sql- srv_free_stmt(3) is called on an in-progress statement that alters server state, statement execution is terminated and the statement is rolled back. PARAMETERS
o $stmt - The statment 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. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 sqlsrv_free_stmt(3) example <?php $serverName = "serverNamesqlexpress"; $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); ?> NOTES
The main difference between sqlsrv_free_stmt(3) and sqlsrv_cancel(3) is that a statement resource cancelled with sqlsrv_cancel(3) can be re-executed if it was created with sqlsrv_prepare(3). A statement resource cancelled with sqlsrv_free_statement(3) cannot be re-executed. SEE ALSO
sqlsrv_cancel(3). PHP Documentation Group SQLSRV_FREE_STMT(3)
Man Page