diff --git a/src/input/readers/SQLite.cc b/src/input/readers/SQLite.cc index f843accced..962f0926db 100644 --- a/src/input/readers/SQLite.cc +++ b/src/input/readers/SQLite.cc @@ -31,8 +31,13 @@ SQLite::SQLite(ReaderFrontend *frontend) : ReaderBackend(frontend) (const char*) BifConst::LogSQLite::unset_field->Bytes(), BifConst::InputSQLite::unset_field->Len() ); + + empty_field.assign( + (const char*) BifConst::LogAscii::empty_field->Bytes(), + BifConst::InputSQLite::empty_field->Len() + ); - io = new AsciiInputOutput(this, AsciiInputOutput::SeparatorInfo(set_separator, unset_field)); + io = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo(set_separator, unset_field, empty_field)); } SQLite::~SQLite() @@ -189,7 +194,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p if ( text == 0 ) Error("Port protocol definition did not contain text"); else - val->val.port_val.proto = io->StringToProto(s); + val->val.port_val.proto = io->ParseProto(s); } break; } @@ -202,7 +207,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p int width = atoi(s.substr(pos+1).c_str()); string addr = s.substr(0, pos); - val->val.subnet_val.prefix = io->StringToAddr(addr); + val->val.subnet_val.prefix = io->ParseAddr(addr); val->val.subnet_val.length = width; break; } @@ -211,7 +216,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p { const char *text = (const char*) sqlite3_column_text(st, pos); string s(text, sqlite3_column_bytes(st, pos)); - val->val.addr_val = io->StringToAddr(s); + val->val.addr_val = io->ParseAddr(s); break; } @@ -220,7 +225,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p { const char *text = (const char*) sqlite3_column_text(st, pos); string s(text, sqlite3_column_bytes(st, pos)); - val = io->StringToVal(s, "", field->type, field->subtype); + val = io->ParseValue(s, "", field->type, field->subtype); break; } diff --git a/src/input/readers/SQLite.h b/src/input/readers/SQLite.h index aa7f9686c7..0705ba2df0 100644 --- a/src/input/readers/SQLite.h +++ b/src/input/readers/SQLite.h @@ -12,7 +12,7 @@ #include #include "../ReaderBackend.h" -#include "../../threading/AsciiInputOutput.h" +#include "../../threading/AsciiFormatter.h" #include "sqlite3.h" @@ -46,10 +46,11 @@ private: string query; sqlite3 *db; sqlite3_stmt *st; - AsciiInputOutput* io; + AsciiFormatter* io; string set_separator; string unset_field; + string empty_field; }; diff --git a/src/logging/writers/SQLite.cc b/src/logging/writers/SQLite.cc index eaa20da466..cf4be92e14 100644 --- a/src/logging/writers/SQLite.cc +++ b/src/logging/writers/SQLite.cc @@ -31,13 +31,13 @@ SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend) ); empty_field.assign( - (const char*) BifConst::LogAscii::empty_field->Bytes(), + (const char*) BifConst::LogSQLite::empty_field->Bytes(), BifConst::LogAscii::empty_field->Len() ); db = 0; - io = new AsciiInputOutput(this, AsciiInputOutput::SeparatorInfo(set_separator, unset_field, empty_field)); + io = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo(set_separator, unset_field, empty_field)); } SQLite::~SQLite() @@ -300,7 +300,7 @@ int SQLite::AddParams(Value* val, int pos) if ( j > 0 ) desc.AddRaw(set_separator); - io->ValToODesc(&desc, val->val.set_val.vals[j], NULL); + io->Describe(&desc, val->val.set_val.vals[j], NULL); // yes, giving NULL here is not really really pretty.... // it works however, because tables cannot contain tables... // or vectors. @@ -320,7 +320,7 @@ int SQLite::AddParams(Value* val, int pos) if ( j > 0 ) desc.AddRaw(set_separator); - io->ValToODesc(&desc, val->val.vector_val.vals[j], NULL); + io->Describe(&desc, val->val.vector_val.vals[j], NULL); } desc.RemoveEscapeSequence(set_separator); diff --git a/src/logging/writers/SQLite.h b/src/logging/writers/SQLite.h index f430057ed8..8c04c52c41 100644 --- a/src/logging/writers/SQLite.h +++ b/src/logging/writers/SQLite.h @@ -12,7 +12,7 @@ #include "../WriterBackend.h" #include "sqlite3.h" -#include "../../threading/AsciiInputOutput.h" +#include "../../threading/AsciiFormatter.h" namespace logging { namespace writer { @@ -50,7 +50,7 @@ private: string unset_field; string empty_field; - AsciiInputOutput* io; + AsciiFormatter* io; }; }