add some
This commit is contained in:
parent
af9bd84d56
commit
ecb3361de7
@ -3,6 +3,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <status.h>
|
#include <status.h>
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <entry.h>
|
||||||
|
|
||||||
|
|
||||||
class litedb
|
class litedb
|
||||||
{
|
{
|
||||||
@ -31,7 +34,10 @@ public:
|
|||||||
return this->db;
|
return this->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status exec_sql(std::string sql);
|
Status exec_sql(std::string&& sql);
|
||||||
|
|
||||||
|
Status exec_prepare_sql(std::string&& sql);
|
||||||
|
|
||||||
~litedb();
|
~litedb();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ Status litedb::litedb_open()
|
|||||||
return Status::STATUS_OK;
|
return Status::STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status litedb::exec_sql(std::string sql)
|
Status litedb::exec_sql(std::string&& sql)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ int main(int argc, char const *argv[])
|
|||||||
std::cout << "Sucess open database\n";
|
std::cout << "Sucess open database\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string create_tab_sql = "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER);";
|
std::string create_tab_sql = "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER);";
|
||||||
|
|
||||||
if (dbhand->exec_sql(create_tab_sql) != Status::STATUS_OK)
|
if (dbhand->exec_sql(std::move(create_tab_sql)) != Status::STATUS_OK)
|
||||||
{
|
{
|
||||||
std::cerr << "faild to create table\n";
|
std::cerr << "faild to create table\n";
|
||||||
}
|
}
|
||||||
@ -41,5 +41,7 @@ int main(int argc, char const *argv[])
|
|||||||
std::cout << "success create table user\n";
|
std::cout << "success create table user\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// insert user entry
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user