Command

Encapsulation of an SQL command or query.

A Command be be either a one-off SQL query, or may use a prepared statement. 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.

Constructors

this
this(Connection con)

Construct a naked Command object

this
this(Connection con, string sql)

Construct a Command object complete with SQL

Members

Functions

bindParameter
void bindParameter(T val, size_t pIndex, ParameterSpecialization psn)

Bind a D variable to a prepared statement parameter.

bindParameterTuple
void bindParameterTuple(T args)

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

bindParameters
void bindParameters(Variant[] va, ParameterSpecialization[] psnList)

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

execFunction
bool execFunction(string name, T target, U args)

Execute a stored function, with any required input variables, and store the return value into a D variable.

execPrepared
bool execPrepared(ulong ra)

Execute a prepared command.

execPreparedResult
ResultSet execPreparedResult(ColumnSpecialization[] csa)

Execute a prepared SQL command for the case where you expect a result set, and want it all at once.

execPreparedSequence
ResultSequence execPreparedSequence(ColumnSpecialization[] csa)

Execute a prepared SQL command for the case where you expect a result set, and want to deal with it one row at a time.

execPreparedTuple
void execPreparedTuple(T args)

Execute a prepared SQL command to place result values into a set of D variables.

execProcedure
bool execProcedure(string name, T args)

Execute a stored procedure, with any required input variables.

execSQL
bool execSQL(ulong ra)

Execute a one-off SQL command.

execSQLResult
ResultSet execSQLResult(ColumnSpecialization[] csa)

Execute a one-off SQL command for the case where you expect a result set, and want it all at once.

execSQLSequence
ResultSequence execSQLSequence(ColumnSpecialization[] csa)

Execute a one-off SQL command for the case where you expect a result set, and want to deal with it a row at a time.

execSQLTuple
void execSQLTuple(T args)

Execute a one-off SQL command to place result values into a set of D variables.

getNextRow
Row getNextRow()

Get the next Row of a pending result set.

param
Variant param(size_t index)

Access a prepared statement parameter for update.

prepare
void prepare()

Submit an SQL command to the server to be compiled into a prepared statement.

purgeResult
ulong purgeResult()

Flush any outstanding result set elements.

releaseStatement
void releaseStatement()

Release a prepared statement.

setNullParam
void setNullParam(size_t index)

Sets a prepared statement parameter to NULL.

Properties

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.

numParams
ushort numParams [@property getter]

Gets the number of parameters in this Command

preparedFieldDescriptions
FieldDescription[] preparedFieldDescriptions [@property getter]

Gets the prepared header's field descriptions.

preparedParamDescriptions
ParamDescription[] preparedParamDescriptions [@property getter]

Gets the prepared header's param descriptions.

resultFieldDescriptions
FieldDescription[] resultFieldDescriptions [@property getter]

Gets the result header's field descriptions.

sql
string sql [@property getter]

Get the current SQL for the Command

sql
string sql [@property setter]

Set a new SQL command.

Meta