IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
net
routing
security
storage
BundleIndex.cpp
BundleIndex.h
BundleResult.cpp
BundleResult.h
BundleSeeker.h
BundleSelector.h
BundleStorage.cpp
BundleStorage.h
DataStorage.cpp
DataStorage.h
MemoryBundleStorage.cpp
MemoryBundleStorage.h
MetaStorage.cpp
MetaStorage.h
SimpleBundleStorage.cpp
SimpleBundleStorage.h
SQLiteBundleSet.cpp
SQLiteBundleSet.h
SQLiteBundleStorage.cpp
SQLiteBundleStorage.h
SQLiteConfigure.cpp
SQLiteConfigure.h
SQLiteDatabase.cpp
SQLiteDatabase.h
CapsuleWorker.cpp
CapsuleWorker.h
Component.cpp
Component.h
config.h
Configuration.cpp
Configuration.h
Debugger.cpp
Debugger.h
DevNull.cpp
DevNull.h
DTNTPWorker.cpp
DTNTPWorker.h
EchoWorker.cpp
EchoWorker.h
Main.cpp
NativeDaemon.cpp
NativeDaemon.h
NTService.cpp
ibrcommon
ibrdtn
tools
File Members
SQLiteConfigure.cpp
Go to the documentation of this file.
1
/*
2
* SQLiteConfigure.cpp
3
*
4
* Copyright (C) 2011 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
* Written-by: Matthias Myrtus
8
*
9
* Licensed under the Apache License, Version 2.0 (the "License");
10
* you may not use this file except in compliance with the License.
11
* You may obtain a copy of the License at
12
*
13
* http://www.apache.org/licenses/LICENSE-2.0
14
*
15
* Unless required by applicable law or agreed to in writing, software
16
* distributed under the License is distributed on an "AS IS" BASIS,
17
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
* See the License for the specific language governing permissions and
19
* limitations under the License.
20
*
21
*/
22
#include "
storage/SQLiteConfigure.h
"
23
#include <sqlite3.h>
24
#include <iostream>
25
#include <
ibrcommon/thread/MutexLock.h
>
26
#include <
ibrcommon/Logger.h
>
27
28
namespace
dtn
29
{
30
namespace
storage
31
{
32
ibrcommon::Mutex
SQLiteConfigure::_mutex;
33
bool
SQLiteConfigure::_isSet =
false
;
34
35
void
SQLiteConfigure::configure
()
36
{
37
//Configure SQLite Library
38
ibrcommon::MutexLock
lock =
ibrcommon::MutexLock
(_mutex);
39
40
if
(!_isSet)
41
{
42
int
err = sqlite3_config(SQLITE_CONFIG_SERIALIZED);
43
44
if
(err != SQLITE_OK)
45
{
46
IBRCOMMON_LOGGER_TAG
(
"SQLiteConfigure"
,
error
) <<
"SQLite configure failed: "
<< err <<
IBRCOMMON_LOGGER_ENDL
;
47
throw
ibrcommon::Exception
(
"unable to set serialized sqlite configuration"
);
48
}
49
50
_isSet =
true
;
51
52
// initialize sqlite
53
sqlite3_initialize();
54
}
55
}
56
57
void
SQLiteConfigure::shutdown
()
58
{
59
sqlite3_shutdown();
60
}
61
}
62
}
daemon
src
storage
SQLiteConfigure.cpp
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4