MySQL Connector/C++
MySQL connector library for C and C++ applications
Public Member Functions | List of all members

Result of an SQL query or command. More...

Public Member Functions

bool hasData () const
 Tell if the current result contains row data. More...
 
bool nextResult ()
 Move to the next result, if there is one. More...
 
uint64_t getAutoIncrementValue ()
 Get the auto-increment value if one was generated by a table insert statement.
 
col_count_t getColumnCount () const
 Return the number of fields in each row.
 
const ColumngetColumn (col_count_t pos) const
 Return Column object describing the given column of the result.
 
const Columns & getColumns () const
 Return meta-data for all result columns. More...
 
Row fetchOne ()
 Return the current row and move to the next one in the sequence. More...
 
RowList fetchAll ()
 Return all remaining rows. More...
 
row_count_t count ()
 Returns the number of rows contained in the result. More...
 
unsigned getWarningsCount () const
 Get the number of warnings stored in the result.
 
WarningList getWarnings ()
 Get a list of warnings stored in the result.
 
Warning getWarning (unsigned pos)
 Get the warning at the given, 0-based position.
 
uint64_t getAffectedItemsCount () const
 Get the count of affected items (rows or doucuments) from manipulation statements.
 

Detailed Description

Result of an SQL query or command.

In general, an SQL query or command can return multiple results (for example, a call to a stored procedure). Additionally, each or only some of these results can contain row data. A SqlResult object gives a sequential access to all results of a multi-result. Method nextResult() moves to the next result in the sequence, if present. Methods of RowResult are used to access row data of the current result (if it contains data).

Note
A SqlResult object should be used by at most one thread at a time. It is not safe to call its methods by several threads simultaneously. It is responsibility of the user to ensure this using a synchronization mechanism such as mutexes.

Member Function Documentation

◆ hasData()

bool hasData ( ) const
inline

Tell if the current result contains row data.

If this is the case, rows can be accessed using RowResult interface. Otherwise calling RowResult methods throws an error.

◆ nextResult()

bool nextResult ( )
inline

Move to the next result, if there is one.

Returns true if the next result is available, false if there are no more results in the reply. Calling nextResult() discards the current result. If it has any rows that has not yet been fetched, these rows are also discarded.

◆ getColumns()

const Columns & getColumns ( ) const
inlineinherited

Return meta-data for all result columns.

TODO: explain ownership

◆ fetchOne()

Row fetchOne ( )
inlineinherited

Return the current row and move to the next one in the sequence.

If there are no more rows in this result, returns a null Row instance.

◆ fetchAll()

RowList fetchAll ( )
inlineinherited

Return all remaining rows.

Result of this method can be stored in a container such as std::list<Row>. Rows that have already been fetched using fetchOne() are not included in the result of fetchAll().

◆ count()

row_count_t count ( )
inlineinherited

Returns the number of rows contained in the result.

The method counts only the rows that were not yet fetched and are still available in the result.


The documentation for this class was generated from the following file: