Public Member Functions | |
Query_browser (Database *db, unsigned buf_size=DEF_BUFFER_SIZE) | |
Create new object. | |
virtual | ~Query_browser () |
Destroys object. | |
void | buffer_size (unsigned size) |
Change buffer size. | |
unsigned | buffer_size () const |
Get buffer size. | |
virtual void | first () |
Go to first row in result. | |
virtual void | last () |
Go to last row in result. | |
virtual bool | next () |
Go to next row in result. | |
virtual bool | prev () |
Go to previous row in result. | |
virtual bool | open (const wxString &sql) |
Open query - execute sql statement. | |
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. | |
virtual bool | current (int new_curr) |
Set current row. | |
unsigned long long | abs_pos () const |
Absolute position in result. | |
long long | cursor_pos () const |
Database cursor position. | |
bool | is_last () const |
Is currently active row last in result. | |
unsigned long long | record_count () const |
Get number of rows in result. | |
Static Public Attributes | |
static const unsigned | DEF_BUFFER_SIZE = 50 |
Default buffer size. |
An object of this class keep a certain amount rows fetched to local buffer and alows working with entire result without worying about record fetching. NOTE: its not recomended to use fetch() and move() methods of this class.
wxPg::Query_browser::Query_browser | ( | Database * | db, | |
unsigned | buf_size = DEF_BUFFER_SIZE | |||
) | [explicit] |
Create new object.
db | - database connection. | |
buf_size | - buffer size, specifies a number of rows to be fetched to local buffer. |
virtual wxPg::Query_browser::~Query_browser | ( | ) | [virtual] |
Destroys object.
void wxPg::Query_browser::buffer_size | ( | unsigned | size | ) |
Change buffer size.
It is strongly recomended NOT to call this method when Query_browser is open.
size | - new buffer size. |
unsigned wxPg::Query_browser::buffer_size | ( | ) | const |
Get buffer size.
virtual void wxPg::Query_browser::first | ( | ) | [virtual] |
Go to first row in result.
virtual void wxPg::Query_browser::last | ( | ) | [virtual] |
Go to last row in result.
virtual bool wxPg::Query_browser::next | ( | ) | [virtual] |
Go to next row in result.
virtual bool wxPg::Query_browser::prev | ( | ) | [virtual] |
Go to previous row in result.
virtual bool wxPg::Query_browser::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.
sql | specifies an SQL statement. |
Reimplemented from wxPg::Query.
virtual bool wxPg::Query_browser::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.
rows | - number of rows to be fetched. Ignored for some flags. | |
flag | sould be one of fetch and move actions. |
Reimplemented from wxPg::Query.
virtual bool wxPg::Query_browser::move | ( | int | rows, | |
int | flag = FM_FORWARD | |||
) | [virtual] |
Move cursor to different row without fetching data.
rows | specifiels number of rows to move. Ignored for some flags. | |
flag | sould be one of fetch and move actions. Not all are accepted. |
Reimplemented from wxPg::Query.
virtual bool wxPg::Query_browser::current | ( | int | idx | ) | [virtual] |
Set current row.
idx | - index of row to become current. |
Reimplemented from wxPg::Result_data.
unsigned long long wxPg::Query_browser::abs_pos | ( | ) | const |
Absolute position in result.
Don't mix this with current(), which returns position in current buffer.
long long wxPg::Query_browser::cursor_pos | ( | ) | const |
Database cursor position.
This function returns position of cursor, used for reading data from result.
bool wxPg::Query_browser::is_last | ( | ) | const |
Is currently active row last in result.
This method returns false until the end of result is reached and the number of rows in result is known.
unsigned long long wxPg::Query_browser::record_count | ( | ) | const |
Get number of rows in result.
The exact number of rows in result is unknown until the end of result is reached.
const unsigned wxPg::Query_browser::DEF_BUFFER_SIZE = 50 [static] |
Default buffer size.
Such amount of rows is fetched by default from query.