some column interface refactorings
This commit is contained in:
@@ -111,12 +111,13 @@ TEST_CASE_METHOD( QueryFixture, "Insert and select basic datatypes", "[query][da
|
||||
|
||||
TEST_CASE_METHOD( QueryFixture, "Test quoted identifier", "[query][quotes][identifier]" ) {
|
||||
using namespace matador::sql;
|
||||
using namespace matador::utils;
|
||||
|
||||
auto res = query::create()
|
||||
.table("quotes")
|
||||
.columns({
|
||||
attribute("from", matador::utils::basic_type::type_varchar, 255),
|
||||
attribute("to", matador::utils::basic_type::type_varchar, 255)
|
||||
attribute("from", basic_type::type_varchar, 255),
|
||||
attribute("to", basic_type::type_varchar, 255)
|
||||
})
|
||||
.execute(db);
|
||||
REQUIRE(res.is_ok());
|
||||
@@ -125,7 +126,7 @@ TEST_CASE_METHOD( QueryFixture, "Test quoted identifier", "[query][quotes][ident
|
||||
|
||||
// check table description
|
||||
std::vector<std::string> column_names = { "from", "to"};
|
||||
std::vector<matador::utils::basic_type> types = {matador::utils::basic_type::type_varchar, matador::utils::basic_type::type_varchar};
|
||||
std::vector types = {basic_type::type_varchar, basic_type::type_varchar};
|
||||
const auto columns = db.describe("quotes");
|
||||
REQUIRE(columns.is_ok());
|
||||
|
||||
@@ -171,9 +172,10 @@ TEST_CASE_METHOD( QueryFixture, "Test quoted identifier", "[query][quotes][ident
|
||||
|
||||
TEST_CASE_METHOD( QueryFixture, "Test quoted column names", "[query][quotes][column]" ) {
|
||||
using namespace matador::sql;
|
||||
using namespace matador::utils;
|
||||
|
||||
const auto start_quote = db.dialect().token_at(matador::sql::dialect_token::StartQuote);
|
||||
const auto end_quote = db.dialect().token_at(matador::sql::dialect_token::EndQuote);
|
||||
const auto start_quote = db.dialect().token_at(dialect_token::StartQuote);
|
||||
const auto end_quote = db.dialect().token_at(dialect_token::EndQuote);
|
||||
|
||||
const std::string column_name = "name_with_" + start_quote + "open_close_quotes" + end_quote + "_in_backend_ctx";
|
||||
|
||||
@@ -190,7 +192,7 @@ TEST_CASE_METHOD( QueryFixture, "Test quoted column names", "[query][quotes][col
|
||||
auto res = query::create()
|
||||
.table("quotes")
|
||||
.columns({
|
||||
attribute(name, matador::utils::basic_type::type_varchar, 255)
|
||||
attribute(name, basic_type::type_varchar, 255)
|
||||
})
|
||||
.execute(db);
|
||||
REQUIRE(res.is_ok());
|
||||
@@ -201,7 +203,7 @@ TEST_CASE_METHOD( QueryFixture, "Test quoted column names", "[query][quotes][col
|
||||
|
||||
for (const auto &col : *columns) {
|
||||
REQUIRE(col.name() == name);
|
||||
REQUIRE(col.type() == matador::utils::basic_type::type_varchar);
|
||||
REQUIRE(col.type() == basic_type::type_varchar);
|
||||
}
|
||||
|
||||
res = query::drop()
|
||||
@@ -214,11 +216,12 @@ TEST_CASE_METHOD( QueryFixture, "Test quoted column names", "[query][quotes][col
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Test quoted literals", "[query][quotes][literals]") {
|
||||
using namespace matador::sql;
|
||||
using namespace matador::utils;
|
||||
|
||||
auto res = query::create()
|
||||
.table("escapes")
|
||||
.columns({
|
||||
attribute("name", matador::utils::basic_type::type_varchar, 255)
|
||||
attribute("name", basic_type::type_varchar, 255)
|
||||
})
|
||||
.execute(db);
|
||||
REQUIRE(res.is_ok());
|
||||
|
||||
@@ -125,7 +125,7 @@ TEST_CASE_METHOD(QueryFixture, "Execute insert statement", "[query][insert]") {
|
||||
tables_to_drop.emplace("person");
|
||||
|
||||
res = query::insert()
|
||||
.into("person", {{"", "id", ""}, {"", "name", ""}, {"", "color", ""}})
|
||||
.into("person", {{"id", ""}, {"name", ""}, {"color", ""}})
|
||||
.values({7, "george", "green"})
|
||||
.execute(db);
|
||||
REQUIRE(res.is_ok());
|
||||
|
||||
Reference in New Issue
Block a user