# Module Mysql.Prepared

    module Prepared: sig .. end

Prepared statements with parameters. Consult the MySQL manual for detailed description and possible problems.

    type stmt

Prepared statement

    type stmt_result

Prepared query result (rowset)

    val create : Mysql.dbd -> string -> stmt

Create prepared statement. Placeholders for parameters are `?` and `@param`. Returned prepared statement is only valid in the context of this connection and can be reused many times during the lifetime of the connection.

    val execute : stmt -> string array -> stmt_result

Execute the prepared statement with the specified values for parameters.

    val execute_null : stmt -> string option array -> stmt_result

Same as `Mysql.Prepared.execute`, but with support for NULL values.

    val affected : stmt -> int64

- Returns Number of rows affected by the last execution of this statement.

    val insert_id : stmt -> int64

- Returns The rowid of the last inserted row.

    val real_status : stmt -> int

- Returns the error code for the last operation on this statement, `0` for success.

    val fetch : stmt_result -> string option array option

- Returns the next row of the result set.

    val result_metadata : stmt -> Mysql.result

- Returns metadata on the statement's result set.

    val close : stmt -> unit

Destroy the prepared statement