Fix problem with sc++ and query, add sc++ query test.