wxPg::Cached_row_provider Class Reference

Abstract class, representing a single cached row of SQL query result. More...

Inheritance diagram for wxPg::Cached_row_provider:

wxPg::Data_row_provider wxPg::Cached_result wxPg::Updatable_row

List of all members.

Public Member Functions

virtual ~Cached_row_provider ()
 Destructor.
virtual int type_simple (const wxString &field)
 Returns type of field (for built in types only).
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 (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).

Protected Member Functions

virtual const wxString format_cached_value (const char *value, int type, const Database &db) const
 Translate value, retrieved from database to cache value.


Detailed Description

Abstract class, representing a single cached row of SQL query result.


Constructor & Destructor Documentation

virtual wxPg::Cached_row_provider::~Cached_row_provider (  )  [inline, virtual]

Destructor.


Member Function Documentation

virtual const wxString wxPg::Cached_row_provider::format_cached_value ( const char *  value,
int  type,
const Database db 
) const [protected, virtual]

Translate value, retrieved from database to cache value.

Used for translating values from PQgetvalue() to wxString.

Parameters:
value - value from database.
type - data type.
db - database connection.
Returns:
string value for cache.

virtual bool wxPg::Cached_row_provider::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.

Parameters:
field - field name.
Returns:
bool representation of column value.

Implements wxPg::Data_row_provider.

virtual bool wxPg::Cached_row_provider::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.

Parameters:
idx - column index.
Returns:
bool representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxDateTime wxPg::Cached_row_provider::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.

Parameters:
field - field name.
Returns:
date representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxDateTime wxPg::Cached_row_provider::get_date ( int  idx  )  [virtual]

Returns column value as date.

If value is NULL and in case of error new wxDateTime object is returned.

Parameters:
idx - column index.
Returns:
date representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxDateTime wxPg::Cached_row_provider::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.

Parameters:
field - field name.
Returns:
date&time representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxDateTime wxPg::Cached_row_provider::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.

Parameters:
idx - column index.
Returns:
date&time representation of column value.

Implements wxPg::Data_row_provider.

virtual double wxPg::Cached_row_provider::get_float ( const wxString &  field  )  [virtual]

Returns column value as double.

If value is NULL and in case of error 0.0 is returned.

Parameters:
field - field name.
Returns:
double representation of column value.

Implements wxPg::Data_row_provider.

virtual double wxPg::Cached_row_provider::get_float ( int  idx  )  [virtual]

Returns column value as double.

If value is NULL and in case of error 0.0 is returned.

Parameters:
idx - column index.
Returns:
double representation of column value.

Implements wxPg::Data_row_provider.

virtual int wxPg::Cached_row_provider::get_int ( const wxString &  field  )  [virtual]

Returns column value as integer.

If value is NULL and in case of error 0 is returned.

Parameters:
field - field name.
Returns:
integer representation of column value.

Implements wxPg::Data_row_provider.

virtual int wxPg::Cached_row_provider::get_int ( int  idx  )  [virtual]

Returns column value as integer.

If value is NULL and in case of error 0 is returned.

Parameters:
idx - column index.
Returns:
integer representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxString wxPg::Cached_row_provider::get_str ( const wxString &  field  )  [virtual]

Returns column value as wxString.

If value is NULL and in case of error empty string is returned.

Parameters:
field - field name.
Returns:
string representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxDateTime wxPg::Cached_row_provider::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.

Parameters:
field - field name.
Returns:
time representation of column value.

Implements wxPg::Data_row_provider.

virtual const wxDateTime wxPg::Cached_row_provider::get_time ( int  idx  )  [virtual]

Returns column value as time.

If value is NULL and in case of error new wxDateTime object is returned.

Parameters:
idx - column index.
Returns:
time representation of column value.

Implements wxPg::Data_row_provider.

virtual bool wxPg::Cached_row_provider::null ( const wxString &  field  )  [virtual]

Check if field value is NULL.

Parameters:
field - field name.
Returns:
true if value is NULL or field not exists, false otherwise.

Implements wxPg::Data_row_provider.

virtual int wxPg::Cached_row_provider::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.

Parameters:
field - field name.
Returns:
one of types, defined in type.h.

Implements wxPg::Data_row_provider.


Generated on Sat Sep 5 23:00:40 2009 for wxPostgres by  doxygen 1.5.8