Added generic database type handling to getDbSql