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


C++ CComQIPtr::Execute方法代码示例

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


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

示例1: Open

BOOL COledbRecordset::Open(LPCTSTR pstrSQL, long lType /*= DB_OPEN_TYPE_FORWARD_ONLY*/, long lOptions /*= DB_OPTION_DEFAULT*/)
{
   _ASSERTE(m_pDb==NULL || m_pDb->IsOpen());
   _ASSERTE(!::IsBadStringPtr(pstrSQL,(UINT)-1));
   HRESULT Hr;

   // Close old recordset
   Close();

   m_nRowsAffected = 0;

   // Create a new recordset
   CComQIPtr<IDBCreateCommand> spCreate = m_pDb->m_spSession;
   if( spCreate == NULL ) return FALSE;
   CComPtr<ICommand> spCommand;
   Hr = spCreate->CreateCommand(NULL, IID_ICommand, (LPUNKNOWN*) &spCommand);
   if( FAILED(Hr) ) return _Error(Hr);
   // Set type
   COledbDatabase::_SetRecordsetType(spCommand, lType, lOptions);
   // Set SQL
   CComQIPtr<ICommandText> spText = spCommand;
   _ASSERTE(spText);
   USES_CONVERSION;
   Hr = spText->SetCommandText(DBGUID_DBSQL, T2COLE(pstrSQL));
   if( FAILED(Hr) ) return _Error(Hr);

   // Execute...
   Hr = spText->Execute(NULL, IID_IRowset, NULL, &m_nRowsAffected, (LPUNKNOWN*) &m_spRowset);
   if( FAILED(Hr) ) return _Error(Hr);

   // Bind columns
   if( !_BindColumns() ) return FALSE;

   return MoveNext();
}
开发者ID:okigan,项目名称:dblib,代码行数:35,代码来源:DbOledb.cpp

示例2: ExecuteSQL

BOOL COledbDatabase::ExecuteSQL(LPCTSTR pstrSQL, long lType /*= DB_OPEN_TYPE_FORWARD_ONLY*/, long lOptions /*= DB_OPTION_DEFAULT*/, DWORD* pdwRowsAffected/*= NULL*/)
{
   USES_CONVERSION;
   HRESULT Hr;

   if( pdwRowsAffected ) *pdwRowsAffected = 0;
   CComQIPtr<IDBCreateCommand> spCreate = m_spSession;
   if( spCreate == NULL ) return FALSE;
   CComPtr<ICommand> spCommand;
   Hr = spCreate->CreateCommand(NULL, IID_ICommand, (LPUNKNOWN*) &spCommand);
   if( FAILED(Hr) ) return _Error(Hr);
   _SetRecordsetType(spCommand, lType, lOptions);
   CComQIPtr<ICommandText> spText = spCommand;
   _ASSERTE(spText);
   Hr = spText->SetCommandText(DBGUID_DBSQL, T2CW(pstrSQL));
   if( FAILED(Hr) ) return _Error(Hr);
   CComPtr<IRowset> spRowset;
   Hr = spText->Execute(NULL, IID_IRowset, NULL, (LONG*) pdwRowsAffected, (LPUNKNOWN*) &spRowset);
   if( FAILED(Hr) ) return _Error(Hr);
   return TRUE;
}
开发者ID:okigan,项目名称:dblib,代码行数:21,代码来源:DbOledb.cpp

示例3: Execute

STDMETHODIMP CPluginDebugCommand::Execute(VARIANT* vParam, IVariantObject** ppVariantObject)
{
	CComQIPtr<IDebugCommand> pDebugCommand = m_pDebugCommand;
	ATLASSERT(pDebugCommand);
	CComVar vResult;
	RETURN_IF_FAILED(pDebugCommand->Execute(vParam, &vResult));

	GUID iidCommand = {0};
	RETURN_IF_FAILED(m_pPluginInfo->GetId(&iidCommand));

	if (ppVariantObject)
	{
		CComPtr<IUnknown> pPluginParserUnknown;
		RETURN_IF_FAILED(m_pPluginManager->CreatePluginInstance(PNAMESP_DBGENGINE, PDBGTYPE_COMMAND_PARSER, iidCommand, &pPluginParserUnknown));

		CComQIPtr<ICommandResultParser> pCommandResultParser = pPluginParserUnknown;
		if (!pCommandResultParser)
			return E_NOINTERFACE;

		RETURN_IF_FAILED(pCommandResultParser->Parse(&vResult, ppVariantObject));

		CComQIPtr<IInitializeWithPluginInfo> pInitializeWithPluginInfo = m_pDebugCommand;
		if (pInitializeWithPluginInfo)
		{
			CComPtr<IPluginInfo> pPluginInfo;
			RETURN_IF_FAILED(pInitializeWithPluginInfo->GetPluginInfo(&pPluginInfo));
			CComQIPtr<IVariantObject> pSourceVariantObject = pPluginInfo;
			if (pSourceVariantObject)
			{
				CComVar v1;
				if (pSourceVariantObject->GetVariantValue(VAR_COMMAND_TEXT, &v1) == S_OK)
				{
					RETURN_IF_FAILED((*ppVariantObject)->SetVariantValue(VAR_COMMAND_TEXT, &v1));
				}
			}
		}
	}
	return S_OK;
}
开发者ID:ip821,项目名称:windbgtool,代码行数:39,代码来源:PluginDebugCommand.cpp


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