Rewritten database class, properly reuses the connections and also allows for use of a socket for mysql/mariadb