reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
BerkeleyDb.hxx
Go to the documentation of this file.
1
#if !defined(RESIP_BERKELEYDB_HXX)
2
#define RESIP_BERKELEYDB_HXX
3
4
#ifdef WIN32
5
#include <db_cxx.h>
6
#elif HAVE_CONFIG_H
7
#include "config.h"
8
#include DB_HEADER
9
//#elif defined(__APPLE__)
10
//#include <db42/db_cxx.h>
11
#else
12
#include <db_cxx.h>
13
#endif
14
15
#include "
rutil/Data.hxx
"
16
#include "
repro/AbstractDb.hxx
"
17
18
namespace
resip
19
{
20
class
TransactionUser;
21
}
22
23
namespace
repro
24
{
25
26
class
BerkeleyDb
:
public
AbstractDb
27
{
28
public
:
29
BerkeleyDb
();
30
BerkeleyDb
(
const
resip::Data
&
dbPath
,
const
resip::Data
&
dbName
=
resip::Data::Empty
);
31
32
virtual
~BerkeleyDb
();
33
34
virtual
bool
isSane
() {
return
mSane; }
35
36
private
:
37
void
init(
const
resip::Data
&
dbPath
,
const
resip::Data
&
dbName
);
38
static
int
getSecondaryKeyCallback(
Db
*
db
,
const
Dbt
*
pkey
,
const
Dbt
*
pdata
,
Dbt
*
skey
);
39
40
class
TableInfo
41
{
42
public
:
43
TableInfo() : mDb(0), mCursor(0), mTransaction(0), mSecondaryDb(0), mSecondaryCursor(0) {}
44
Db
* mDb;
45
Dbc
* mCursor;
46
DbTxn
* mTransaction;
47
Db
* mSecondaryDb;
48
Dbc
* mSecondaryCursor;
49
};
50
51
DbEnv* mEnv;
52
TableInfo mTableInfo[
MaxTable
];
53
54
bool
mSane;
55
56
// Db manipulation routines
57
virtual
bool
dbWriteRecord(
const
Table
table
,
58
const
resip::Data
& key,
59
const
resip::Data
& data);
60
virtual
bool
dbReadRecord(
const
Table
table
,
61
const
resip::Data
& key,
62
resip::Data
& data)
const
;
// return false if not found
63
virtual
void
dbEraseRecord(
const
Table
table
,
64
const
resip::Data
& key,
65
bool
isSecondaryKey
=
false
);
// allows deleting records from a table that supports secondary keying using a secondary key
66
virtual
resip::Data
dbNextKey(
const
Table
table
,
67
bool
first
=
true
);
// return empty if no more
68
virtual
bool
dbNextRecord(
const
Table
table
,
69
const
resip::Data
& key,
70
resip::Data
& data,
71
bool
forUpdate
,
72
bool
first
=
false
);
// return false if no more
73
virtual
bool
dbBeginTransaction(
const
Table
table
);
74
virtual
bool
dbCommitTransaction(
const
Table
table
);
75
virtual
bool
dbRollbackTransaction(
const
Table
table
);
76
};
77
78
}
79
#endif
80
81
/* ====================================================================
82
* The Vovida Software License, Version 1.0
83
*
84
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
85
*
86
* Redistribution and use in source and binary forms, with or without
87
* modification, are permitted provided that the following conditions
88
* are met:
89
*
90
* 1. Redistributions of source code must retain the above copyright
91
* notice, this list of conditions and the following disclaimer.
92
*
93
* 2. Redistributions in binary form must reproduce the above copyright
94
* notice, this list of conditions and the following disclaimer in
95
* the documentation and/or other materials provided with the
96
* distribution.
97
*
98
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
99
* and "Vovida Open Communication Application Library (VOCAL)" must
100
* not be used to endorse or promote products derived from this
101
* software without prior written permission. For written
102
* permission, please contact vocal@vovida.org.
103
*
104
* 4. Products derived from this software may not be called "VOCAL", nor
105
* may "VOCAL" appear in their name, without prior written
106
* permission of Vovida Networks, Inc.
107
*
108
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
109
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
110
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
111
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
112
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
113
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
114
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
115
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
116
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
117
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
118
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
119
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
120
* DAMAGE.
121
*
122
* ====================================================================
123
*
124
* This software consists of voluntary contributions made by Vovida
125
* Networks, Inc. and many individuals on behalf of Vovida Networks,
126
* Inc. For more information on Vovida Networks, Inc., please see
127
* <http://www.vovida.org/>.
128
*
129
*/
AbstractDb.hxx
Data.hxx
repro::AbstractDb
Definition
AbstractDb.hxx:19
repro::AbstractDb::Table
Table
Definition
AbstractDb.hxx:180
repro::AbstractDb::MaxTable
@ MaxTable
Definition
AbstractDb.hxx:189
repro::BerkeleyDb
Definition
BerkeleyDb.hxx:27
repro::BerkeleyDb::~BerkeleyDb
virtual ~BerkeleyDb()
Definition
BerkeleyDb.cxx:232
repro::BerkeleyDb::BerkeleyDb
BerkeleyDb()
Definition
BerkeleyDb.cxx:24
repro::BerkeleyDb::isSane
virtual bool isSane()
Definition
BerkeleyDb.hxx:34
resip::Data
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition
Data.hxx:90
resip::Data::Empty
static const Data Empty
Constant that represents a zero-length data.
Definition
Data.hxx:882
repro
This Class is used to implement a primitive form of RPC using loose XML formatting.
Definition
AbstractDb.hxx:16
resip
dcm! – add UnusedChecking(_enum) below;
Definition
AbstractFifo.hxx:16
list
void list()
Definition
userAdmin.cxx:66
repro
BerkeleyDb.hxx
Generated by
1.9.8