当前位置: 首页>>代码示例>>C++>>正文


C++ CFileIO::GetColNameHeap方法代码示例

本文整理汇总了C++中CFileIO::GetColNameHeap方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileIO::GetColNameHeap方法的具体用法?C++ CFileIO::GetColNameHeap怎么用?C++ CFileIO::GetColNameHeap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileIO的用法示例。


在下文中一共展示了CFileIO::GetColNameHeap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sizeof

// CImpIColumnsInfo::GetColumnInfo -------------------------------------------
//
// @mfunc Returns the column metadata needed by most consumers.
//
// @rdesc HRESULT
//      @flag S_OK              | The method succeeded
//      @flag E_OUTOFMEMORY     | Out of memory
//      @flag E_INVALIDARG      | pcColumns or prginfo or ppStringsbuffer was NULL
//
STDMETHODIMP CImpIColumnsInfo::GetColumnInfo
(
    DBORDINAL*      pcColumns,      //@parm OUT | Number of columns in rowset
    DBCOLUMNINFO**  prgInfo,        //@parm OUT | Array of DBCOLUMNINFO Structures
    WCHAR**         ppStringsBuffer //@parm OUT | Storage for all string values
)
{
	HRESULT			hr = S_OK;
	DBORDINAL		cCols = 0;
	DBORDINAL		cExtraCols = 0;
	DBORDINAL		cbHeapUsed = 0;
	DBORDINAL		cIter = 0;
	BYTE *			pbHeap = NULL;
	WCHAR *			pwstrBuffer = NULL;
	DBCOLUMNINFO *	rgdbcolinfo = NULL;
    DBCOLUMNINFO *	rgdbInternalcolinfo = NULL;
	DBCOLUMNINFO *	rgdbExtracolinfo = NULL;
	CRowset *		pCRowset = NULL;
	CFileIO	*		pFileio = NULL;

	//
	// Asserts
    //
	assert(m_pObj);

    //
    // Check in-params and NULL out-params in case of error
    //
	if( pcColumns )
		*pcColumns = 0;

	if( prgInfo )
		*prgInfo = NULL;
	
	if( ppStringsBuffer )
		*ppStringsBuffer = NULL;

    if( !pcColumns || !prgInfo || !ppStringsBuffer )
        return E_INVALIDARG;
	
	//
	// Get the Column Information off of the Command or Rowset
	//
	if( m_pObj->GetBaseObjectType() == BOT_COMMAND )
	{
		//
		// Asserts
		//
		assert(((CCommand *) m_pObj)->m_pCSession);
		assert(((CCommand *) m_pObj)->m_pCSession->m_pCDataSource);

		//
		// Check that a command has been set
		//
		if( !((CCommand *) m_pObj)->IsCommandSet() )
			return DB_E_NOCOMMAND;

		//
		// Try to open the file...
		//
		hr = ((CCommand *) m_pObj)->m_pCSession->m_pCDataSource->OpenFile(
						   ((CCommand *) m_pObj)->GetCommandText(), &pFileio);
		if( FAILED(hr) )
			return hr;
	}
	else 
	{
		if( m_pObj->GetBaseObjectType() == BOT_ROWSET )
			pFileio = ((CRowset *) m_pObj)->GetFileObj();
		else
		{
			pFileio = ((CRow *) m_pObj)->GetFileObj();

			cExtraCols = ((CRow *) m_pObj)->GetExtraColCount();
			rgdbExtracolinfo = ((CRow *) m_pObj)->GetExtraColumnInfo();
		}
	}

	//
	// Get the column count and delete unneeded info
	//
	cCols				= pFileio->GetColumnCnt();
	pbHeap				= pFileio->GetColNameHeap();		
	cbHeapUsed			= pFileio->GetColNameHeapSize();
	rgdbInternalcolinfo = pFileio->GetColInfo();		

	//
	// Return the column information
	//
	SAFE_ALLOC(rgdbcolinfo, DBCOLUMNINFO, (cCols + cExtraCols) * sizeof(DBCOLUMNINFO));
	SAFE_ALLOC(pwstrBuffer, WCHAR, cbHeapUsed);
//.........这里部分代码省略.........
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:101,代码来源:colinfo.cpp


注:本文中的CFileIO::GetColNameHeap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。