602SQL Documentation Index  



resource wb_psql_prepare( resource connection, string statement )


An open connection to the SQL Server, the result of the wb_connect or wb_pconnect function. Required parameter.
The source text of the SQL statement that should be prepared for execution by this function. The text may contain parameters of the SQL statement. Required parameter.


This function prepares a SQL statement for execution. The source text of the SQL statement is passed in the statement parameter.

The source text of the SQL statement may be parameterized. The parameter positions are marked by the question mark character "?". When the SQL statement is ready to be executed, you may get the parameter count of the SQL statement by using the wb_psql_param_count function, parameter information from the wb_psql_param_info function, send IN parameter values using the wb_psql_send_param function, and cancel previously sent IN parameter values using the wb_psql_drop_params function.

The prepared SQL statement may be executed using the wb_psql_execute function.

If the prepared SQL statement is no longer needed, you may close it using the wb_close function. This will free the resources that are blocked by the prepared statement in the PHP module and on the SQL Server. You do not need to explicitly close the prepared SQL statements, the PHP module will close them automatically.


Returns the identifier of the prepared SQL statement (resource handle) if succesful, otherwise FALSE.


Prepare a SQL statement with two parameters, the first is an OUT parameter, the second is an IN parameter:

$psql=wb_psql_prepare($connection,"SELECT name INTO ? FROM Person WHERE ID=?");