#include <Query.hpp>
Inherited by pion::plugins::SQLiteDatabase::SQLiteQuery.
Definition at line 56 of file Query.hpp.
Public Types | |
|
typedef std::pair< std::string, Vocabulary::Term > | FieldData |
| data type for a pair where first is a field name, and second is Term info | |
| typedef std::vector< FieldData > | FieldMap |
| data type for a map of Term references to database field names | |
| typedef std::vector< std::string > | IndexMap |
Public Member Functions | |
| virtual | ~Query () |
| virtual destructor -> this class is just an interface | |
| virtual void | bindNull (unsigned int param)=0 |
| virtual void | bindString (unsigned int param, const std::string &value, bool copy_value=true)=0 |
| virtual void | fetchString (unsigned int param, std::string &value)=0 |
| virtual void | bindBlob (unsigned int param, const char *value, size_t size, bool copy_value=true)=0 |
| virtual void | fetchBlob (unsigned int param, std::string &value)=0 |
| void | bindZBlob (unsigned int param, const char *value, size_t size, bool copy_value=true) |
| void | fetchZBlob (unsigned int param, std::string &value) |
| virtual void | bindString (unsigned int param, const char *value, bool copy_value=true)=0 |
| virtual void | bindInt (unsigned int param, const boost::int32_t value)=0 |
| virtual boost::int32_t | fetchInt (unsigned int param)=0 |
| virtual void | bindUInt (unsigned int param, const boost::uint32_t value)=0 |
| virtual boost::uint32_t | fetchUInt (unsigned int param)=0 |
| virtual void | bindBigInt (unsigned int param, const boost::int64_t value)=0 |
| virtual boost::int64_t | fetchBigInt (unsigned int param)=0 |
| virtual void | bindUBigInt (unsigned int param, const boost::uint64_t value)=0 |
| virtual boost::uint64_t | fetchUBigInt (unsigned int param)=0 |
| virtual void | bindFloat (unsigned int param, const float value)=0 |
| virtual float | fetchFloat (unsigned int param)=0 |
| virtual void | bindDouble (unsigned int param, const double value)=0 |
| virtual double | fetchDouble (unsigned int param)=0 |
| virtual void | bindLongDouble (unsigned int param, const long double value)=0 |
| virtual long double | fetchLongDouble (unsigned int param)=0 |
| virtual void | bindDateTime (unsigned int param, const PionDateTime &value)=0 |
| virtual void | fetchDateTime (unsigned int param, PionDateTime &val)=0 |
| virtual void | bindDate (unsigned int param, const PionDateTime &value)=0 |
| virtual void | fetchDate (unsigned int param, PionDateTime &val)=0 |
| virtual void | bindTime (unsigned int param, const PionDateTime &value)=0 |
| virtual void | fetchTime (unsigned int param, PionDateTime &val)=0 |
| void | bindEvent (const FieldMap &field_map, const Event &e, bool copy_strings=true) |
| void | fetchEvent (const FieldMap &field_map, EventPtr e) |
| virtual bool | run (void)=0 |
| virtual bool | runFullQuery (const FieldMap &ins, const EventPtr &src, const FieldMap &outs, EventPtr &dest, unsigned int limit, const boost::regex &suppress)=0 |
| bool | runFullQuery (const FieldMap &ins, const EventPtr &src, const FieldMap &outs, EventPtr &dest, unsigned int limit) |
| Same as runFullQuery, but no errors are suppressed. | |
| virtual bool | runFullGetMore (const FieldMap &outs, EventPtr &dest, unsigned int limit)=0 |
| virtual void | reset (void)=0 |
| resets the compiled query so that it can be run again | |
| const std::string & | getSQL (void) const |
| returns the SQL that was compiled to initialize this query | |
Protected Member Functions | |
| Query (const std::string &sql_query) | |
| char * | getDateString (const pion::PionDateTime &t) const |
| char * | getTimeString (const pion::PionDateTime &t) const |
| char * | getDateTimeString (const pion::PionDateTime &t) const |
Static Protected Member Functions | |
| static void | writeDateString (char *buf, const pion::PionDateTime &t) |
| static void | writeTimeString (char *buf, const pion::PionDateTime &t) |
| static void | writeDateTimeString (char *buf, const pion::PionDateTime &t) |
| pion::platform::Query::Query | ( | const std::string & | sql_query | ) | [inline, protected] |
| virtual void pion::platform::Query::bindBigInt | ( | unsigned int | param, | |
| const boost::int64_t | value | |||
| ) | [pure virtual] |
binds a big integer value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindBlob | ( | unsigned int | param, | |
| const char * | value, | |||
| size_t | size, | |||
| bool | copy_value = true | |||
| ) | [pure virtual] |
binds a std::string value to a query parameter (BLOB)
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter | |
| copy_value | if true, the string will be copied into a temporary buffer |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent(), and bindZBlob().
| virtual void pion::platform::Query::bindDate | ( | unsigned int | param, | |
| const PionDateTime & | value | |||
| ) | [pure virtual] |
binds a date value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindDateTime | ( | unsigned int | param, | |
| const PionDateTime & | value | |||
| ) | [pure virtual] |
binds a date_time value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindDouble | ( | unsigned int | param, | |
| const double | value | |||
| ) | [pure virtual] |
binds a double floating point number value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| void pion::platform::Query::bindEvent | ( | const FieldMap & | field_map, | |
| const Event & | e, | |||
| bool | copy_strings = true | |||
| ) | [inline] |
binds the data contained within an Event to the query parameters (this asssumes that field_map is ordered the same as the parameters)
| field_map | mapping of Vocabulary Terms to Database fields | |
| e | the Event containing data to bind to the query | |
| copy_strings | if true, the strings will be copied into temporary buffers |
Definition at line 407 of file Query.hpp.
References bindBigInt(), bindBlob(), bindDate(), bindDateTime(), bindDouble(), bindFloat(), bindInt(), bindLongDouble(), bindNull(), bindString(), bindTime(), bindUBigInt(), bindUInt(), bindZBlob(), pion::platform::BasicEvent< CharType, AllocType >::getPointer(), pion::platform::Vocabulary::TYPE_BLOB, pion::platform::Vocabulary::TYPE_CHAR, pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, pion::platform::Vocabulary::TYPE_DOUBLE, pion::platform::Vocabulary::TYPE_FLOAT, pion::platform::Vocabulary::TYPE_INT16, pion::platform::Vocabulary::TYPE_INT32, pion::platform::Vocabulary::TYPE_INT64, pion::platform::Vocabulary::TYPE_INT8, pion::platform::Vocabulary::TYPE_LONG_DOUBLE, pion::platform::Vocabulary::TYPE_LONG_STRING, pion::platform::Vocabulary::TYPE_NULL, pion::platform::Vocabulary::TYPE_OBJECT, pion::platform::Vocabulary::TYPE_SHORT_STRING, pion::platform::Vocabulary::TYPE_STRING, pion::platform::Vocabulary::TYPE_TIME, pion::platform::Vocabulary::TYPE_UINT16, pion::platform::Vocabulary::TYPE_UINT32, pion::platform::Vocabulary::TYPE_UINT64, pion::platform::Vocabulary::TYPE_UINT8, and pion::platform::Vocabulary::TYPE_ZBLOB.
Referenced by pion::plugins::SQLiteDatabase::SQLiteQuery::runFullQuery().
| virtual void pion::platform::Query::bindFloat | ( | unsigned int | param, | |
| const float | value | |||
| ) | [pure virtual] |
binds a floating point number value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindInt | ( | unsigned int | param, | |
| const boost::int32_t | value | |||
| ) | [pure virtual] |
binds an integer value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindLongDouble | ( | unsigned int | param, | |
| const long double | value | |||
| ) | [pure virtual] |
binds a long double floating point number value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindNull | ( | unsigned int | param | ) | [pure virtual] |
binds a NULL value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindString | ( | unsigned int | param, | |
| const char * | value, | |||
| bool | copy_value = true | |||
| ) | [pure virtual] |
binds a string (const char *) value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter | |
| copy_value | if true, the string will be copied into a temporary buffer |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
| virtual void pion::platform::Query::bindString | ( | unsigned int | param, | |
| const std::string & | value, | |||
| bool | copy_value = true | |||
| ) | [pure virtual] |
binds a std::string value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter | |
| copy_value | if true, the string will be copied into a temporary buffer |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindTime | ( | unsigned int | param, | |
| const PionDateTime & | value | |||
| ) | [pure virtual] |
binds a time value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindUBigInt | ( | unsigned int | param, | |
| const boost::uint64_t | value | |||
| ) | [pure virtual] |
binds an unsigned big integer value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| virtual void pion::platform::Query::bindUInt | ( | unsigned int | param, | |
| const boost::uint32_t | value | |||
| ) | [pure virtual] |
binds an unsigned integer value to a query parameter
| param | the query parameter number to which the value will be bound (starting with 0) | |
| value | the value to bind to the query parameter |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by bindEvent().
| char* pion::platform::Query::getDateString | ( | const pion::PionDateTime & | t | ) | const [inline, protected] |
return static buffer with date string (Y-m-d)
| t | timestamp to use for writing |
Definition at line 365 of file Query.hpp.
References writeDateString().
Referenced by pion::plugins::SQLiteDatabase::SQLiteQuery::bindDate().
| char* pion::platform::Query::getDateTimeString | ( | const pion::PionDateTime & | t | ) | const [inline, protected] |
return static buffer with date and time string (Y-m-d H-M-S)
| buf | buffer to write to (size must be > 19 bytes) |
Definition at line 389 of file Query.hpp.
References writeDateTimeString().
Referenced by pion::plugins::SQLiteDatabase::SQLiteQuery::bindDateTime().
| char* pion::platform::Query::getTimeString | ( | const pion::PionDateTime & | t | ) | const [inline, protected] |
return static buffer with time string (H-M-S)
| buf | buffer to write to (size must be > 8 bytes) |
Definition at line 377 of file Query.hpp.
References writeTimeString().
Referenced by pion::plugins::SQLiteDatabase::SQLiteQuery::bindTime().
| virtual bool pion::platform::Query::run | ( | void | ) | [pure virtual] |
runs the compiled query
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
| virtual bool pion::platform::Query::runFullGetMore | ( | const FieldMap & | outs, | |
| EventPtr & | dest, | |||
| unsigned int | limit | |||
| ) | [pure virtual] |
gets more results for generic query
| outs | a FieldMap of output fields | |
| dest | output event, used for outs FieldMap | |
| limit | how many results max |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
| virtual bool pion::platform::Query::runFullQuery | ( | const FieldMap & | ins, | |
| const EventPtr & | src, | |||
| const FieldMap & | outs, | |||
| EventPtr & | dest, | |||
| unsigned int | limit, | |||
| const boost::regex & | suppress | |||
| ) | [pure virtual] |
runs a generic query
| ins | a FieldMap of input fields | |
| src | input event, used for ins FieldMap | |
| outs | a FieldMap of output fields | |
| dest | output event, used for outs FieldMap | |
| limit | how many results max | |
| suppress | regex containing pattern of suppressable errors |
Implemented in pion::plugins::SQLiteDatabase::SQLiteQuery.
Referenced by runFullQuery().
| static void pion::platform::Query::writeDateString | ( | char * | buf, | |
| const pion::PionDateTime & | t | |||
| ) | [inline, static, protected] |
writes simple date string into buffer (Y-m-d)
| buf | buffer to write to (size must be > 10 bytes) | |
| t | timestamp to use for writing |
Definition at line 322 of file Query.hpp.
Referenced by getDateString().
| static void pion::platform::Query::writeDateTimeString | ( | char * | buf, | |
| const pion::PionDateTime & | t | |||
| ) | [inline, static, protected] |
writes simple date & time string into buffer (Y-m-d H-M-S)
| buf | buffer to write to (size must be > 19 bytes) | |
| t | timestamp to use for writing |
Definition at line 348 of file Query.hpp.
Referenced by getDateTimeString().
| static void pion::platform::Query::writeTimeString | ( | char * | buf, | |
| const pion::PionDateTime & | t | |||
| ) | [inline, static, protected] |
writes simple time string into buffer (H-M-S)
| buf | buffer to write to (size must be > 8 bytes) | |
| t | timestamp to use for writing |
Definition at line 335 of file Query.hpp.
Referenced by getTimeString().
1.4.7