Kexi API Documentation (2.0 alpha)

KexiDB::SQLiteCursor Class Reference

#include <sqlitecursor.h>

Inheritance diagram for KexiDB::SQLiteCursor:

KexiDB::Cursor KexiDB::Object List of all members.

Public Member Functions

virtual ~SQLiteCursor ()
virtual QVariant value (uint i)
virtual const char ** rowData () const
virtual void storeCurrentRow (RowData &data) const
virtual int serverResult ()
virtual QString serverResultName ()
virtual QString serverErrorMsg ()

Protected Member Functions

 SQLiteCursor (Connection *conn, const QString &statement, uint options=NoOptions)
 SQLiteCursor (Connection *conn, QuerySchema &query, uint options=NoOptions)
virtual bool drv_open ()
virtual bool drv_close ()
virtual void drv_getNextRecord ()
virtual void drv_appendCurrentRecordToBuffer ()
virtual void drv_bufferMovePointerNext ()
virtual void drv_bufferMovePointerPrev ()
virtual void drv_bufferMovePointerTo (Q_LLONG at)
virtual void drv_clearBuffer ()
virtual void drv_clearServerResult ()

Protected Attributes

SQLiteCursorData * d
 for future extensions

Friends

class SQLiteConnection

Constructor & Destructor Documentation

SQLiteCursor::~SQLiteCursor  )  [virtual]
 

Definition at line 214 of file sqlitecursor.cpp.

References KexiDB::Cursor::close(), and d.

SQLiteCursor::SQLiteCursor Connection conn,
const QString statement,
uint  options = NoOptions
[protected]
 

Cursor will operate on conn, raw statement will be used to execute query.

Definition at line 200 of file sqlitecursor.cpp.

References d.

SQLiteCursor::SQLiteCursor Connection conn,
QuerySchema query,
uint  options = NoOptions
[protected]
 

Cursor will operate on conn, query schema will be used to execute query.

Definition at line 207 of file sqlitecursor.cpp.

References d.


Member Function Documentation

void SQLiteCursor::drv_appendCurrentRecordToBuffer  )  [protected, virtual]
 

Stores currently fetched record's values in appropriate place of the buffer. Note for driver developers: This place can be computed using m_at. Do not change value of m_at or any other Cursor members, only change your internal structures like pointer to current row, etc. If your database engine's API function (for record fetching) do not allocates such a space, you want to allocate a space for current record. Otherwise, reuse existing structure, what could be more efficient. All functions like drv_appendCurrentRecordToBuffer() operates on the buffer, i.e. array of stored rows. You are not forced to have any particular fixed structure for buffer item or buffer itself - the structure is internal and only methods like storeCurrentRecord() visible to public.

Implements KexiDB::Cursor.

Definition at line 337 of file sqlitecursor.cpp.

References d, KexiDB::Cursor::m_fieldCount, and KexiDB::Cursor::m_records_in_buf.

void SQLiteCursor::drv_bufferMovePointerNext  )  [protected, virtual]
 

Moves pointer (that points to the buffer) -- to next item in this buffer. Note for driver developers: probably just execute "your_pointer++" is enough.

Implements KexiDB::Cursor.

Definition at line 354 of file sqlitecursor.cpp.

References d.

void SQLiteCursor::drv_bufferMovePointerPrev  )  [protected, virtual]
 

Like drv_bufferMovePointerNext() but execute "your_pointer--".

Implements KexiDB::Cursor.

Definition at line 359 of file sqlitecursor.cpp.

References d.

void SQLiteCursor::drv_bufferMovePointerTo Q_LLONG  at  )  [protected, virtual]
 

Moves pointer (that points to the buffer) to a new place: at.

Implements KexiDB::Cursor.

Definition at line 366 of file sqlitecursor.cpp.

References d.

void SQLiteCursor::drv_clearBuffer  )  [protected, virtual]
 

Method called when cursor's buffer need to be cleared (only for buffered cursor type), eg. in close().

Reimplemented from KexiDB::Cursor.

Definition at line 371 of file sqlitecursor.cpp.

References d, KexiDB::Cursor::m_fieldCount, and KexiDB::Cursor::m_records_in_buf.

void SQLiteCursor::drv_clearServerResult  )  [protected, virtual]
 

Clears an internal member that is used to storing last result code, the same that is returend by serverResult().

Implements KexiDB::Cursor.

Definition at line 562 of file sqlitecursor.cpp.

References d, and SQLITE_OK.

bool SQLiteCursor::drv_close  )  [protected, virtual]
 

Implements KexiDB::Cursor.

Definition at line 279 of file sqlitecursor.cpp.

References d, sqlite_finalize(), and SQLITE_OK.

void SQLiteCursor::drv_getNextRecord  )  [protected, virtual]
 

