SQL query string builder for Javascript