0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Added test for hidden custom query result type

This commit is contained in:
rbock 2016-08-23 18:18:16 +02:00
parent 33992a6651
commit 0ec6860fda

View File

@ -23,12 +23,14 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "compare.h"
#include "Sample.h" #include "Sample.h"
#include "compare.h"
#include <sqlpp11/sqlpp11.h> #include <sqlpp11/sqlpp11.h>
#include <iostream> #include <iostream>
SQLPP_ALIAS_PROVIDER(pragma);
int CustomQuery(int, char* []) int CustomQuery(int, char* [])
{ {
const auto foo = test::TabFoo{}; const auto foo = test::TabFoo{};
@ -59,5 +61,10 @@ int CustomQuery(int, char* [])
"SELECT DISTINCT tab_foo.omega FROM tab_foo INNER JOIN tab_bar ON (tab_foo.omega=tab_bar.alpha) WHERE " "SELECT DISTINCT tab_foo.omega FROM tab_foo INNER JOIN tab_bar ON (tab_foo.omega=tab_bar.alpha) WHERE "
"(tab_bar.alpha>17) GROUP BY tab_foo.omega HAVING (AVG(tab_bar.alpha)>19) ORDER BY tab_foo.omega ASC "); "(tab_bar.alpha>17) GROUP BY tab_foo.omega HAVING (AVG(tab_bar.alpha)>19) ORDER BY tab_foo.omega ASC ");
// A pragma query for sqlite
compare(__LINE__,
custom_query(sqlpp::verbatim("PRAGMA user_version")).with_result_type_of(select(sqlpp::value(1).as(pragma))),
" PRAGMA user_version");
return 0; return 0;
} }