Implements KexiDB::Cursor.

Definition at line 293 of file sqlitecursor.cpp.

References d, KexiDB::Cursor::FetchEnd, KexiDB::Cursor::FetchError, KexiDB::Cursor::FetchOK, KexiDB::Cursor::m_fieldCount, KexiDB::Cursor::m_result, SQLITE_DONE, SQLITE_ROW, and sqlite_step().

bool SQLiteCursor::drv_open  )  [protected, virtual]
 

Implements KexiDB::Cursor.

Definition at line 220 of file sqlitecursor.cpp.

References d, KexiDB::Cursor::isBuffered(), KexiDB::Object::m_sql, sqlite_compile(), and SQLITE_OK.

const char ** SQLiteCursor::rowData  )  const [virtual]
 

[PROTOTYPE]

Returns:
current record data or NULL if there is no current records.

Implements KexiDB::Cursor.

Definition at line 420 of file sqlitecursor.cpp.

References d.

QString SQLiteCursor::serverErrorMsg  )  [virtual]
 

Returns:
(not i18n'd) description text (message) of last operation's error/result. In most cases engines do return such a messages, any user can then use this to refer a documentation. Note for driver developers: Leave the default implementation (null string is returned ) if your engine has no such capability.

Reimplemented from KexiDB::Cursor.

Definition at line 557 of file sqlitecursor.cpp.

References d.

int SQLiteCursor::serverResult  )  [virtual]
 

Stores string value taken from field number i to str.

Returns:
false when range checking failed. bool SQLiteCursor::storeStringValue(uint i, QString &str) { if (i > (m_fieldCount-1)) //range checking return false; str = d->curr_coldata[i]; return true; }

Reimplemented from KexiDB::Cursor.

Definition at line 543 of file sqlitecursor.cpp.

References d.

QString SQLiteCursor::serverResultName  )  [virtual]
 

Returns:
(not i18n'd) name of last executed operation's result at the server side. Sometimes engines have predefined its result names that can be used e.g. to refer a documentation. SQLite is one of such engines. Note for driver developers: Leave the default implementation (null string is returned ) if your engine has no such capability.

Reimplemented from KexiDB::Cursor.

Definition at line 548 of file sqlitecursor.cpp.

References d, and sqlite_error_string().

void SQLiteCursor::storeCurrentRow RowData data  )  const [virtual]
 

Puts current record's data into data (makes a deep copy). This have unspecified behaviour if the cursor is not at valid record. Note: For reimplementation in driver's code. Shortly, this method translates a row data from internal representation (probably also used in buffer) to simple public RecordData representation.

Implements KexiDB::Cursor.

Definition at line 425 of file sqlitecursor.cpp.

References KexiDB::Cursor::at(), KexiDB::Field::BigInteger, KexiDB::Field::Boolean, KexiDB::Field::Byte, d, KexiDB::Field::Date, KexiDB::Field::DateTime, KexiDB::Field::Integer, KexiDB::Field::isFPNumericType(), KexiDB::Field::isTextType(), KexiDB::Cursor::m_fieldCount, KexiDB::Cursor::m_fieldsExpanded, KexiDB::Field::ShortInteger, sqliteStringToBool(), KexiUtils::stringToHackedQTime(), KexiDB::Field::Time, and KexiDB::Field::type().

QVariant SQLiteCursor::value uint  i  )  [virtual]
 

Returns:
a value stored in column number i (counting from 0). Is has unspecified behaviour if the cursor is not at valid record. Note for driver developers: If i is >= than m_fieldCount, null QVariant value should be returned. To return a value typically you can use a pointer to internal structure that contain current row data (buffered or unbuffered).

Implements KexiDB::Cursor.

Definition at line 508 of file sqlitecursor.cpp.

References d, KexiDB::Field::isFPNumericType(), KexiDB::Field::isIntegerType(), KexiDB::Field::isTextType(), KexiDB::Cursor::m_fieldCount, and KexiDB::Cursor::m_fieldsExpanded.


Friends And Related Function Documentation

friend class SQLiteConnection [friend]
 

Definition at line 85 of file sqlitecursor.h.


Member Data Documentation

SQLiteCursorData* KexiDB::SQLiteCursor::d [protected]
 

for future extensions

Reimplemented from KexiDB::Cursor.

Definition at line 83 of file sqlitecursor.h.

Referenced by drv_appendCurrentRecordToBuffer(), drv_bufferMovePointerNext(), drv_bufferMovePointerPrev(), drv_bufferMovePointerTo(), drv_clearBuffer(), drv_clearServerResult(), drv_close(), drv_getNextRecord(), drv_open(), rowData(), serverErrorMsg(), serverResult(), serverResultName(), SQLiteCursor(), storeCurrentRow(), value(), and ~SQLiteCursor().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:50:43 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003