本文整理汇总了C++中SQLUtility::execSQLFile方法的典型用法代码示例。如果您正苦于以下问题:C++ SQLUtility::execSQLFile方法的具体用法?C++ SQLUtility::execSQLFile怎么用?C++ SQLUtility::execSQLFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLUtility
的用法示例。
在下文中一共展示了SQLUtility::execSQLFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST_F(TestExternalOid, TestExternalOidAll) {
SQLUtility util;
FileReplace frep;
auto test_root = util.getTestRootPath();
std::cout << test_root << std::endl;
std::unordered_map<std::string, std::string> D;
D["@[email protected]"] = test_root + "/ExternalSource/lib/function.so";
D["@[email protected]"] = test_root + "/ExternalSource/data";
frep.replace(test_root + "/ExternalSource/sql/external_oid.sql.source",
test_root + "/ExternalSource/sql/external_oid.sql",
D);
frep.replace(test_root + "/ExternalSource/ans/external_oid.ans.source",
test_root + "/ExternalSource/ans/external_oid.ans",
D);
util.execSQLFile("ExternalSource/sql/external_oid.sql",
"ExternalSource/ans/external_oid.ans");
}
示例2:
TEST_F(TestQueryPrepare, TestPrepareParameters) {
SQLUtility util;
// prepare
util.execute("drop table if exists test1");
util.execute("drop table if exists test2");
util.execute("create table test1 ("
" unique1 int4,"
" unique2 int4,"
" two int4,"
" four int4,"
" ten int4,"
" twenty int4,"
" hundred int4,"
" thousand int4,"
" twothousand int4,"
" fivethous int4,"
" tenthous int4,"
" odd int4,"
" even int4,"
" stringu1 name,"
" stringu2 name,"
" string4 name) with oids");
util.execute("create table test2 ("
" name text,"
" thepath path)");
std::string pwd = util.getTestRootPath();
std::string cmd = "COPY test1 FROM '" + pwd + "/query/data/tenk.data'";
std::cout << cmd << std::endl;
util.execute(cmd);
cmd = "COPY test2 FROM '" + pwd + "/query/data/streets.data'";
std::cout << cmd << std::endl;
util.execute(cmd);
// do test
util.execSQLFile("query/sql/prepare-parameters.sql",
"query/ans/prepare-parameters.ans");
// cleanup
util.execute("drop table test1");
util.execute("drop table test2");
}
示例3:
TEST_F(TestExternalTable, DISABLED_TestExternalTableAll) {
SQLUtility util;
auto test_root = util.getTestRootPath();
auto replace_lambda = [&] () {
FileReplace frep;
std::unordered_map<std::string, std::string> D;
D["@[email protected]"] = std::string("localhost");
D["@[email protected]"] = test_root + "/ExternalSource";
D["@[email protected]"] = std::string(std::string(getenv("GPHOME")) + "/bin/gpfdist");
frep.replace(test_root + "/ExternalSource/sql/exttab1.sql.source",
test_root + "/ExternalSource/sql/exttab1.sql",
D);
frep.replace(test_root + "/ExternalSource/ans/exttab1.ans.source",
test_root + "/ExternalSource/ans/exttab1.ans",
D);
};
replace_lambda();
util.execSQLFile("ExternalSource/sql/exttab1.sql",
"ExternalSource/ans/exttab1.ans");
}