seperete create_tables
This commit is contained in:
parent
4c38bfe9a6
commit
3ea3ef7c11
@ -117,6 +117,7 @@ void call(int sock, sockaddr_in newSocketInfo)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sql::init();
|
sql::init();
|
||||||
|
sql::create_tables();
|
||||||
std::thread t(checker);
|
std::thread t(checker);
|
||||||
// Bind the server to a port.
|
// Bind the server to a port.
|
||||||
int err = TcpSocket::listent("0.0.0.0", serverPort, call);
|
int err = TcpSocket::listent("0.0.0.0", serverPort, call);
|
||||||
|
@ -32,6 +32,7 @@ struct sqlite3_stmt;
|
|||||||
|
|
||||||
namespace sql
|
namespace sql
|
||||||
{
|
{
|
||||||
|
void create_tables();
|
||||||
void init();
|
void init();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
int open(const char *filename, sqlite3 **ppDb);
|
int open(const char *filename, sqlite3 **ppDb);
|
||||||
|
@ -5,9 +5,11 @@
|
|||||||
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
|
||||||
void sql::init()
|
namespace sql
|
||||||
{
|
{
|
||||||
sqlite3_initialize();
|
|
||||||
|
void create_tables()
|
||||||
|
{
|
||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
char *zErrMsg = 0;
|
char *zErrMsg = 0;
|
||||||
int rc;
|
int rc;
|
||||||
@ -49,15 +51,18 @@ void sql::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sql::shutdown()
|
void init()
|
||||||
{
|
{
|
||||||
|
sqlite3_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void shutdown()
|
||||||
|
{
|
||||||
sqlite3_shutdown();
|
sqlite3_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace sql
|
|
||||||
{
|
|
||||||
int open(const char *filename, sqlite3 **ppDb)
|
int open(const char *filename, sqlite3 **ppDb)
|
||||||
{
|
{
|
||||||
return sqlite3_open(filename, ppDb);
|
return sqlite3_open(filename, ppDb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user