LTP GCOV extension - code coverage report
Current view: directory - src/libstore - db.hh
Test: app.info
Date: 2004-12-21 Instrumented lines: 1
Code covered: 0.0 % Executed lines: 0

       1                 : #ifndef __DB_H
       2                 : #define __DB_H
       3                 : 
       4                 : #include <string>
       5                 : #include <list>
       6                 : #include <map>
       7                 : 
       8                 : #include <db_cxx.h>
       9                 : 
      10                 : #include "util.hh"
      11                 : 
      12                 : using namespace std;
      13                 : 
      14                 : 
      15                 : class Database;
      16                 : 
      17                 : 
      18                 : class Transaction
      19                 : {
      20                 :     friend class Database;
      21                 : 
      22                 : private:
      23                 :     DbTxn * txn;
      24                 :     
      25                 : public:
      26                 :     Transaction();
      27                 :     Transaction(Database & _db);
      28                 :     ~Transaction();
      29                 : 
      30                 :     void abort();
      31                 :     void commit();
      32                 : 
      33                 :     void moveTo(Transaction & t);
      34                 : };
      35                 : 
      36                 : 
      37                 : #define noTxn Transaction()
      38                 : 
      39                 : 
      40                 : typedef unsigned int TableId; /* table handles */
      41                 : 
      42                 : 
      43                 : class Database
      44                 : {
      45                 :     friend class Transaction;
      46                 : 
      47                 : private:
      48                 :     DbEnv * env;
      49                 : 
      50                 :     int fdLock;
      51                 :     int fdAccessors;
      52                 : 
      53                 :     TableId nextId;
      54                 :     map<TableId, Db *> tables;
      55                 : 
      56                 :     void requireEnv();
      57                 : 
      58                 :     Db * getDb(TableId table);
      59                 : 
      60                 : public:
      61                 :     Database();
      62                 :     ~Database();
      63                 :     
      64                 :     void open(const string & path);
      65                 :     void close();
      66                 : 
      67                 :     TableId openTable(const string & table);
      68                 : 
      69                 :     bool queryString(const Transaction & txn, TableId table, 
      70                 :         const string & key, string & data);
      71                 : 
      72                 :     bool queryStrings(const Transaction & txn, TableId table, 
      73                 :         const string & key, Strings & data);
      74                 : 
      75                 :     void setString(const Transaction & txn, TableId table,
      76                 :         const string & key, const string & data);
      77                 : 
      78                 :     void setStrings(const Transaction & txn, TableId table,
      79                 :         const string & key, const Strings & data,
      80                 :         bool deleteEmpty = true);
      81                 : 
      82                 :     void delPair(const Transaction & txn, TableId table,
      83                 :         const string & key);
      84                 : 
      85                 :     void enumTable(const Transaction & txn, TableId table,
      86                 :         Strings & keys);
      87                 : };
      88                 : 
      89                 : 
      90                 : class DbNoPermission : public Error
      91                 : {
      92                 : public:
      93               0 :     DbNoPermission(const format & f) : Error(f) { };
      94                 : };
      95                 : 
      96                 : 
      97                 : #endif /* !__DB_H */

Generated by: LTP GCOV extension version 1.1