afsql: txn error fix

Signed-off-by: Budai Laszlo <Laszlo.Budai@balabit.com>
afsql: check table in database with libdbi function in validate_table
afsql: free db_res only if it is not NULL in validate_table
afsql: rollback if commit was failed within validate table
afsql: set active_transaction to false if commit is successful