libdballe
6.8
|
Structure used to build and execute a query, and to iterate through the results. More...
#include <cursor.h>
Public Member Functions | |
Cursor (v5::DB &db) | |
virtual dballe::DB & | get_db () const |
Get the database that created this cursor. | |
int | query (const Record &query, unsigned int wanted, unsigned int modifiers) |
Create and execute a database query. More... | |
void | query_datetime_extremes (const Record &query, Record &result) |
int | remaining () const |
Get the number of rows still to be fetched. More... | |
bool | next () |
Get a new item from the results of a query. More... | |
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. More... | |
virtual int | get_station_id () const |
Get the station identifier. | |
virtual double | get_lat () const |
Get the station latitude. | |
virtual double | get_lon () const |
Get the station longitude. | |
virtual const char * | get_ident (const char *def=0) const |
Get the station identifier, or NULL if missing. | |
virtual const char * | get_rep_memo (const char *def=0) const |
Get the report name. | |
virtual Level | get_level () const |
Get the level. | |
virtual Trange | get_trange () const |
Get the level. | |
virtual void | get_datetime (int(&dt)[6]) const |
Get the datetime. | |
virtual wreport::Varcode | get_varcode () const |
Get the variable code. | |
virtual wreport::Var | get_var () const |
Get the variable. | |
virtual int | attr_reference_id () const |
Return an integer value that can be used to refer to the current variable for attribute access. | |
unsigned | query_attrs (const AttrList &qcs, Record &attrs) |
Query attributes for the current variable. | |
virtual void | attr_insert (const Record &attrs) |
Insert/overwrite new attributes for the current variable. More... | |
virtual void | attr_remove (const AttrList &qcs) |
Delete attributes for the current variable. More... | |
![]() | |
virtual unsigned | test_iterate (FILE *dump=0) |
Iterate the cursor until the end, returning the number of items. More... | |
Data Fields | |
v5::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. | |
bool | query_station_vars |
True if we are querying station variables. | |
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. More... | |
Structure used to build and execute a query, and to iterate through the results.
|
virtual |
Insert/overwrite new attributes for the current variable.
attrs | The record with the attributes to be added |
Implements dballe::db::Cursor.
|
virtual |
Delete attributes for the current variable.
qcs | Array of WMO codes of the attributes to delete. If empty, all attributes associated to id_data will be deleted. |
Implements dballe::db::Cursor.
|
protected |
Return the number of results for a query.
This is the same as Cursor::query, but it does a SELECT COUNT(*) only.
|
virtual |
Get a new item from the results of a query.
Implements dballe::db::Cursor.
int dballe::db::v5::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 |
|
virtual |
Get the number of rows still to be fetched.
Implements dballe::db::Cursor.
|
virtual |
Fill in a record with the contents of a dba_db_cursor.
rec | The record where to store the values |
Implements dballe::db::Cursor.