SafePrepared

Encapsulation of a prepared statement.

Create this via the function mysql.safe.connection.prepare. Set your arguments (if any) via the functions provided, and then run the statement by passing it to mysql.safe.commands.exec/mysql.safe.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.safe.commands.query functions. For other commands, like INSERT/UPDATE/CREATE/etc, use mysql.safe.commands.exec.

Constructors

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

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

Members

Functions

getArg
MySQLVal 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, SafeParameterSpecialization psn)
void setArg(size_t index, Nullable!T val, SafeParameterSpecialization 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(MySQLVal[] args, SafeParameterSpecialization[] psnList)

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

setNullArg
deprecated 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
CSN[] _columnSpecials;
Undocumented in source.
_headers
PreparedStmtHeaders _headers;
Undocumented in source.
_inParams
MySQLVal[] _inParams;
Undocumented in source.
_lastInsertID
ulong _lastInsertID;
Undocumented in source.
_numParams
ushort _numParams;

Number of parameters this prepared statement takes

_psa
SPSN[] _psa;
Undocumented in source.

Meta