SQLKeyValueStore Class Reference
[Client]

This abstract class represent an implementation of KeyValueStore based on a generic SQL database. More...

#include <SQLKeyValueStore.h>

Inheritance diagram for SQLKeyValueStore:
[legend]
Collaboration diagram for SQLKeyValueStore:
[legend]

List of all members.

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 EnumerationgetProperties () const
 Get all the properties that are currently defined.
virtual int removeAllProperties ()
 Ensure that all properties are stored persistently.

Protected Member Functions

virtual Enumerationquery (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


Detailed Description

This abstract class represent an implementation of KeyValueStore based on a generic SQL database.

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.)


Member Function Documentation

virtual StringBuffer SQLKeyValueStore::readPropertyValue ( const char *  prop  )  const [virtual]

Returns the value of the given property.

Parameters:
prop - the property name
Returns:
A NULL StringBuffer in the returned implies that the property was not set. Otherwise the value it was set to is returned (which can be "", the empty string).

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.

Returns:
0 - success, failure otherwise Remove all properties

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.

Parameters:
prop the name of the property which is to be removed
Returns:
int 0 on success, an error code otherwise

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().

Parameters:
prop - the property name
value - the property value (zero terminated string)
Returns:
int 0 on success, an error code otherwise

Implements KeyValueStore.


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

Generated on Tue Apr 6 13:00:42 2010 for Funambol Outlook Plug-in Library by  doxygen 1.5.7.1