Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

ODBCMetadataPlugin Class Reference

#include <ODBCMetadataPlugin.h>

Inheritance diagram for ODBCMetadataPlugin:

MetadataPlugin Plugin List of all members.

Public Methods

bool init ()
CoreError create (NumID &docid, const Document &document)
CoreError remove (NumID docid)
CoreError update (NumID docid, const Document &document)
CoreError get (NumID docid, Document &document)
CoreError lock (NumID docid, DocumentLock lock)
CoreError getLocks (map< NumID, DocumentLock > &locks)
CoreError query (NumID first, int maxlen, map< NumID, NumID > &updates)

Detailed Description

ODBCMetadataPlugin is a real working implementation of MetadataPlugin. It stores metadata in a central ODBC database. In the configfile can be specified which datasource.

To use an ODBC source create an odbc.ini file in your home directory. A sample odbc.ini can be found in the /doc directory. You should copy the file to "~/.odbc.ini".

Provided with the unixodbc package for debian is a qt program that helps you create an odbc.ini.

CREATE statement for use with a Postgresql server:

CREATE SEQUENCE documents_docid_seq;

CREATE SEQUENCE documents_updid_seq;

CREATE TABLE documents (
    docid BIGINT DEFAULT nextval('documents_docid_seq') UNIQUE NOT NULL,
    updid BIGINT DEFAULT nextval('documents_updid_seq') UNIQUE NOT NULL,
    lock CHAR DEFAULT 0,
    metadata TEXT NOT NULL
);

This class is multi-thread enabled.


Member Function Documentation

CoreError ODBCMetadataPlugin::create NumID &    docid,
const Document   document
[virtual]
 

Create a document.

Parameters:
docid  the reference that receives the new document ID
document  the new document information
Returns:
error code

Implements MetadataPlugin.

CoreError ODBCMetadataPlugin::get NumID    docid,
Document   document
[virtual]
 

Get a document

Parameters:
docid  the document to retrieve
document  the reference that receives the document information
Returns:
error code

Implements MetadataPlugin.

CoreError ODBCMetadataPlugin::getLocks map< NumID, DocumentLock > &    locks [virtual]
 

Get the active locks. Useful for cleaning up after a crash.

Parameters:
locks  the reference that receives the document locks
Returns:
error code

Implements MetadataPlugin.

bool ODBCMetadataPlugin::init   [virtual]
 

Sets up a connection with an ODBC datasource specified in config.

Returns:
true if plugin initialized succesfully, false otherwise

Implements Plugin.

CoreError ODBCMetadataPlugin::lock NumID    docid,
DocumentLock    lock
[virtual]
 

Lock the document.

Parameters:
docid  the document ID
lock  the document lock type
Returns:
error code

Implements MetadataPlugin.

CoreError ODBCMetadataPlugin::query NumID    first,
int    maxlen,
map< NumID, NumID > &    updates
[virtual]
 

Query document changes since 'first'.

Parameters:
first  the first update to return
maxlen  the maximum number of updates to return
updates  the reference that receives the updates
Returns:
error code

Implements MetadataPlugin.

CoreError ODBCMetadataPlugin::remove NumID    docid [virtual]
 

Remove a document.

Parameters:
docid  the document to remove
Returns:
error code

Implements MetadataPlugin.

CoreError ODBCMetadataPlugin::update NumID    docid,
const Document   document
[virtual]
 

Update a document

Parameters:
docid  the document that will be updated
document  the updated document information
Returns:
error code

Implements MetadataPlugin.


The documentation for this class was generated from the following files:
Generated on Wed Feb 18 13:45:56 2004 for strongroom by doxygen1.2.18