mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
make work with newer AsciiFormatter.
This commit is contained in:
parent
8cb91de93a
commit
5d12765886
4 changed files with 19 additions and 13 deletions
|
@ -32,7 +32,12 @@ SQLite::SQLite(ReaderFrontend *frontend) : ReaderBackend(frontend)
|
||||||
BifConst::InputSQLite::unset_field->Len()
|
BifConst::InputSQLite::unset_field->Len()
|
||||||
);
|
);
|
||||||
|
|
||||||
io = new AsciiInputOutput(this, AsciiInputOutput::SeparatorInfo(set_separator, unset_field));
|
empty_field.assign(
|
||||||
|
(const char*) BifConst::LogAscii::empty_field->Bytes(),
|
||||||
|
BifConst::InputSQLite::empty_field->Len()
|
||||||
|
);
|
||||||
|
|
||||||
|
io = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo(set_separator, unset_field, empty_field));
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLite::~SQLite()
|
SQLite::~SQLite()
|
||||||
|
@ -189,7 +194,7 @@ Value* SQLite::EntryToVal(sqlite3_stmt *st, const threading::Field *field, int p
|
||||||
if ( text == 0 )
|
if ( text == 0 )
|
||||||
Error("Port protocol definition did not contain text");
|
Error("Port protocol definition did not contain text");
|
||||||
else
|
else
|
||||||
val->val.port_val.proto = io->StringToProto(s);
|
val->val.port_val.proto = io->ParseProto(s);
|
||||||
}
|
}
|
||||||
break;
|
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());
|
int width = atoi(s.substr(pos+1).c_str());
|
||||||
string addr = s.substr(0, pos);
|
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;
|
val->val.subnet_val.length = width;
|
||||||
break;
|
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);
|
const char *text = (const char*) sqlite3_column_text(st, pos);
|
||||||
string s(text, sqlite3_column_bytes(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;
|
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);
|
const char *text = (const char*) sqlite3_column_text(st, pos);
|
||||||
string s(text, sqlite3_column_bytes(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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../ReaderBackend.h"
|
#include "../ReaderBackend.h"
|
||||||
#include "../../threading/AsciiInputOutput.h"
|
#include "../../threading/AsciiFormatter.h"
|
||||||
|
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
|
|
||||||
|
@ -46,10 +46,11 @@ private:
|
||||||
string query;
|
string query;
|
||||||
sqlite3 *db;
|
sqlite3 *db;
|
||||||
sqlite3_stmt *st;
|
sqlite3_stmt *st;
|
||||||
AsciiInputOutput* io;
|
AsciiFormatter* io;
|
||||||
|
|
||||||
string set_separator;
|
string set_separator;
|
||||||
string unset_field;
|
string unset_field;
|
||||||
|
string empty_field;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend)
|
||||||
);
|
);
|
||||||
|
|
||||||
empty_field.assign(
|
empty_field.assign(
|
||||||
(const char*) BifConst::LogAscii::empty_field->Bytes(),
|
(const char*) BifConst::LogSQLite::empty_field->Bytes(),
|
||||||
BifConst::LogAscii::empty_field->Len()
|
BifConst::LogAscii::empty_field->Len()
|
||||||
);
|
);
|
||||||
|
|
||||||
db = 0;
|
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()
|
SQLite::~SQLite()
|
||||||
|
@ -300,7 +300,7 @@ int SQLite::AddParams(Value* val, int pos)
|
||||||
if ( j > 0 )
|
if ( j > 0 )
|
||||||
desc.AddRaw(set_separator);
|
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....
|
// yes, giving NULL here is not really really pretty....
|
||||||
// it works however, because tables cannot contain tables...
|
// it works however, because tables cannot contain tables...
|
||||||
// or vectors.
|
// or vectors.
|
||||||
|
@ -320,7 +320,7 @@ int SQLite::AddParams(Value* val, int pos)
|
||||||
if ( j > 0 )
|
if ( j > 0 )
|
||||||
desc.AddRaw(set_separator);
|
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);
|
desc.RemoveEscapeSequence(set_separator);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "../WriterBackend.h"
|
#include "../WriterBackend.h"
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
#include "../../threading/AsciiInputOutput.h"
|
#include "../../threading/AsciiFormatter.h"
|
||||||
|
|
||||||
namespace logging { namespace writer {
|
namespace logging { namespace writer {
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ private:
|
||||||
string unset_field;
|
string unset_field;
|
||||||
string empty_field;
|
string empty_field;
|
||||||
|
|
||||||
AsciiInputOutput* io;
|
AsciiFormatter* io;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue