Fixing queries not working in databases other than MySQL.