MariaDB: move connection free procedure to a seperate function

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: fix mirror assignment error

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: add two new fields to the query structure

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: maintain a pointer to the current query within a connection

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: some function prototype refactor

Signed-off-by: swpd <swpdtz@gmail.com>