Public Member Functions | |
Cached_result () | |
Create new empty object. | |
Cached_result (const Cached_result &src) | |
Copy constructor, creates a copy of other Cached_result. | |
Cached_result & | operator= (const Cached_result &src) |
Assign one Cached result to other. | |
virtual | ~Cached_result () |
Destroy this object, fee resources. | |
void | store (const Database &db, PGresult *res) |
Store PGresult to this object. | |
void | clear () |
Clear contents of this object, fee resources. | |
virtual int | cols () |
Get number of columns in a row. | |
virtual const wxString | col_name (int idx) |
Get field name by column index. | |
virtual int | col_idx (const wxString &field) |
Get column index by name. | |
virtual int | type_simple (int idx) |
Returns type of column (for built in types only). | |
virtual int | type_simple (const wxString &field) |
Returns type of field (for built in types only). | |
virtual bool | null (int idx) |
Check if field value is NULL. | |
virtual bool | null (const wxString &field) |
Check if field value is NULL. | |
virtual int | get_int (int idx) |
Returns column value as integer. | |
virtual int | get_int (const wxString &field) |
Returns column value as integer. | |
virtual double | get_float (int idx) |
Returns column value as double. | |
virtual double | get_float (const wxString &field) |
Returns column value as double. | |
virtual const wxString | get_str (int idx) |
Returns column value as wxString. | |
virtual const wxString | get_str (const wxString &field) |
Returns column value as wxString. | |
virtual const wxDateTime | get_date (int idx) |
Returns column value as date. | |
virtual const wxDateTime | get_date (const wxString &field) |
Returns column value as date. | |
virtual const wxDateTime | get_time (int idx) |
Returns column value as time. | |
virtual const wxDateTime | get_time (const wxString &field) |
Returns column value as time. | |
virtual const wxDateTime | get_date_time (int idx) |
Returns column value as date&time. | |
virtual const wxDateTime | get_date_time (const wxString &field) |
Returns column value as date&time. | |
virtual bool | get_bool (int idx) |
Returns column value as bool (intended for boolean type columns). | |
virtual bool | get_bool (const wxString &field) |
Returns column value as bool (intended for boolean type columns). | |
virtual int | rows () |
Get number of rows. | |
virtual bool | current (int idx) |
Set current row. | |
virtual int | current () const |
Get index of current row. | |
Classes | |
struct | value_info_ |
Don't use it for storing very large results.
wxPg::Cached_result::Cached_result | ( | ) |
Create new empty object.
wxPg::Cached_result::Cached_result | ( | const Cached_result & | src | ) |
Copy constructor, creates a copy of other Cached_result.
Note, that source object will be entirely copied, no memory will be shared between two objects.
src | - a source object to be copied. |
virtual wxPg::Cached_result::~Cached_result | ( | ) | [virtual] |
Destroy this object, fee resources.
Cached_result& wxPg::Cached_result::operator= | ( | const Cached_result & | src | ) |
Assign one Cached result to other.
Any data, contained by this object will be freed.
Note, that source object will be entirely copied, no memory will be shared between two objects.
src | - a source object to be copied. |
void wxPg::Cached_result::store | ( | const Database & | db, | |
PGresult * | res | |||
) |
Store PGresult to this object.
Used internally. Cleans this object and stores PGresult.
void wxPg::Cached_result::clear | ( | ) |
Clear contents of this object, fee resources.
virtual int wxPg::Cached_result::cols | ( | ) | [virtual] |
Get number of columns in a row.
Implements wxPg::Data_row_provider.
virtual const wxString wxPg::Cached_result::col_name | ( | int | idx | ) | [virtual] |
Get field name by column index.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual int wxPg::Cached_result::col_idx | ( | const wxString & | field | ) | [virtual] |
Get column index by name.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual int wxPg::Cached_result::type_simple | ( | int | idx | ) | [virtual] |
Returns type of column (for built in types only).
If type of column is not built in or there is no column whith such index, wxPg::TYPE_UNKNOWN is returned. See type.h.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual int wxPg::Cached_result::type_simple | ( | const wxString & | field | ) | [virtual] |
Returns type of field (for built in types only).
If type of column is not built in or there is no such field ir a row, wxPg::TYPE_UNKNOWN is returned. See type.h.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual bool wxPg::Cached_result::null | ( | int | idx | ) | [virtual] |
Check if field value is NULL.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual bool wxPg::Cached_result::null | ( | const wxString & | field | ) | [virtual] |
Check if field value is NULL.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual int wxPg::Cached_result::get_int | ( | int | idx | ) | [virtual] |
Returns column value as integer.
If value is NULL and in case of error 0 is returned.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual int wxPg::Cached_result::get_int | ( | const wxString & | field | ) | [virtual] |
Returns column value as integer.
If value is NULL and in case of error 0 is returned.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual double wxPg::Cached_result::get_float | ( | int | idx | ) | [virtual] |
Returns column value as double.
If value is NULL and in case of error 0.0 is returned.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual double wxPg::Cached_result::get_float | ( | const wxString & | field | ) | [virtual] |
Returns column value as double.
If value is NULL and in case of error 0.0 is returned.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual const wxString wxPg::Cached_result::get_str | ( | int | idx | ) | [virtual] |
Returns column value as wxString.
If value is NULL and in case of error empty string is returned.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual const wxString wxPg::Cached_result::get_str | ( | const wxString & | field | ) | [virtual] |
Returns column value as wxString.
If value is NULL and in case of error empty string is returned.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual const wxDateTime wxPg::Cached_result::get_date | ( | int | idx | ) | [virtual] |
Returns column value as date.
If value is NULL and in case of error new wxDateTime object is returned.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual const wxDateTime wxPg::Cached_result::get_date | ( | const wxString & | field | ) | [virtual] |
Returns column value as date.
If value is NULL and in case of error new wxDateTime object is returned.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual const wxDateTime wxPg::Cached_result::get_time | ( | int | idx | ) | [virtual] |
Returns column value as time.
If value is NULL and in case of error new wxDateTime object is returned.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual const wxDateTime wxPg::Cached_result::get_time | ( | const wxString & | field | ) | [virtual] |
Returns column value as time.
If value is NULL and in case of error new wxDateTime object is returned.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual const wxDateTime wxPg::Cached_result::get_date_time | ( | int | idx | ) | [virtual] |
Returns column value as date&time.
If value is NULL and in case of error new wxDateTime object is returned.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual const wxDateTime wxPg::Cached_result::get_date_time | ( | const wxString & | field | ) | [virtual] |
Returns column value as date&time.
If value is NULL and in case of error new wxDateTime object is returned.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual bool wxPg::Cached_result::get_bool | ( | int | idx | ) | [virtual] |
Returns column value as bool (intended for boolean type columns).
NULL is interpreted as false.
For numeric fields, 0 is interpreted as false, anything else as true.
For string fields, empty string is false, non empty is true.
idx | - column index. |
Implements wxPg::Data_row_provider.
virtual bool wxPg::Cached_result::get_bool | ( | const wxString & | field | ) | [virtual] |
Returns column value as bool (intended for boolean type columns).
NULL is interpreted as false.
For numeric fields, 0 is interpreted as false, anything else as true.
For string fields, empty string is false, non empty is true.
field | - field name. |
Implements wxPg::Data_row_provider.
virtual int wxPg::Cached_result::rows | ( | ) | [virtual] |
virtual bool wxPg::Cached_result::current | ( | int | idx | ) | [virtual] |
Set current row.
idx | - index of row to become current. |
Implements wxPg::Result_data_provider.
virtual int wxPg::Cached_result::current | ( | ) | const [virtual] |