本文整理汇总了C++中CFileReader::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileReader::Close方法的具体用法?C++ CFileReader::Close怎么用?C++ CFileReader::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileReader
的用法示例。
在下文中一共展示了CFileReader::Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: textToString
Datum
RestoreQueryFromFile(PG_FUNCTION_ARGS)
{
char *szFilename = textToString(PG_GETARG_TEXT_P(0));
CFileReader fr;
fr.Open(szFilename);
ULLONG ullSize = fr.UllSize();
elog(NOTICE, "(RestoreFromFile) Filesize is %llu", 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 = stringToText(str.data);
PG_RETURN_TEXT_P(ptResult);
}
示例2:
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;
}
示例3: textToString
Datum
DumpQueryFromFileToDXLFile(PG_FUNCTION_ARGS)
{
char *szSqlFilename = textToString(PG_GETARG_TEXT_P(0));
char *szFilename = textToString(PG_GETARG_TEXT_P(1));
CFileReader fr;
fr.Open(szSqlFilename);
ULLONG ullSize = fr.UllSize();
char *pcBuf = (char*) gpdb::GPDBAlloc(ullSize + 1);
fr.UlpRead((BYTE*)pcBuf, ullSize);
pcBuf[ullSize] = '\0';
fr.Close();
int iLen = translateQueryToFile(pcBuf, szFilename);
gpdb::GPDBFree(pcBuf);
PG_RETURN_INT32(iLen);
}