本文整理汇总了C++中CFileReader::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileReader::Open方法的具体用法?C++ CFileReader::Open怎么用?C++ CFileReader::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileReader
的用法示例。
在下文中一共展示了CFileReader::Open方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: textToString
Datum
RestorePlanFromDXLFile(PG_FUNCTION_ARGS)
{
char *szFilename = textToString(PG_GETARG_TEXT_P(0));
CFileReader fr;
fr.Open(szFilename);
ULLONG ullSize = fr.UllSize();
char *pcBuf = (char*) gpdb::GPDBAlloc(ullSize + 1);
fr.UlpRead((BYTE*)pcBuf, ullSize);
pcBuf[ullSize] = '\0';
fr.Close();
int iProcessed = executeXMLPlan(pcBuf);
elog(NOTICE, "Processed %d rows.", iProcessed);
gpdb::GPDBFree(pcBuf);
StringInfoData str;
initStringInfo(&str);
appendStringInfo(&str, "Query processed %d rows", iProcessed);
text *ptResult = stringToText(str.data);
PG_RETURN_TEXT_P(ptResult);
}
示例2: sizeof
Datum
RestoreQueryFromFile(PG_FUNCTION_ARGS)
{
char *szFilename = text_to_cstring(PG_GETARG_TEXT_P(0));
CFileReader fr;
fr.Open(szFilename);
ULLONG ullSize = fr.UllSize();
elog(NOTICE, "(RestoreFromFile) Filesize is " UINT64_FORMAT, (uint64) ullSize);
char *pcBuf = (char*) gpdb::GPDBAlloc(ullSize);
fr.UlpRead((BYTE*)pcBuf, ullSize);
fr.Close();
int iBinaryLen;
memcpy(&iBinaryLen, pcBuf, sizeof(int));
Assert(iBinaryLen == ullSize - sizeof(int));
elog(NOTICE, "(RestoreFromFile) BinaryLen is %d", iBinaryLen);
char *pcBinary = pcBuf + sizeof(int);
int iProcessed = extractFrozenQueryPlanAndExecute(pcBinary);
elog(NOTICE, "(RestorePlan) PROCESSED %d", iProcessed);
StringInfoData str;
initStringInfo(&str);
appendStringInfo(&str, "Query processed %d rows", iProcessed);
text *ptResult = cstring_to_text(str.data);
PG_RETURN_TEXT_P(ptResult);
}
示例3:
char *read_file(const char *szFilename)
{
CFileReader fr;
fr.Open(szFilename);
ULLONG ullSize = fr.UllSize();
char *pcBuf = (char*) gpdb::GPDBAlloc(ullSize);
fr.UlpRead((BYTE*)pcBuf, ullSize);
pcBuf[ullSize] = '\0';
fr.Close();
return pcBuf;
}
示例4: strExpected
//---------------------------------------------------------------------------
// @function:
// COstreamFileTest::Unittest_CheckOutputFile
//
// @doc:
// Check the contents of the file used by the output stream
//
//---------------------------------------------------------------------------
void
COstreamFileTest::Unittest_CheckOutputFile
(
const CHAR *szFile
)
{
GPOS_ASSERT(NULL != szFile);
CFileReader fr;
fr.Open(szFile);
const ULONG ulReadBufferSize = 1024;
WCHAR wszReadBuffer[ulReadBufferSize];
#ifdef GPOS_DEBUG
ULONG_PTR ulpRead =
#endif // GPOS_DEBUG
fr.UlpRead((BYTE *) wszReadBuffer, GPOS_ARRAY_SIZE(wszReadBuffer));
CWStringConst strExpected(GPOS_WSZ_LIT("WC102-10some regular stringdeadbeef"));
GPOS_ASSERT(ulpRead == (ULONG_PTR) strExpected.UlLength() * GPOS_SIZEOF(WCHAR));
GPOS_ASSERT(strExpected.FEquals(&strExpected));
}