wxPg::Query Class Reference

Class for executing SQL queries, returning result. More...

Inheritance diagram for wxPg::Query:

wxPg::Result_data wxPg::Data_row wxPg::Result_data_provider wxPg::DB_client wxPg::Data_row_provider wxPg::Data_row_provider wxPg::Query_browser

List of all members.

Public Types

enum  {
  FM_FIRST = 1, FM_LAST, FM_ABSOLUTE, FM_RELATIVE,
  FM_ALL, FM_FORWARD, FM_FORWARD_ALL, FM_BACKWARD,
  FM_BACKWARD_ALL
}
 Fetch and move actions. More...

Public Member Functions

 Query (Database *db)
 Create new query object for database.
virtual ~Query ()
 Destroy query object, free resources.
virtual void clear ()
 Closes query and frees resources.
virtual bool open (const wxString &sql)
 Open query - execute sql statement.
const wxString last_err () const
 Returns message for last error.
virtual bool fetch (int rows, int flag=FM_FORWARD)
 Fetch data of some rows.
virtual bool move (int rows, int flag=FM_FORWARD)
 Move cursor to different row without fetching data.

Public Attributes

const wxString PORTAL_NAME
 Name of portal, used by this query.


Detailed Description

Class for executing SQL queries, returning result.


Member Enumeration Documentation

anonymous enum

Fetch and move actions.

Enumerator:
FM_FIRST  Fetch or move to first.

FM_LAST  Fetch or move to last.

FM_ABSOLUTE  Fetch or move to row by absolute index.

FM_RELATIVE  Fetch or move to row by relative to current index.

FM_ALL  Fetch all.

FM_FORWARD  Fetch or move in forward direction.

FM_FORWARD_ALL  Fetch all records in forward direction.

FM_BACKWARD  Fetch or move in backward direction.

FM_BACKWARD_ALL  Fetch all in backward direction.


Constructor & Destructor Documentation

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

Create new query object for database.

Parameters:
db - database connection.

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

Destroy query object, free resources.


Member Function Documentation

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

Closes query and frees resources.

Reimplemented from wxPg::Data_row.

virtual bool wxPg::Query::open ( const wxString &  sql  )  [virtual]

Open query - execute sql statement.

Call last_err() for error message. Call fetch() to get all or part of returned result.

Parameters:
sql specifies an SQL statement.
Returns:
- true on success and false on error.

Reimplemented in wxPg::Query_browser.

const wxString wxPg::Query::last_err (  )  const

Returns message for last error.

virtual bool wxPg::Query::fetch ( int  rows,
int  flag = FM_FORWARD 
) [virtual]

Fetch data of some rows.

You need to call this method to obtain any data from query.

Parameters:
rows - number of rows to be fetched. Ignored for some flags.
flag sould be one of fetch and move actions.
Returns:
- true on success, false on error.

Reimplemented in wxPg::Query_browser.

virtual bool wxPg::Query::move ( int  rows,
int  flag = FM_FORWARD 
) [virtual]

Move cursor to different row without fetching data.

Parameters:
rows specifiels number of rows to move. Ignored for some flags.
flag sould be one of fetch and move actions. Not all are accepted.
Returns:
- true on success, false on error.

Reimplemented in wxPg::Query_browser.


Member Data Documentation

const wxString wxPg::Query::PORTAL_NAME

Name of portal, used by this query.

Used internally.


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