602SQL Documentation Index  

wb_psql_get_out_param

PHP

mixed wb_psql_get_out_param( resource psql, int out_param_index [, int out_param_offset, int out_param_size ] )


Parameters

psql
Identifier of a prepared SQL statement, the result of the wb_psql_prepare function. Required parameter.
out_param_index
Index of the OUT parameter you want to read. The first OUT parameter has an index of 0 and the last OUT parameter has an index equal to the result of the wb_psql_out_param_count function minus one. WARNING: This index is different from the index that is used when calling the functions wb_psql_param_count, wb_psql_param_info and wb_psql_send_param, where the index enumerates all SQL statement parameters! The index used in this function enumerates only OUT and INOUT parameters. Required parameter.
out_param_offset
Index of the first character (byte) of the OUT parameter value that you want to read. The characters (bytes) are numbered from 0.
out_param_size
Number of characters (bytes) of the OUT parameter value you want to read.


Description

This function reads and returns the value (or part) of an OUT or INOUT parameter of the specified index out_param_index. An SQL statement with the psql identifier must have already been executed. You may only call this function after a successful call to the wb_psql_execute function. The whole value will be read if the out_param_offset or out_param_size are not specified, or if the out_param_offset parameter is 0 and the out_param_size is longer or equal to the OUT parameter length the function reads.



Returns

The function returns the value (or part) of an OUT or INOUT parameter of a SQL statement if successful, otherwise FALSE.



Example

Send an IN parameter value to the SQL Server, execute the statement, get the count of OUT parameters, get the length of an OUT parameter and read the OUT parameter value.

$psql=wb_psql_prepare($connection,"SELECT name INTO ? FROM Person WHERE ID=?");
wb_psql_send_param($psql, 1 /*second parameter*/, 123 /*parameter value*/);
wb_psql_execute($psql);
echo "count of the OUT parameter: ".wb_psql_out_param_count($psql)."\n";
echo "length of the first OUT parameter: ".wb_psql_out_param_length($psql,0)."\n";
echo "value of the first OUT parameter: ".wb_psql_get_out_param($psql,0)."\n";    

Viz