mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Add test for table alias.
This commit is contained in:
parent
1e2fff0ca9
commit
0181639cb3
@ -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 <iostream>
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user