Main Page | Alphabetical List | Class List | File List | Class Members

Database Class Reference

List of all members.

Public Member Functions

 Database (const char *dbname, int mode)
 ~Database ()
void close ()
int put_doc (Document *doc, int options)
ResultIteratorsearch (Cond *cond, int options)
const char * get_err_msg ()
const char * get_fatal_err_msg ()
int flush (int _max)
int sync ()
int optimize (int options)
int out_doc (int id, int options)
int uri_to_id (const char *uri)
std::map< std::string, std::string > * etch_doc (Document *doc, int max)
int iter_init ()
int iter_next ()
const char * db_name ()
int doc_num ()
int word_num ()
double size ()
void set_cache_size (size_t size, int anum, int tnum)

Private Attributes

ESTMTDB * db

Constructor & Destructor Documentation

Database::Database const char *  dbname,
int  mode
[inline]
 

open the database

Definition at line 225 of file HyperEstraierWrapper.cpp.

References db.

00225                                            {
00229         int ecode;
00230         if (!(db = est_mtdb_open(dbname, mode, &ecode))) {
00231             throw est_err_msg(ecode);
00232         }
00233     }

Database::~Database  )  [inline]
 

Definition at line 234 of file HyperEstraierWrapper.cpp.

References close().

00234                 {
00235         close();
00236     }


Member Function Documentation

void Database::close  )  [inline]
 

close the database

Definition at line 237 of file HyperEstraierWrapper.cpp.

References db.

Referenced by ~Database().

00237                  {
00241         if (db) {
00242             int ecode;
00243             if (!(est_mtdb_close(db, &ecode))) {
00244                 throw est_err_msg(ecode);
00245             }
00246             db = NULL;
00247         }
00248     }

const char* Database::db_name  )  [inline]
 

get the name of a database

Definition at line 332 of file HyperEstraierWrapper.cpp.

References db.

00332                            {
00336         return est_mtdb_name(db);
00337     }

int Database::doc_num  )  [inline]
 

get the number of documents in a database

Definition at line 338 of file HyperEstraierWrapper.cpp.

References db.

00338                   {
00342         return est_mtdb_doc_num(db);
00343     }

std::map<std::string, std::string>* Database::etch_doc Document doc,
int  max
[inline]
 

extract keywords of a document object

Definition at line 305 of file HyperEstraierWrapper.cpp.

References db, and Document::doc.

00305                                                                      {
00309         std::map<std::string, std::string> * mss = new std::map<std::string, std::string>;
00310 
00311         CBMAP * keys = est_mtdb_etch_doc(db, doc->doc, max);
00312 
00313         cbmapiterinit(keys);
00314         int ksiz;
00315         while (const char *key = cbmapiternext(keys, &ksiz)) {
00316             mss->insert(std::make_pair(key, cbmapget(keys, key, ksiz, NULL)));
00317         }
00318         return mss;
00319     }

int Database::flush int  _max  )  [inline]
 

flush index words in the cache of a database

Definition at line 275 of file HyperEstraierWrapper.cpp.

References db.

00275                         {
00279         return est_mtdb_flush(db, _max);
00280     }

const char* Database::get_err_msg  )  [inline]
 

get the string of an error

Definition at line 263 of file HyperEstraierWrapper.cpp.

References db.

00263                                {
00267         return est_err_msg(est_mtdb_error(db));
00268     }

const char* Database::get_fatal_err_msg  )  [inline]
 

get the string of an fatal error

Definition at line 269 of file HyperEstraierWrapper.cpp.

References db.

00269                                      {
00273         return est_err_msg(est_mtdb_fatal(db));
00274     }

int Database::iter_init  )  [inline]
 

initialize the iterator of a database

Definition at line 320 of file HyperEstraierWrapper.cpp.

References db.

00320                     {
00324         return est_mtdb_iter_init(db);
00325     }

int Database::iter_next  )  [inline]
 

get the next ID of the iterator of a database

Definition at line 326 of file HyperEstraierWrapper.cpp.

References db.

00326                     {
00330         return est_mtdb_iter_next(db);
00331     }

int Database::optimize int  options  )  [inline]
 

optimize a database

Definition at line 287 of file HyperEstraierWrapper.cpp.

References db.

00287                               {
00291         return est_mtdb_optimize(db, options);
00292     }

int Database::out_doc int  id,
int  options
[inline]
 

remove a document from a database

Definition at line 293 of file HyperEstraierWrapper.cpp.

References db.

00293                                      {
00297         return est_mtdb_out_doc(db, id, options);
00298     }

int Database::put_doc Document doc,
int  options
[inline]
 

add a document to a database

Definition at line 249 of file HyperEstraierWrapper.cpp.

References db, and Document::doc.

00249                                             {
00253         return est_mtdb_put_doc(db, doc->doc, options);
00254     }

ResultIterator* Database::search Cond cond,
int  options
[inline]
 

search documents corresponding a condition for a database

Definition at line 255 of file HyperEstraierWrapper.cpp.

References Cond::cond, and db.

00255                                                       {
00259         int resnum;
00260         int * result = est_mtdb_search(db, cond->cond, &resnum, NULL);
00261         return new ResultIterator(db, result, resnum, options);
00262     }

void Database::set_cache_size size_t  size,
int  anum,
int  tnum
[inline]
 

set the maximum size of the cache memory of a database

Definition at line 356 of file HyperEstraierWrapper.cpp.

References db.

00356                                                          {
00360         est_mtdb_set_cache_size(db, size, anum, tnum);
00361     }

double Database::size  )  [inline]
 

get the size of a database

Definition at line 350 of file HyperEstraierWrapper.cpp.

References db.

00350                   {
00354         return est_mtdb_size(db);
00355     }

int Database::sync  )  [inline]
 

synchronize updating contents of a database

Definition at line 281 of file HyperEstraierWrapper.cpp.

References db.

00281                {
00285         return est_mtdb_sync(db);
00286     }

int Database::uri_to_id const char *  uri  )  [inline]
 

get the ID of a document spacified by URI

Definition at line 299 of file HyperEstraierWrapper.cpp.

References db.

00299                                    {
00303         return est_mtdb_uri_to_id(db, uri);
00304     }

int Database::word_num  )  [inline]
 

get the number of unique words in a database

Definition at line 344 of file HyperEstraierWrapper.cpp.

References db.

00344                    {
00348         return est_mtdb_word_num(db);
00349     }


Member Data Documentation

ESTMTDB* Database::db [private]
 

Definition at line 223 of file HyperEstraierWrapper.cpp.

Referenced by close(), Database(), db_name(), doc_num(), etch_doc(), flush(), get_err_msg(), get_fatal_err_msg(), iter_init(), iter_next(), optimize(), out_doc(), put_doc(), search(), set_cache_size(), size(), sync(), uri_to_id(), and word_num().


The documentation for this class was generated from the following file:
Generated on Sat Jun 11 14:47:05 2005 for HyperEstraierWrapper by  doxygen 1.4.2