mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-25 06:18:18 -05:00
* [EGD-2513] new API to create temparary contact entry if cannot be found Calllog should search for contact. * [EGD-2513] #pragma once in all headers file in module-db * [EGD-2513] new constructor for CalllogRecord * [EGD-2513] contact recognition for calllog DB API * [EGD-2513] clean up * [EGD-2513] displaying name and surname call and calllog * [EGD-2513] enum instead bool * [EGD-2513] fix in remporary contact creation * [fix][EGD-2513] missing c_str * [fix][EGD-2513] minor fixes in documentation * [EGD-2513] unified entry read state for both sms and calllog dbs * [EGD-2513] calllog db documentation * [EGD-2513] code reviex fixed in ContactRecord
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
|
|
/*
|
|
* @file Database.hpp
|
|
* @author Mateusz Piesta (mateusz.piesta@mudita.com)
|
|
* @date 24.05.19
|
|
* @brief
|
|
* @copyright Copyright (C) 2019 mudita.com
|
|
* @details
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "sqlite3.h"
|
|
|
|
#include "QueryResult.hpp"
|
|
#include <memory>
|
|
|
|
class Database
|
|
{
|
|
public:
|
|
Database(const char *name);
|
|
|
|
virtual ~Database();
|
|
|
|
std::unique_ptr<QueryResult> Query(const char *format, ...);
|
|
|
|
bool Execute(const char *format, ...);
|
|
|
|
// Must be invoked prior creating any database object in order to initialize database OS layer
|
|
static void Initialize();
|
|
// Must be invoked before closing system in order to properly close OS layer
|
|
static void Deinitialize();
|
|
|
|
bool IsInitialized()
|
|
{
|
|
return isInitialized;
|
|
}
|
|
|
|
uint32_t GetLastInsertRowID();
|
|
|
|
private:
|
|
const uint32_t maxQueryLen = (8 * 1024);
|
|
|
|
/*
|
|
* Arguments:
|
|
*
|
|
* usrPtr - Pointer to user data
|
|
* count - The number of columns in the result set
|
|
* data - The row's data
|
|
* columns - The column names
|
|
*/
|
|
static int queryCallback(void *usrPtr, int count, char **data, char **columns);
|
|
|
|
protected:
|
|
sqlite3 *dbConnection;
|
|
const char *dbName;
|
|
bool isInitialized;
|
|
};
|