MariaDB: move common code into seperate file

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: add query.c

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: add query process function

Signed-off-by: swpd <swpdtz@gmail.com>
MariaDB: alter header files according to common.h

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