Public Member Functions | Friends

BnSQLite Class Reference

This class is a thin wrapper for the SQLite database. More...

#include <BnSQLite.h>

Inheritance diagram for BnSQLite:
IdcAdapter

List of all members.

Public Member Functions

 BnSQLite (const char *name, bool(*pGetParam)(const char *, char *, int))
 ~BnSQLite ()
virtual BufferHolder Read (BufferHolder address) throw (BufferHolder)
 Reads some data from the adapter.
virtual bool Write (BufferHolder address, BufferHolder value) throw (BufferHolder)
 Writes some data to the adapter.
virtual bool IsMultiUse ()
 If you do not want more then one object from this adapter to exist at the same time, return False from this function.

Friends

int callback (void *p_this, int argc, char **argv, char **azColName)
 This function saves the query data to the record set vector.

Detailed Description

This class is a thin wrapper for the SQLite database.

It uses mostly the sqlite3_exec function to execute SQL commands. When executing a SELECT command, it saves the values, and the user can access this data.

Read: Reads the value of a filed in the current record. address can be a field name or a field number. if address is _LastError it returns a string of the last operation error (or "OK"). if address is _EOF it returns "True" if the current record is in the end of the records set, or "False".
Write: address can be MoveFirst, MoveNext, Clear or Exec. Clear clears the previously saved data. Exec executes the buffer value.

Note: You don't have to call Clear before running a new SELECT command. But if you don't, and the new SELECT has different fields then the previous one, you will be able to access the new data just by the field numbers. The fields names will still be of the first SELECT statement. Every SELECT adds the data to the end of the record set.

Configuration:
DB - path and file name of the database. If this file does not exist, SQLite creates a new database.

Definition at line 47 of file BnSQLite.h.


Constructor & Destructor Documentation

BnSQLite::BnSQLite ( const char *  name,
bool(*)(const char *, char *, int)  pGetParam 
)

Definition at line 23 of file BnSQLite.cpp.

BnSQLite::~BnSQLite (  )

Definition at line 38 of file BnSQLite.cpp.


Member Function Documentation

virtual bool BnSQLite::IsMultiUse (  ) [inline, virtual]

If you do not want more then one object from this adapter to exist at the same time, return False from this function.

This will overwrite what ever the user sets in the configuration files.

Reimplemented from IdcAdapter.

Definition at line 83 of file BnSQLite.h.

BufferHolder BnSQLite::Read ( BufferHolder  address ) throw (BufferHolder) [virtual]

Reads some data from the adapter.

Parameters:
addressThe address (or name) of data to read.
Returns:
(BufferHolder) Holds the result string. This string has to stay alive at least until the next call to Read (or to the Destructor).
Exceptions:
(BufferHolder)A pointer to an inner string. You have to keep this string alive at least until the next call to this adapter (or until the call to the Destructor)

Implements IdcAdapter.

Definition at line 45 of file BnSQLite.cpp.

bool BnSQLite::Write ( BufferHolder  address,
BufferHolder  value 
) throw (BufferHolder) [virtual]

Writes some data to the adapter.

Parameters:
addressThe address (or name) of data to write.
valueThe value to write to this address (Note that it might be empty!).
Returns:
(bool) True on success or False if the action failed.
Exceptions:
(BufferHolder)A pointer to an inner string. You have to keep this string alive at least until the next call to this adapter (or until the call to the Destructor)

Implements IdcAdapter.

Definition at line 98 of file BnSQLite.cpp.


Friends And Related Function Documentation

int callback ( void *  p_this,
int  argc,
char **  argv,
char **  azColName 
) [friend]

This function saves the query data to the record set vector.

Definition at line 4 of file BnSQLite.cpp.


The documentation for this class was generated from the following files: