wxPg::Cached_result Class Reference

Stores entire result of query locally. More...

Inheritance diagram for wxPg::Cached_result:

wxPg::Result_data_provider wxPg::Cached_row_provider wxPg::Data_row_provider wxPg::Data_row_provider

List of all members.

Classes

struct  value_info_

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_resultoperator= (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 bool null (int idx)
 Check if field value is NULL.
virtual const wxString get_str (int idx)
 Returns column value as wxString.
virtual int rows ()
 Get number of rows.
virtual bool current (int idx)
 Set current row.
virtual int current () const
 Get index of current row.


Detailed Description

Stores entire result of query locally.

Don't use it for storing very large results.


Constructor & Destructor Documentation

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.

Parameters:
src - a source object to be copied.

virtual wxPg::Cached_result::~Cached_result (  )  [virtual]

Destroy this object, fee resources.


Member Function Documentation

void wxPg::Cached_result::clear (  ) 

Clear contents of this object, fee resources.

virtual int wxPg::Cached_result::col_idx ( const wxString &  field  )  [virtual]

Get column index by name.

Parameters:
field - field name.
Returns:
0 - based column index, negative value for non existing field.

Implements wxPg::Data_row_provider.

virtual const wxString wxPg::Cached_result::col_name ( int  idx  )  [virtual]

Get field name by column index.

Parameters:
idx - column index.
Returns:
field name for column idx.

Implements wxPg::Data_row_provider.

virtual int wxPg::Cached_result::cols (  )  [virtual]

Get number of columns in a row.

Returns:
number of columns in a row.

Implements wxPg::Data_row_provider.

virtual int wxPg::Cached_result::current (  )  const [virtual]

Get index of current row.

Returns:
index of current row.

Implements wxPg::Result_data_provider.

virtual bool wxPg::Cached_result::current ( int  idx  )  [virtual]

Set current row.

Parameters:
idx - index of row to become current.
Returns:
true on success, false otherwise.

Implements wxPg::Result_data_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.

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

Implements wxPg::Data_row_provider.

virtual bool wxPg::Cached_result::null ( int  idx  )  [virtual]

Check if field value is NULL.

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

Implements wxPg::Data_row_provider.

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.

Parameters:
src - a source object to be copied.

virtual int wxPg::Cached_result::rows (  )  [virtual]

Get number of rows.

Returns:
number of rows in result.

Implements wxPg::Result_data_provider.

void wxPg::Cached_result::store ( const Database db,
PGresult *  res 
)

Store PGresult to this object.

Used internally. Cleans this object and stores PGresult.

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.

Parameters:
idx - column index.
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