doprepare.php

This script is responsible for the first step of prepared SQL statement processing.

The current session must contain the connection parameters for database access.

doprepare.php processes the following HTTP parameters:

PHPSESSID
(required) the session ID returned from dologin.php
sql
(required) is the SQL statement to be prepared

The response structure returned by doprepare.php is an XML document as outlined below:

<result>
        <param name="stm-id">stmid</param>
        <param name="param-count">999</param>
        ...
        <warning>
                <reason>error message</reason>
                <sqlstate>SQL state</sqlstate>
                <vendor-code>vendor code</vendor-code>
        </warning>
</result> 

stm-id is a unique identifier for the prepared statement which is later used by doparam.php, dorunprep.php, and docloseprep.php.

param-count is the number of parameter placeholders found in the prepared statement.

In case of an error, the resulting response is like:

<result>
        <error>
                <reason>error message</reason>
                <sqlstate>SQL state</sqlstate>
                <vendor-code>vendor code</vendor-code>
        </error>
</result>