#include <SQLKeyValueStore.h>
Public Member Functions | |
SQLKeyValueStore (const StringBuffer &table, const StringBuffer &colKey, const StringBuffer &colValue) | |
virtual int | connect ()=0 |
virtual int | disconnect ()=0 |
virtual StringBuffer | readPropertyValue (const char *prop) const |
Returns the value of the given property. | |
virtual int | setPropertyValue (const char *prop, const char *value) |
Sets a property value. | |
virtual int | removeProperty (const char *prop) |
Remove a certain property. | |
virtual Enumeration & | getProperties () const |
Get all the properties that are currently defined. | |
virtual int | removeAllProperties () |
Ensure that all properties are stored persistently. | |
Protected Member Functions | |
virtual Enumeration & | query (const StringBuffer &sql) const =0 |
virtual int | execute (const StringBuffer &sql)=0 |
virtual StringBuffer | sqlColKey () const |
virtual StringBuffer | sqlColValue () const |
virtual StringBuffer | sqlRemovePropertyString (const StringBuffer &key) const |
virtual StringBuffer | sqlSetPropertyString (const StringBuffer &key, const StringBuffer &value) const |
virtual StringBuffer | sqlGetPropertyString (const StringBuffer &key) const |
virtual StringBuffer | sqlGetAllString () const |
virtual StringBuffer | sqlCountAllString () const |
Private Attributes | |
StringBuffer | table |
StringBuffer | colKey |
StringBuffer | colValue |
ArrayListEnumeration | toSet |
ArrayListEnumeration | toDel |
It allows the developer to specify the column to use for the key and value, the table name to use for the storage, and requires to implement the methods to connect/disconnect to the database, which are specific to the db driver in use (odbc, etc.)
virtual StringBuffer SQLKeyValueStore::readPropertyValue | ( | const char * | prop | ) | const [virtual] |
Returns the value of the given property.
prop | - the property name |
Implements KeyValueStore.
virtual int SQLKeyValueStore::removeAllProperties | ( | ) | [virtual] |
Ensure that all properties are stored persistently.
If setting a property led to an error earlier, this call will indicate the failure.
int 0 on success, an error code otherwise
Implements KeyValueStore.
Reimplemented in BlockingSQLiteKeyValueStore.
virtual int SQLKeyValueStore::removeProperty | ( | const char * | prop | ) | [virtual] |
Remove a certain property.
prop | the name of the property which is to be removed |
Implements KeyValueStore.
virtual int SQLKeyValueStore::setPropertyValue | ( | const char * | prop, | |
const char * | value | |||
) | [virtual] |
Sets a property value.
The value might be cached inside the implementation of this interface. To ensure that it is stored persistently and to do error checking, call save().
prop | - the property name | |
value | - the property value (zero terminated string) |
Implements KeyValueStore.