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.

struct Command {}

Constructors

this
this(Connection con)

Construct a naked Command object

this
this(Connection con, const(char)[] sql)

Construct a Command object complete with SQL

Members

Functions

analyseParams
ubyte[] analyseParams(ubyte[] vals, bool longData)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

makePSPrefix
ubyte[] makePSPrefix(ubyte flags)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

sendCmd
bool sendCmd(CommandType cmd)
Undocumented in source. Be warned that the author may not have intended to support it.
sendLongData
void sendLongData()
Undocumented in source. Be warned that the author may not have intended to support it.
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.

rowsPending
bool rowsPending [@property getter]

Gets the number of rows pending

sql
const(char)[] sql [@property getter]

Get the current SQL for the Command

sql
const(char)[] sql [@property setter]

Set a new SQL command.

Static functions

makeBitmap
ubyte[] makeBitmap(ParameterSpecialization[] psa)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_con
Connection _con;
_fieldCount
ushort _fieldCount;
Undocumented in source.
_hStmt
uint _hStmt;
_headersPending
bool _headersPending;
Undocumented in source.
_inParams
Variant[] _inParams;
Undocumented in source.
_insertID
ulong _insertID;
_pendingBinary
bool _pendingBinary;
Undocumented in source.
_prevFunc
string _prevFunc;
Undocumented in source.
_psParams
ushort _psParams;
_psWarnings
ushort _psWarnings;
Undocumented in source.
_psa
ParameterSpecialization[] _psa;
Undocumented in source.
_psh
PreparedStmtHeaders _psh;
_rebound
bool _rebound;
Undocumented in source.
_rowsPending
bool _rowsPending;
Undocumented in source.
_rsh
ResultSetHeaders _rsh;
Undocumented in source.
_sql
const(char)[] _sql;
Undocumented in source.

Meta