Prepared

Encapsulation of a prepared statement.

Create this via the function mysql.connection.prepare. Set your arguments (if any) via the functions provided, and then run the statement by passing it to mysql.commands.exec/mysql.commands.query/etc in place of the sql string parameter.

Commands that are expected to return a result set - queries - have distinctive methods that are enforced. That is it will be an error to call such a method with an SQL command that does not produce a result set. So for commands like SELECT, use the mysql.commands.query functions. For other commands, like INSERT/UPDATE/CREATE/etc, use mysql.commands.exec.

Constructors

this
this(const(char[]) sql, PreparedStmtHeaders headers, ushort numParams)

Constructor. You probably want mysql.connection.prepare instead of this.

Members

Functions

getArg
Variant getArg(size_t index)

Prepared statement parameter getter.

getExecQueryImplInfo
ExecQueryImplInfo getExecQueryImplInfo(uint statementId)
Undocumented in source. Be warned that the author may not have intended to support it.
setArg
void setArg(size_t index, T val, ParameterSpecialization psn)
void setArg(size_t index, Nullable!T val, ParameterSpecialization psn)

Prepared statement parameter setter.

setArgs
void setArgs(T args)

Bind a tuple of D variables to the parameters of a prepared statement.

setArgs
void setArgs(Variant[] args, ParameterSpecialization[] psnList)

Bind a Variant[] as the parameters of a prepared statement.

setNullArg
void setNullArg(size_t index)

Sets a prepared statement parameter to NULL.

sql
const(char)[] sql()

Gets the SQL command for this prepared statement.

Properties

columnSpecials
ColumnSpecialization[] columnSpecials [@property setter]

Get/set the column specializations.

columnSpecials
ColumnSpecialization[] columnSpecials [@property getter]

Get/set the column specializations.

lastInsertID
ulong lastInsertID [@property getter]

After a command that inserted a row into a table with an auto-increment ID column, this method allows you to retrieve the last insert ID generated from this prepared statement.

numArgs
ushort numArgs [@property getter]

Gets the number of arguments this prepared statement expects to be passed in.

preparedFieldDescriptions
FieldDescription[] preparedFieldDescriptions [@property getter]

Gets the prepared header's field descriptions.

preparedParamDescriptions
ParamDescription[] preparedParamDescriptions [@property getter]

Gets the prepared header's param descriptions.

Variables

_columnSpecials
ColumnSpecialization[] _columnSpecials;
Undocumented in source.
_headers
PreparedStmtHeaders _headers;
Undocumented in source.
_inParams
Variant[] _inParams;
Undocumented in source.
_lastInsertID
ulong _lastInsertID;
Undocumented in source.
_numParams
ushort _numParams;

Number of parameters this prepared statement takes

_psa
ParameterSpecialization[] _psa;
Undocumented in source.

Meta