本文整理汇总了C++中SQLUtility::getQueryResultSetString方法的典型用法代码示例。如果您正苦于以下问题:C++ SQLUtility::getQueryResultSetString方法的具体用法?C++ SQLUtility::getQueryResultSetString怎么用?C++ SQLUtility::getQueryResultSetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLUtility
的用法示例。
在下文中一共展示了SQLUtility::getQueryResultSetString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: by
TEST_F(TestHawqRegister, TestUsage2Case1Expected) {
SQLUtility util;
string fmt_prefix;
std::vector<string> create_table_matrix = {"distributed by (i)", "distributed randomly"};
std::vector<string> fmt_matrix = {"row", "parquet"};
int suffix=0;
for (auto & ddl : create_table_matrix) {
for (auto & fmt : fmt_matrix) {
if (fmt.compare("row") == 0)
fmt_prefix = "aoseg";
else
fmt_prefix = "paqseg";
suffix++;
auto t = hawq::test::stringFormat("t_usage2_case1_%s", std::to_string(suffix).c_str());
auto nt = hawq::test::stringFormat("nt_usage2_case1_%s", std::to_string(suffix).c_str());
util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
util.execute(hawq::test::stringFormat("drop table if exists %s;", nt.c_str()));
// hawq register -d hawq_feature_test -c t_usage2_case1_#.yml nt_usage2_case1_#, where nt_usage2_case1_# does not exist
util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 100);", t.c_str()));
util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 100);
// get pg_aoseg.pg_xxxseg_xxx table
std::string reloid1 = getTableOid(t.c_str());
string result1 = util.getQueryResultSetString(hawq::test::stringFormat("select * from pg_aoseg.pg_%s_%s order by segno;", fmt_prefix.c_str(), reloid1.c_str()));
EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq extract -d %s -o t_%s.yml testhawqregister_testusage2case1expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), t.c_str())));
EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c t_%s.yml testhawqregister_testusage2case1expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), nt.c_str())));
util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 100);
// check pg_aoseg.pg_xxxseg_xxx table
std::string reloid2 = getTableOid(nt.c_str());
string result2 = util.getQueryResultSetString(hawq::test::stringFormat("select * from pg_aoseg.pg_%s_%s order by segno;", fmt_prefix.c_str(), reloid2.c_str()));
EXPECT_EQ(result1, result2);
// hawq register -d hawq_feature_test -c t_usage2_case1_#.yml nt_usage2_case1_#, where nt_usage2_case1_# exists
util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 150);", t.c_str()));
util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 50);
EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq extract -d %s -o t_%s.yml testhawqregister_testusage2case1expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), t.c_str())));
EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c t_%s.yml testhawqregister_testusage2case1expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), nt.c_str())));
util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 150);
EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf t_%s.yml", std::to_string(suffix).c_str())));
util.execute(hawq::test::stringFormat("drop table %s;", t.c_str()));
util.execute(hawq::test::stringFormat("drop table %s;", nt.c_str()));
}
}
}