modules/widget_dao/database_checksum.h
modules/security_origin_dao/database_checksum_security_origin.h
modules/custom_handler_dao/database_checksum_custom_handler.h
-
+modules/certificate_dao/database_checksum_certificage.h
SET(TARGET_CUSTOM_HANDLER_DAO_RW_LIB "wrt-commons-custom-handler-dao-rw")
SET(TARGET_CUSTOM_HANDLER_DAO_RO_LIB "wrt-commons-custom-handler-dao-ro")
SET(TARGET_SECURITY_ORIGIN_DAO_LIB "wrt-commons-security-origin-dao")
+SET(TARGET_CERTIFICATE_DAO_LIB "wrt-commons-certificate-dao")
SET(TARGET_DPL_UTILS_EFL "lib${PROJECT_NAME}-utils-efl")
SET(TARGET_DPL_ENCRYPTION "lib${PROJECT_NAME}-encryption")
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(support)
ADD_SUBDIRECTORY(encryption)
+ADD_SUBDIRECTORY(certificate_dao)
--- /dev/null
+# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# @file CMakeLists.txt
+# @author Leerang Song (leerang.song@samsung.com)
+# @brief
+#
+
+configure_and_install_pkg(wrt-commons-certificate-dao.pc)
+
--- /dev/null
+prefix=/usr
+exec_prefix=${prefix}
+
+libdir=${prefix}/lib
+includedir=${prefix}/include
+Name: wrt-commons-certificate-dao
+Description: wrt-commons-certificate-dao
+
+Version: @VERSION@
+Requires: dpl-efl
+Libs: -lwrt-commons-certificate-dao -L${libdir}
+Cflags: -I${includedir}/dpl-efl
ADD_SUBDIRECTORY(auto_save_dao)
ADD_SUBDIRECTORY(security_origin_dao)
ADD_SUBDIRECTORY(custom_handler_dao)
+ADD_SUBDIRECTORY(certificate_dao)
include(utils/config.cmake)
include(localization/config.cmake)
include(support/config.cmake)
--- /dev/null
+SET(TARGET_CERTIFICATE_DAO_DB "Sqlite3DbCertificate")
+
+ADD_CUSTOM_COMMAND( OUTPUT .certificate.db
+ COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/.certificate.db
+ COMMAND gcc -Wall -I${PROJECT_SOURCE_DIR}/modules/db/include -I${PROJECT_SOURCE_DIR}/modules/certificate_dao/orm -E ${PROJECT_SOURCE_DIR}/modules/certificate_dao/orm/certificate_db_sql_generator.h | grep --invert-match "^#" > ${CMAKE_CURRENT_BINARY_DIR}/certificate_db.sql
+ COMMAND sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/.certificate.db ".read ${CMAKE_CURRENT_BINARY_DIR}/certificate_db.sql" || rm -f ${CMAKE_CURRENT_BINARY_DIR}/.certificate.db
+ DEPENDS ${PROJECT_SOURCE_DIR}/modules/certificate_dao/orm/certificate_db_sql_generator.h ${PROJECT_SOURCE_DIR}/modules/certificate_dao/orm/certificate_db
+ )
+
+ADD_CUSTOM_COMMAND( OUTPUT .certificate.db-journal
+ COMMAND touch
+ ARGS ${CMAKE_CURRENT_BINARY_DIR}/.certificate.db-journal
+ )
+
+ADD_CUSTOM_TARGET(${TARGET_CERTIFICATE_DAO_DB} ALL DEPENDS .certificate.db .certificate.db-journal)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/certificate_db.sql DESTINATION share/wrt-engine/)
+
+###############################################################################
+
+INCLUDE(FindPkgConfig)
+
+PKG_CHECK_MODULES(CERTIFICATE_DAO_DEPS
+ glib-2.0
+ REQUIRED)
+
+SET(CERTIFICATE_DAO_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}/modules/certificate_dao/include
+ ${PROJECT_SOURCE_DIR}/modules/certificate_dao/orm
+ ${PROJECT_SOURCE_DIR}/modules/core/include
+ ${PROJECT_SOURCE_DIR}/modules/db/include
+ ${PROJECT_SOURCE_DIR}/modules/log/include
+ ${PROJECT_SOURCE_DIR}/modules/widget_dao/include
+)
+
+SET(CERTIFICATE_DAO_SOURCES
+ dao/certificate_dao_types.cpp
+ dao/certificate_dao.cpp
+ dao/certificate_database.cpp
+)
+
+INCLUDE_DIRECTORIES(SYSTEM ${CERTIFICATE_DAO_DEPS_INCLUDE_DIRS} )
+INCLUDE_DIRECTORIES(${CERTIFICATE_DAO_INCLUDE_DIRS})
+
+ADD_LIBRARY(${TARGET_CERTIFICATE_DAO_LIB} SHARED ${CERTIFICATE_DAO_SOURCES})
+SET_TARGET_PROPERTIES(${TARGET_CERTIFICATE_DAO_LIB} PROPERTIES SOVERSION ${API_VERSION} VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(${TARGET_CERTIFICATE_DAO_LIB} ${TARGET_DPL_EFL} ${TARGET_DPL_DB_EFL} ${TARGET_WRT_DAP_RO_LIB} ${CERTIFICATE_DAO_DEPS_LIBRARIES})
+ADD_DEPENDENCIES(${TARGET_CERTIFICATE_DAO_LIB} ${TARGET_CERTIFICATE_DAO_DB})
+
+INSTALL(TARGETS ${TARGET_CERTIFICATE_DAO_LIB} DESTINATION lib)
+
+INSTALL(FILES
+ include/wrt-commons/certificate-dao/certificate_dao_types.h
+ include/wrt-commons/certificate-dao/certificate_database.h
+ include/wrt-commons/certificate-dao/certificate_dao.h
+ DESTINATION include/dpl-efl/wrt-commons/certificate-dao
+)
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file certificate_dao.cpp
+ * @author Leerang Song (leerang.song@samsung.com)
+ * @version 1.0
+ * @brief This file contains the definition of certificate dao class.
+ */
+
+#include <wrt-commons/certificate-dao/certificate_dao.h>
+#include <wrt-commons/certificate-dao/certificate_database.h>
+#include <wrt-commons/certificate-dao/certificate_dao_types.h>
+#include <orm_generator_certificate.h>
+#include <dpl/foreach.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/WrtDatabase.h>
+#include <dpl/wrt-dao-ro/widget_config.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+#include <sys/stat.h>
+#include <fstream>
+
+using namespace DPL::DB::ORM;
+using namespace DPL::DB::ORM::certificate;
+
+namespace CertificateDB {
+#define SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN Try
+
+#define SQL_CONNECTION_EXCEPTION_HANDLER_END(message) \
+ Catch(DPL::DB::SqlConnection::Exception::Base) { \
+ LogError(message); \
+ ReThrowMsg(CertificateDAO::Exception::DatabaseError, \
+ message); \
+ }
+
+namespace {
+DPL::DB::SqlConnection::Flag::Option CERTIFICATE_DB_OPTION =
+ DPL::DB::SqlConnection::Flag::RW;
+DPL::DB::SqlConnection::Flag::Type CERTIFICATE_DB_TYPE =
+ DPL::DB::SqlConnection::Flag::UseLucene;
+const char* const CERTIFICATE_DB_NAME = ".certificate.db";
+const char* const CERTIFICATE_DB_SQL_PATH =
+ "/usr/share/wrt-engine/certificate_db.sql";
+const char* const CERTIFICATE_DATABASE_JOURNAL_FILENAME = "-journal";
+
+const int WEB_APPLICATION_UID = 5000;
+const int WEB_APPLICATION_GUID = 5000;
+
+std::string createDatabasePath(const WrtDB::WidgetPkgName &pkgName)
+{
+ std::stringstream filename;
+
+ filename << WrtDB::WidgetConfig::GetWidgetPersistentStoragePath(pkgName)
+ << "/"
+ << CERTIFICATE_DB_NAME;
+ return filename.str();
+}
+
+std::string createDatabasePath(int widgetHandle)
+{
+ using namespace DPL::DB::ORM;
+ using namespace WrtDB::WidgetConfig;
+ using namespace WrtDB::GlobalConfig;
+
+ WrtDB::TizenAppId appid;
+
+ Try
+ {
+ appid = WrtDB::WidgetDAOReadOnly::getTzAppId(widgetHandle);
+ }
+ Catch(DPL::DB::SqlConnection::Exception::Base) {
+ LogError("Failed to get database Path");
+ }
+ return createDatabasePath(appid);
+}
+
+void checkDatabase(std::string databasePath)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ if (databasePath.empty()) {
+ ThrowMsg(CertificateDAO::Exception::DatabaseError,
+ "Wrong database Path is passed");
+ }
+
+ struct stat buffer;
+ if (stat(databasePath.c_str(), &buffer) != 0) {
+ //Create fresh database
+ LogInfo("Creating database " << databasePath);
+
+ std::fstream file;
+ file.open(CERTIFICATE_DB_SQL_PATH, std::ios_base::in);
+ if (!file) {
+ ThrowMsg(CertificateDAO::Exception::DatabaseError,
+ "Fail to get database Path");
+ }
+
+ std::stringstream ssBuffer;
+ ssBuffer << file.rdbuf();
+
+ file.close();
+
+ DPL::DB::SqlConnection con(databasePath,
+ CERTIFICATE_DB_TYPE,
+ CERTIFICATE_DB_OPTION);
+ con.ExecCommand(ssBuffer.str().c_str());
+ }
+
+ if(chown(databasePath.c_str(),
+ WEB_APPLICATION_UID,
+ WEB_APPLICATION_GUID) != 0)
+ {
+ ThrowMsg(CertificateDAO::Exception::DatabaseError,
+ "Fail to change uid/guid");
+ }
+ std::string databaseJournal =
+ databasePath + CERTIFICATE_DATABASE_JOURNAL_FILENAME;
+ if(chown(databaseJournal.c_str(),
+ WEB_APPLICATION_UID,
+ WEB_APPLICATION_GUID) != 0)
+ {
+ ThrowMsg(CertificateDAO::Exception::DatabaseError,
+ "Fail to change uid/guid");
+ }
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to get database Path")
+}
+}
+
+CertificateDAO::CertificateDAO(const WrtDB::WidgetPkgName &pkgName) :
+ m_certificateDBPath(createDatabasePath(pkgName)),
+ m_certificateDBInterface(m_certificateDBPath, CERTIFICATE_DB_TYPE)
+{
+ checkDatabase(m_certificateDBPath);
+ m_certificateDBInterface.AttachToThread(CERTIFICATE_DB_OPTION);
+}
+
+CertificateDAO::~CertificateDAO()
+{
+ m_certificateDBInterface.DetachFromThread();
+}
+
+CertificateDataList CertificateDAO::getCertificateDataList(void)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ CertificateDataList list;
+ CERTIFICATE_DB_SELECT(select,
+ CertificateInfo,
+ &m_certificateDBInterface);
+ typedef std::list<CertificateInfo::Row> RowList;
+ RowList rowList = select->GetRowList();
+
+ FOREACH(it, rowList) {
+ list.push_back(
+ CertificateDataPtr(
+ new CertificateData(it->Get_certificate())));
+ }
+ return list;
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get data list")
+}
+
+Result CertificateDAO::getResult(
+ const CertificateData &certificateData)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ CERTIFICATE_DB_SELECT(select,
+ CertificateInfo,
+ &m_certificateDBInterface);
+ select->Where(
+ Equals<CertificateInfo::certificate>(certificateData.certificate));
+ CertificateInfo::Select::RowList rows = select->GetRowList();
+
+ if (rows.empty()) {
+ return RESULT_UNKNOWN;
+ }
+ CertificateInfo::Row row = rows.front();
+ return static_cast<Result>(row.Get_result());
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END(
+ "Failed to get result for security certiInfo")
+}
+
+void CertificateDAO::setCertificateData(const CertificateData &certificateData,
+ const Result result)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ ScopedTransaction transaction(&m_certificateDBInterface);
+ CertificateInfo::Row row;
+ row.Set_certificate(certificateData.certificate);
+ row.Set_result(result);
+
+ if (true == hasResult(certificateData)) {
+ CERTIFICATE_DB_UPDATE(update,
+ CertificateInfo,
+ &m_certificateDBInterface);
+ update->Values(row);
+ update->Execute();
+ } else {
+ CERTIFICATE_DB_INSERT(insert,
+ CertificateInfo,
+ &m_certificateDBInterface);
+ insert->Values(row);
+ insert->Execute();
+ }
+ transaction.Commit();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to set security certiInfo data")
+}
+
+void CertificateDAO::removeCertificateData(
+ const CertificateData &certificateData)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ ScopedTransaction transaction(&m_certificateDBInterface);
+
+ if (true == hasResult(certificateData)) {
+ CERTIFICATE_DB_DELETE(del,
+ CertificateInfo,
+ &m_certificateDBInterface)
+ del->Where(
+ Equals<CertificateInfo::certificate>(certificateData.certificate));
+ del->Execute();
+ transaction.Commit();
+ }
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to set certiInfo data")
+}
+
+void CertificateDAO::removeCertificateData(const Result result)
+{
+ SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+ {
+ ScopedTransaction transaction(&m_certificateDBInterface);
+ CERTIFICATE_DB_DELETE(del,
+ CertificateInfo,
+ &m_certificateDBInterface)
+ del->Where(Equals<CertificateInfo::result>(result));
+ del->Execute();
+ transaction.Commit();
+ }
+ SQL_CONNECTION_EXCEPTION_HANDLER_END("Fail to remove data by result")
+}
+
+bool CertificateDAO::hasResult(const CertificateData &certificateData)
+{
+ Result res = getResult(certificateData);
+ return (res != RESULT_UNKNOWN);
+}
+
+#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
+#undef SQL_CONNECTION_EXCEPTION_HANDLER_END
+} // namespace CertificateDB
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @file certificate_dao_types.cpp
+ * @author Leerang Song (leerang.song@samsung.com)
+ * @version 1.0
+ * @brief This file contains the implementation of
+ * common data types for certificate.db
+ */
+
+#include <wrt-commons/certificate-dao/certificate_dao_types.h>
+#include <dpl/log/log.h>
+
+namespace CertificateDB {
+
+} // namespace CertificateDB
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <wrt-commons/certificate-dao/certificate_database.h>
+
+DPL::Mutex g_certificateDBQueriesMutex;
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file certificate_dao.h
+ * @author Leerang Song (leerang.song@samsung.com)
+ * @version 1.0
+ * @brief This file contains the declaration of certificate dao
+ */
+#ifndef _CERTIFICATE_DAO_H_
+#define _CERTIFICATE_DAO_H_
+
+#include <dpl/db/thread_database_support.h>
+#include <wrt-commons/certificate-dao/certificate_dao_types.h>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+
+namespace CertificateDB {
+class CertificateDAO
+{
+ public:
+ class Exception
+ {
+ public:
+ DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
+ DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
+ DECLARE_EXCEPTION_TYPE(Base, DataNotExist)
+ };
+
+ explicit CertificateDAO(const WrtDB::WidgetPkgName &pkgName);
+ virtual ~CertificateDAO();
+ CertificateDataList getCertificateDataList();
+ Result getResult(const CertificateData &certificateData);
+ void setCertificateData(const CertificateData &certificateData,
+ const Result result);
+ void removeCertificateData(const CertificateData &certificateData);
+ void removeCertificateData(const Result result);
+
+ private:
+ std::string m_certificateDBPath;
+ DPL::DB::ThreadDatabaseSupport m_certificateDBInterface;
+ bool hasResult(const CertificateData &certificateData);
+};
+
+typedef std::shared_ptr<CertificateDAO> CertificateDAOPtr;
+} // namespace CertificateDB
+
+#endif // _CERTIFICATE_DAO_H_
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ *
+ * @file certificate_dao_types.h
+ * @author Leerang Song (leerang.song@samsung.com)
+ * @version 1.0
+ * @brief This file contains the declaration of
+ * common data types for certificate database.
+ */
+#ifndef _CERTIFICATE_DAO_TYPES_H_
+#define _CERTIFICATE_DAO_TYPES_H_
+
+#include <list>
+#include <memory>
+#include <dpl/string.h>
+
+namespace CertificateDB {
+
+enum Result
+{
+ RESULT_UNKNOWN = 0,
+ RESULT_ALLOW_ONCE,
+ RESULT_DENY_ONCE,
+ RESULT_ALLOW_ALWAYS,
+ RESULT_DENY_ALWAYS
+};
+
+struct CertificateData
+{
+ DPL::String certificate;
+
+ CertificateData(const DPL::String& certi) :
+ certificate(certi)
+ {}
+
+ bool operator== (const CertificateData& other) const
+ {
+ return !(certificate == other.certificate);
+ }
+
+ bool operator!= (const CertificateData& other) const
+ {
+ return !(*this == other);
+ }
+};
+
+typedef std::shared_ptr<CertificateData> CertificateDataPtr;
+typedef std::list<CertificateDataPtr> CertificateDataList;
+} // namespace CertificateDB
+
+#endif // _CERTIFICATE_DAO_TYPES_H_
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CERTIFICATE_DATABASE_H_
+#define _CERTIFICATE_DATABASE_H_
+
+#include <dpl/thread.h>
+#include <dpl/mutex.h>
+
+extern DPL::Mutex g_certificateDBQueriesMutex;
+
+#define CERTIFICATE_DB_INTERNAL(tlsCommand, InternalType, interface) \
+ static DPL::ThreadLocalVariable<InternalType> *tlsCommand##Ptr = NULL; \
+ { \
+ DPL::Mutex::ScopedLock lock(&g_certificateDBQueriesMutex); \
+ if (!tlsCommand##Ptr) { \
+ static DPL::ThreadLocalVariable<InternalType> tmp; \
+ tlsCommand##Ptr = &tmp; \
+ } \
+ } \
+ DPL::ThreadLocalVariable<InternalType> &tlsCommand = *tlsCommand##Ptr; \
+ if (tlsCommand.IsNull()) { tlsCommand = InternalType(interface); }
+
+#define CERTIFICATE_DB_SELECT(name, type, interface) \
+ CERTIFICATE_DB_INTERNAL(name, type::Select, interface)
+
+#define CERTIFICATE_DB_INSERT(name, type, interface) \
+ CERTIFICATE_DB_INTERNAL(name, type::Insert, interface)
+
+#define CERTIFICATE_DB_UPDATE(name, type, interface) \
+ CERTIFICATE_DB_INTERNAL(name, type::Update, interface)
+
+#define CERTIFICATE_DB_DELETE(name, type, interface) \
+ CERTIFICATE_DB_INTERNAL(name, type::Delete, interface)
+
+#endif // _CERTIFICATE_DATABASE_H_
+
--- /dev/null
+SQL(BEGIN TRANSACTION;)
+
+CREATE_TABLE(CertificateInfo)
+ COLUMN_NOT_NULL(certificate, TEXT,DEFAULT '')
+ COLUMN_NOT_NULL(result, INT, DEFAULT 0)
+ TABLE_CONSTRAINTS(PRIMARY KEY(certificate))
+CREATE_TABLE_END()
+
+SQL(COMMIT;)
--- /dev/null
+DATABASE_START(certificate)
+
+#include "certificate_db"
+
+DATABASE_END()
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file certificate_db_sql_generator.h
+ * @author Leerang Song (leerang.song@samsung.com)
+ * @version 1.0
+ * @brief Macro definitions for generating the SQL
+ * input file from database definition.
+ */
+
+//Do not include this file directly! It is used only for SQL code generation.
+#include <dpl/db/orm_macros.h>
+
+#include "certificate_db_definitions"
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ORM_GENERATOR_CERTIFICATE_H_
+#define _ORM_GENERATOR_CERTIFICATE_H_
+
+#define ORM_GENERATOR_DATABASE_NAME certificate_db_definitions
+#include <dpl/db/orm_generator.h>
+#undef ORM_GENERATOR_DATABASE_NAME
+
+#endif // _ORM_GENERATOR_CERTIFICATE_H_
\ No newline at end of file