Merge pull request #31 from klondi/chat_history_sqlite_fixes

Chat history sqlite fixes
This commit is contained in:
Jan Vidar Krey 2014-11-26 13:56:07 +01:00
commit 889807da1b
1 changed files with 4 additions and 2 deletions

View File

@ -49,7 +49,7 @@ static int null_callback(void* ptr, int argc, char **argv, char **colName) { ret
static const char* sql_escape_string(const char* str)
{
static char out[1024];
static char out[MAX_HISTORY_SIZE];
size_t i = 0;
size_t n = 0;
for (; n < strlen(str); n++)
@ -65,7 +65,7 @@ static const char* sql_escape_string(const char* str)
static int sql_execute(struct chat_history_data* sql, int (*callback)(void* ptr, int argc, char **argv, char **colName), void* ptr, const char* sql_fmt, ...)
{
va_list args;
char query[1024];
char query[MAX_HISTORY_SIZE];
char* errMsg;
int rc;
@ -226,6 +226,8 @@ static int command_historycleanup(struct plugin_handle* plugin, struct plugin_us
plugin->hub.send_message(plugin, user, cbuf_get(buf));
cbuf_destroy(buf);
sql_execute(data, null_callback, NULL, "VACUUM;");
return 0;
}