602SQL Documentation Index  

wb_psql_param_info

PHP

array wb_psql_param_info( resource psql, int param_index )


Parameters

psql
Identifier of a prepared SQL statement, the result of the wb_psql_prepare function. Required parameter.
param_index
Index of the parameter we want to get information about. Index of the first parameter is 0, index of the last parameter is one less than the result of the wb_psql_param_count function. Required parameter.


Description

This function gets information about the parameter whose index is passed in the param_index parameter.

Information about the parameter may be retrieved only if the prepared SQL statement has not been closed yet (see wb_close).



Returns

Returns FALSE if an error occurs. Otherwise, information about the parameter of the prepared SQL statement is returned. The information is returned as an array of strings.

array item indexvalue typeinformation
typeintdatabase type of the prepared SQL statement parameter; one of the constants ATT_xxx described here (value type numbers - see the Data_type column of the _IV_TABLE_COLUMNS system query)
specifintsupplemental information about the parameter database type; numeric value of the variant structure t_specif
modeintdirection of the parameter; one of the constants MODE_IN, MODE_OUT, MODE_INOUT
positionintparameter position (the ? character) in the source text of the prepared SQL statement; character positions are numbered from 0, the first character of the source text has position 0


Example

Get the information about SQL statement parameters.

$psql=wb_psql_prepare($connection,"SELECT name INTO ? FROM Person WHERE ID=?");
echo "SQL statement has ".wb_psql_param_count($psql)." parameters.\n";
$array=wb_psql_param_info($psql,0);
echo "  first parameter: type ".$array["type"].", specif ".$array["specif"].", mode ".$array["mode"].", position ".$array["position"]."\n";
$array=wb_psql_param_info($psql,1);
echo "  second parameter: type ".$array["type"].", specif ".$array["specif"].", mode ".$array["mode"].", position ".$array["position"]."\n";  

Viz