2. The XBSQLSelect class
The XBSQLSelect class represents an instance of a parsed and
checked SQL select query. An instance is executed using the
execute method, after which results can be retrieved.
- bool XBSQLSelect::execute (int, XBSQLValue *)
This method executes the query. The arguments are, respectively,
the number and set of values to be substituted into any ?
placeholders in the parsed SQL. Note that the query may be
executed multiple times. In the event of an error, the error
message can be retrieved from the parent
XBaseSQL object.
- int XBSQLSelect::getNumRows ()
Returns the number of rows returned on the last execution of the
query.
- int XBSQLSelect::getNumFields ()
Returns the number of fields (columns) returned by the query
query. This is useful for queries like select * from ....
- int XBSQLSelect::getFieldLength (int)
Returns the length in bytes of each field (column) where the
field is a column in a table. The length will be zero for
expressions. The argument is the field (column) index, starting
at zero.
- const char *XBSQLSelect::getFieldName (int)
Gets the field (column) name. This is the column alias, or a
representation of the query expression. The argument is the
field (column) index, starting at zero.
- xbShort XBSQLSelect::getFieldType (int)
Returns the field (column) type. The types are as defined in the
XBase DBMS library header files. The argument is the
field (column) index, starting at zero.
- const XBSQLValue &XBSQLSelect::getField (int, int)
Returns a value retrieved by the query. The arguments are
respectively the row and column indexes, both starting at zero.
- void XBSQLSelect::dumprow (int)
Calling this method releases storage associated with the specified
row, and may be useful if memory is short and large amounts of
data are returned by the query. Note that after calling this
method, the XBSQLSelect::getField method must not
called for the same row; there are no checks and this will
crash the code.