rename the dbname configuration option to tablename.

Sorry for this - I noticed that I named this option quite unfortunately
while writing the documentation.

The patch also removes the dbname configuration option from the sqlite
input reader - it was not used there at all anymore (and I did not notice
that).
This commit is contained in:
Bernhard Amann 2013-10-17 12:24:40 -07:00
parent c1c6b887c1
commit 363cfb8506
7 changed files with 9 additions and 24 deletions

View file

@ -78,18 +78,8 @@ bool SQLite::DoInit(const ReaderInfo& info, int arg_num_fields, const threading:
string fullpath(info.source);
fullpath.append(".sqlite");
string dbname;
map<const char*, const char*>::const_iterator it = info.config.find("dbname");
if ( it == info.config.end() )
{
MsgThread::Info(Fmt("dbname configuration option not found. Defaulting to source %s", info.source));
dbname = info.source;
}
else
dbname = it->second;
string query;
it = info.config.find("query");
map<const char*, const char*>::const_iterator it = info.config.find("query");
if ( it == info.config.end() )
{
Error(Fmt("No query specified when setting up SQLite data source. Aborting.", info.source));

View file

@ -124,16 +124,16 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields,
string fullpath(info.path);
fullpath.append(".sqlite");
string dbname;
string tablename;
map<const char*, const char*>::const_iterator it = info.config.find("dbname");
map<const char*, const char*>::const_iterator it = info.config.find("tablename");
if ( it == info.config.end() )
{
MsgThread::Info(Fmt("dbname configuration option not found. Defaulting to path %s", info.path));
dbname = info.path;
MsgThread::Info(Fmt("tablename configuration option not found. Defaulting to path %s", info.path));
tablename = info.path;
}
else
dbname = it->second;
tablename = it->second;
if ( checkError(sqlite3_open_v2(
fullpath.c_str(),
@ -145,7 +145,7 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields,
NULL)) )
return false;
string create = "CREATE TABLE IF NOT EXISTS " + dbname + " (\n";
string create = "CREATE TABLE IF NOT EXISTS " + tablename + " (\n";
//"id SERIAL UNIQUE NOT NULL"; // SQLite has rowids, we do not need a counter here.
for ( unsigned int i = 0; i < num_fields; ++i )
@ -193,7 +193,7 @@ bool SQLite::DoInit(const WriterInfo& info, int arg_num_fields,
// create the prepared statement that will be re-used forever...
string insert = "VALUES (";
string names = "INSERT INTO " + dbname + " ( ";
string names = "INSERT INTO " + tablename + " ( ";
for ( unsigned int i = 0; i < num_fields; i++ )
{

View file

@ -1,3 +1,3 @@
ssh/Log::WRITER_SQLITE: dbname configuration option not found. Defaulting to path ssh
ssh/Log::WRITER_SQLITE: tablename configuration option not found. Defaulting to path ssh
error: ssh/Log::WRITER_SQLITE: SQLite call failed: table ssh has no column named f
error: ssh/Log::WRITER_SQLITE: terminating thread

View file

@ -89,7 +89,6 @@ event bro_init()
{
local config_strings: table[string] of string = {
["query"] = "select * from conn;",
["dbname"] = "conn"
};
outfile = open("../out");

View file

@ -83,12 +83,10 @@ event bro_init()
{
local config_strings: table[string] of string = {
["query"] = "select * from ssh;",
["dbname"] = "ssh"
};
local config_strings2: table[string] of string = {
["query"] = "select b, g, h from ssh;",
["dbname"] = "ssh"
};
outfile = open("../out");

View file

@ -39,7 +39,6 @@ event bro_init()
{
local config_strings: table[string] of string = {
["query"] = "select port as p, proto from port;",
["dbname"] = "port"
};
outfile = open("../out");

View file

@ -77,7 +77,6 @@ event bro_init()
{
local config_strings: table[string] of string = {
["query"] = "select * from ssh;",
["dbname"] = "ssh"
};
outfile = open("../out");