libdballe 5.10
|
Structure used to build and execute a query, and to iterate through the results. More...
#include <cursor.h>
Public Member Functions | |
Cursor (DB &db) | |
int | query (const Record &query, unsigned int wanted, unsigned int modifiers) |
Create and execute a database query. | |
int | remaining () const |
Get the number of rows still to be fetched. | |
bool | next () |
Get a new item from the results of a query. | |
void | discard_rest () |
Discard the results that have not been read yet. | |
void | to_record (Record &rec) |
Fill in a record with the contents of a dba_db_cursor. | |
unsigned | query_attrs (const std::vector< wreport::Varcode > &qcs, Record &attrs) |
Query attributes for the current variable. | |
Data Fields | |
DB & | db |
Database to operate on. | |
db::Statement * | stm |
ODBC statement to use for the query. | |
unsigned int | wanted |
What values are wanted from the query. | |
unsigned int | modifiers |
Modifier flags to enable special query behaviours. | |
unsigned int | from_wanted |
What is in the FROM part of the query, used to know what output fields are bound. | |
DBALLE_SQL_C_SINT_TYPE | count |
Number of results still to be fetched. | |
DBALLE_SQL_C_SINT_TYPE | out_lat |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_lon |
Query results. | |
char | out_ident [64] |
Query results. | |
SQLLEN | out_ident_ind |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_ltype1 |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_l1 |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_ltype2 |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_l2 |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_pind |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_p1 |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_p2 |
Query results. | |
wreport::Varcode | out_varcode |
Query results. | |
SQL_TIMESTAMP_STRUCT | out_datetime |
Query results. | |
char | out_value [255] |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_rep_cod |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_ana_id |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_context_id |
Query results. | |
DBALLE_SQL_C_SINT_TYPE | out_priority |
Query results. | |
Protected Member Functions | |
void | reset () |
Reset the cursor at the beginning of a query. | |
void | add_station_info (Record &rec) |
Query extra station info and add it to rec. | |
int | getcount (const Record &query, unsigned int wanted, unsigned int modifiers) |
Return the number of results for a query. |
Structure used to build and execute a query, and to iterate through the results.
int dballe::db::Cursor::getcount | ( | const Record & | query, |
unsigned int | wanted, | ||
unsigned int | modifiers | ||
) | [protected] |
Return the number of results for a query.
This is the same as Cursor::query, but it does a SELECT COUNT(*) only.
bool dballe::db::Cursor::next | ( | ) |
Get a new item from the results of a query.
int dballe::db::Cursor::query | ( | const Record & | query, |
unsigned int | wanted, | ||
unsigned int | modifiers | ||
) |
Create and execute a database query.
The results are retrieved by iterating the cursor.
query | The record with the query data (see technical specifications, par. 1.6.4 "parameter output/input" |
wanted | The values wanted in output |
modifiers | Optional modifiers to ask for special query behaviours |
int dballe::db::Cursor::remaining | ( | ) | const |
Get the number of rows still to be fetched.
void dballe::db::Cursor::to_record | ( | Record & | rec | ) |
Fill in a record with the contents of a dba_db_cursor.
rec | The record where to store the values |