2015-02-13 09:26:19 +00:00
|
|
|
|
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
#include <mapnik/sql_utils.hpp>
|
|
|
|
|
2022-01-26 22:25:53 +00:00
|
|
|
TEST_CASE("sql parse")
|
|
|
|
{
|
|
|
|
SECTION("table")
|
|
|
|
{
|
|
|
|
std::string subquery("table");
|
|
|
|
REQUIRE(subquery == mapnik::sql_utils::table_from_sql(subquery));
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("complex sql 1")
|
|
|
|
{
|
|
|
|
std::string subquery("(select * FROM table1, table2) AS data");
|
|
|
|
REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("complex sql 2")
|
|
|
|
{
|
|
|
|
std::string subquery("(select * FROM table1 , table2) AS data");
|
|
|
|
REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("complex sql 3")
|
|
|
|
{
|
|
|
|
std::string subquery("(select * FROM table1,table2) AS data");
|
|
|
|
REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("complex sql 4")
|
|
|
|
{
|
|
|
|
std::string subquery("(select * FROM table1) AS data");
|
|
|
|
REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
|
|
|
|
}
|
2015-02-13 09:26:19 +00:00
|
|
|
}
|