def __init__(self, options, tables, ctxcols, evcols):
import sqlite3
+ if options.database == None:
+ print "Have to specify database (file-)name for sqlite"
+ sys.exit(1)
+
if os.path.isfile(options.database):
os.unlink(options.database)
self.valid_keys = set()
- for line in self.input():
+ inp = self.input()
+
+ for line in inp:
if line[0] == 'P':
ind = line.index(';', 2)
key = line[2:ind]
- if not key in ctxcols:
+ if not ctxcols.has_key(key):
ctxcols[key] = ctxind
ctxind += 1
key = line[2:ind]
if self.filter.match(key):
self.n_events += 1
- if not key in evcols:
+ if not evcols.has_key(key):
self.valid_keys.add(key)
evcols[key] = evind
evind += 1
lineno = 0
ids = 0
curr_id = 0
+ last_push_curr_id = 0
keystack = []
idstack = []
curr_event = 0
if op == 'P':
# flush the current events
if len(evcols):
- self.emit.ev(curr_id, evcols)
+ self.emit.ev(last_push_curr_id, evcols)
evcols.clear()
# push the key
val = items[2]
keystack.append(key)
curr_id = ids
+ last_push_curr_id = curr_id
ids += 1
idstack.append(curr_id)
ctxcols[key] = val