fix: save id as blob, not as string

add: some progress to new discovery
add: some tests
remove: migrations. restarting for now
This commit is contained in:
Tobias Reisinger 2020-02-23 20:06:14 +01:00
parent b4eec336a2
commit 51ab1d7982
22 changed files with 345 additions and 121 deletions

View file

@ -41,18 +41,22 @@ helpers::create_sql_filtered_query(const char *sql, sql_filter_builder **filters
}
if(filter->bind_func == (intptr_t)&sqlite3_bind_text)
{
sqlite3_bind_text(stmt, i + 1, (char*)filter->value, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, i + 1, (char*)filter->value, filter->bind_func_param, SQLITE_STATIC);
}
if(filter->bind_func == (intptr_t)&sqlite3_bind_blob)
{
sqlite3_bind_blob(stmt, i + 1, filter->value, filter->bind_func_param, SQLITE_STATIC);
}
}
return stmt;
}
helpers::sql_filter_builder::sql_filter_builder(const char *col_name, const void *value, intptr_t bind_func,
const char *logic)
helpers::sql_filter_builder::sql_filter_builder(const char *col_name, const void *value, intptr_t bind_func, int bind_func_param, const char *logic)
{
this->col_name = col_name;
this->value = value;
this->bind_func = bind_func;
this->bind_func_param = bind_func_param;
this->logic = logic;
}
}

View file

@ -1,11 +1,12 @@
#include <helpers.h>
#include <globals.h>
#include <uuid/uuid.h>
#include <drogon/trantor/trantor/utils/Logger.h>
#include <drogon/utils/Utilities.h>
#include <config.h>
#include <sql/migration_0.h>
#include <sql/migration_1.h>
int
helpers::migrate_sql()
@ -41,15 +42,6 @@ helpers::migrate_sql()
break;
}
new_version_num = 1;
case 1:
LOG_INFO << "Migrating LEVEL 1";
rc = sqlite3_exec(globals::db, (const char *)sql_migration_1_sql, nullptr, nullptr, &err_msg);
if(rc != 0)
{
LOG_FATAL << "Couldn't migrate LEVEL 1 (" << err_msg << ")";
break;
}
new_version_num = 2;
default:
break;
}