Moved new thread functionality to incoming packet handler
Added new DB tables for fn names/sql strings + sql stack association
Added extra tables for fn/file names etc. upgraded sql arg and sql stack assoc tables and added index to them, modified stat handlers to put data in these tables
fitted json api to new data structure
Merge fix
Preliminary aggregation update

Fixing json aggregation for new database structure.

Still a couple of kinks to work out.
Small sql flush fix

SQL flushing takes quite a long time, and because before it was not
being committed until every statement was parsed and added, another
flush thread could have already started, leading to duplicate key/values
pairs.

Now fixed by committing after every statement is added.
Merge pull request #100 from dannybutler/master

Preliminary aggregation update