2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <dpl/wrt-dao-ro/WrtDatabase.h>
19 #include <dpl/db/thread_database_support.h>
20 #include <dpl/db/sql_connection.h>
21 #include <dpl/thread.h>
22 #include <dpl/wrt-dao-ro/global_config.h>
25 const char* WrtDatabase::Address()
27 using namespace WrtDB;
28 return GlobalConfig::GetWrtDatabaseFilePath();
31 DPL::DB::SqlConnection::Flag::Type WrtDatabase::Flags()
33 return DPL::DB::SqlConnection::Flag::UseLucene;
36 DPL::DB::ThreadDatabaseSupport WrtDatabase::m_interface(
37 WrtDatabase::Address(),
38 WrtDatabase::Flags());
40 void WrtDatabase::attachToThreadRO()
42 m_interface.AttachToThread(DPL::DB::SqlConnection::Flag::RO);
45 void WrtDatabase::attachToThreadRW()
47 m_interface.AttachToThread(DPL::DB::SqlConnection::Flag::RW);
50 void WrtDatabase::detachFromThread()
52 m_interface.DetachFromThread();
55 DPL::DB::ThreadDatabaseSupport& WrtDatabase::interface()
60 bool WrtDatabase::CheckTableExist(const char *name)
62 return m_interface.CheckTableExist(name);