wxPg::Data_row Class Reference

Class, representing a single row of SQL query result. More...

Inheritance diagram for wxPg::Data_row:

wxPg::DB_client wxPg::Data_row_provider wxPg::Result_data wxPg::Query wxPg::Query_browser

List of all members.

Public Member Functions

 Data_row (Database *db)
 Creates new object.
virtual ~Data_row ()
 Destroys object.
Databasedatabase () const
 Get database for this object.
void database (Database *db)
 Change database connection for this object.
virtual void detach ()
 Detach notification from Database.
void result (PGresult *res)
 Set PGresult for the object.
PGresult * result ()
 Returns PGresult of the object.
virtual void clear ()
 Clears result, frees 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).

Protected Attributes

int current_
PGresult * result_


Detailed Description

Class, representing a single row of SQL query result.


Constructor & Destructor Documentation

wxPg::Data_row::Data_row ( Database db  )  [explicit]

Creates new object.

You shouldn't need to create Data_row object yourself.

Parameters:
db - database connection.

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

Destroys object.


Member Function Documentation

Database* wxPg::Data_row::database (  )  const [inline]

Get database for this object.

Returns:
database connection for this object.

void wxPg::Data_row::database ( Database db  )  [inline]

Change database connection for this object.

virtual void wxPg::Data_row::detach (  )  [virtual]

Detach notification from Database.

This methon is called by wPg::Database, when client is detached because of external reasons (Such as database disconnect).

Implements wxPg::DB_client.

void wxPg::Data_row::result ( PGresult *  res  )  [inline]

Set PGresult for the object.

Used internally.

PGresult* wxPg::Data_row::result (  )  [inline]

Returns PGresult of the object.

virtual void wxPg::Data_row::clear (  )  [virtual]

Clears result, frees resources.

Reimplemented in wxPg::Query.

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

Get number of columns in a row.

Returns:
number of columns in a row.

Implements wxPg::Data_row_provider.

virtual const wxString wxPg::Data_row::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::Data_row::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 int wxPg::Data_row::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.

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

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

virtual bool wxPg::Data_row::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::Data_row::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 int wxPg::Data_row::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 double wxPg::Data_row::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 double wxPg::Data_row::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 const wxString wxPg::Data_row::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 const wxString wxPg::Data_row::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::Data_row::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::Data_row::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::Data_row::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 const wxDateTime wxPg::Data_row::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::Data_row::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 const wxDateTime wxPg::Data_row::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 bool wxPg::Data_row::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 bool wxPg::Data_row::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.


Generated on Thu May 7 22:51:17 2009 for wxPostgres by  doxygen 1.5.6