From 0181639cb3b43ef192c6933320a72bbdf0506431 Mon Sep 17 00:00:00 2001 From: Roland Bock Date: Sat, 4 Sep 2021 11:05:49 +0200 Subject: [PATCH] Add test for table alias. --- tests/core/serialize/TableAlias.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/core/serialize/TableAlias.cpp b/tests/core/serialize/TableAlias.cpp index aef0b57b..b1cc2c21 100644 --- a/tests/core/serialize/TableAlias.cpp +++ b/tests/core/serialize/TableAlias.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2016, Roland Bock + * Copyright (c) 2016-2021, Roland Bock * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -29,6 +29,8 @@ #include +SQLPP_ALIAS_PROVIDER(sample) + int TableAlias(int, char* []) { const auto foo = test::TabFoo{}; @@ -39,5 +41,10 @@ int TableAlias(int, char* []) compare(__LINE__, select(foo.omega).from(foo).unconditionally().as(bar), "(SELECT tab_foo.omega FROM tab_foo) AS tab_bar"); + // Table alias + const auto tab = foo.as(sample); + compare(__LINE__, select(tab.omega).from(tab).unconditionally(), + "SELECT sample.omega FROM tab_foo AS sample"); + return 0; }