afsql: trying to do a better transaction handling

Two problems with transactions:
 * mixing DDL and DML statements in a single transaction
   (create/update table)
 * simple select can abort a transaction
   (checking if a table exists or not)

syslog-ng checks whether a table exists or not by 'select * from table'
(and get structure of the table as a side-effect...)

There are some DB-providers which abort current transaction when try to
select from a non-existing table (eg.:mssql).

libdbi provides a better, db-provider specific way to checking table existance
(this is a meta-query which always succeed).
Unfortunately, this function is buggy in pgsql driver, so we had to do
something else).

syslog-ng asks db only when the name of the table to be checked is not seen
before (this is based on a runtime information: every table is validated and
name of all validated tables are stored in a hashtable).

When the table not found in the list of validated tables:
 - active transaction is commited (if exists)
 - new transaction is started for checking if the table exists or not
    - if the table exists, its structure is updated according to the
      structure given in the config file
    - otherwise a new table is created

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
afsql: validate_table() refactored

 afsql_dd_sql_identifier_sanitize()     ->  _sanitize_sql_identifier()
 _table_is_exist()                      ->  _is_table_present()
 afsql_dd_sql_identifier_is_sanitized() ->  _is_sql_identifier_sanitized()
 `validate table`                       ->  `syslog conform table`

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
Merge pull request #292 from lbudai/3.6/f/afsql-transaction-fixes

3.6/f/afsql transaction fixes