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["@SHARE_LIBRARY_PATH@"] = test_root + "/ExternalSource/lib/function.so";
  D["@abs_datadir@"] = 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");
}
Esempio n. 2
0
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");
}
Esempio n. 3
0
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["@hostname@"] = std::string("localhost");
    D["@abs_srcdir@"] = test_root + "/ExternalSource";
    D["@gpwhich_gpfdist@"] = 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");
}
Esempio n. 4
0
TEST_F(TestQueryPrepare, TestPrepareUniqueness) {
  SQLUtility util;
  util.execSQLFile("query/sql/prepare-uniqueness.sql",
		  	  	   "query/ans/prepare-uniqueness.ans");
}