libdballe  6.8
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
dballe::db::mem::Cursor Class Referenceabstract

Structure used to build and execute a query, and to iterate through the results. More...

#include <cursor.h>

Inheritance diagram for dballe::db::mem::Cursor:
dballe::db::Cursor

Public Member Functions

virtual dballe::DBget_db () const
 Get the database that created this cursor.
 
int remaining () const
 Get the number of rows still to be fetched.
 
virtual bool next ()=0
 Get a new item from the results of a query. More...
 
virtual void discard_rest ()=0
 Discard the results that have not been read yet.
 
unsigned query_attrs (const AttrList &qcs, Record &attrs)
 Query attributes for the current variable.
 
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.
 
- Public Member Functions inherited from dballe::db::Cursor
virtual void to_record (Record &rec)=0
 Fill in a record with the contents of a dba_db_cursor. More...
 
virtual void attr_insert (const Record &attrs)=0
 Insert/overwrite new attributes for the current variable. More...
 
virtual void attr_remove (const AttrList &qcs)=0
 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...
 

Static Public Member Functions

static std::auto_ptr< db::CursorcreateStations (mem::DB &db, unsigned modifiers, memdb::Results< memdb::Station > &res)
 
static std::auto_ptr< db::CursorcreateStationData (mem::DB &db, unsigned modifiers, memdb::Results< memdb::StationValue > &res)
 
static std::auto_ptr< db::CursorcreateData (mem::DB &db, unsigned modifiers, memdb::Results< memdb::Value > &res)
 
static std::auto_ptr< db::CursorcreateDataBest (mem::DB &db, unsigned modifiers, memdb::Results< memdb::Value > &res)
 
static std::auto_ptr< db::CursorcreateSummary (mem::DB &db, unsigned modifiers, memdb::Results< memdb::Value > &res)
 

Protected Member Functions

 Cursor (mem::DB &db, unsigned modifiers)
 Create a query cursor. More...
 
void to_record_station (Record &rec)
 
void to_record_levtr (Record &rec)
 
void to_record_varcode (Record &rec)
 
void to_record_value (Record &rec)
 
void add_station_info (Record &rec)
 Query extra station info and add it to rec.
 

Protected Attributes

mem::DBdb
 Database to operate on.
 
const unsigned int modifiers
 Modifier flags to enable special query behaviours.
 
size_t count
 Number of results still to be fetched.
 
const memdb::Stationcur_station
 
const memdb::Valuecur_value
 
const wreport::Var * cur_var
 

Detailed Description

Structure used to build and execute a query, and to iterate through the results.

Constructor & Destructor Documentation

dballe::db::mem::Cursor::Cursor ( mem::DB db,
unsigned  modifiers 
)
protected

Create a query cursor.

Parameters
wantedThe values wanted in output
modifiersOptional modifiers to ask for special query behaviours

Member Function Documentation

virtual bool dballe::db::mem::Cursor::next ( )
pure virtual

Get a new item from the results of a query.

Returns
true if a new record has been read, false if there is no more data to read

Implements dballe::db::Cursor.


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