File: SQLite.h

package info (click to toggle)
bro 2.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 79,416 kB
  • sloc: ansic: 129,203; cpp: 96,492; yacc: 2,528; lex: 1,819; sh: 795; python: 700; makefile: 136
file content (54 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// See the file "COPYING" in the main distribution directory for copyright.

#ifndef INPUT_READERS_SQLITE_H
#define INPUT_READERS_SQLITE_H

#include "bro-config.h"

#include <iostream>
#include <vector>

#include "input/ReaderBackend.h"
#include "threading/formatters/Ascii.h"
#include "sqlite3.h"

namespace input { namespace reader {

class SQLite : public ReaderBackend {
public:
	SQLite(ReaderFrontend* frontend);
	~SQLite();

	static ReaderBackend* Instantiate(ReaderFrontend* frontend) { return new SQLite(frontend); }

protected:
	virtual bool DoInit(const ReaderInfo& info, int arg_num_fields, const threading::Field* const* arg_fields);
	virtual void DoClose();
	virtual bool DoUpdate();
	virtual bool DoHeartbeat(double network_time, double current_time)	{ return true; }

private:
	bool checkError(int code);

	threading::Value* EntryToVal(sqlite3_stmt *st, const threading::Field *field, int pos, int subpos);

	const threading::Field* const * fields; // raw mapping
	unsigned int num_fields;
	int mode;
	bool started;
	string query;
	sqlite3 *db;
	sqlite3_stmt *st;
	threading::formatter::Ascii* io;

	string set_separator;
	string unset_field;
	string empty_field;
};


}
}

#endif /* INPUT_READERS_SQLITE_H */