コード例 #1
0
ファイル: ADO.cpp プロジェクト: cdecl/GlassLib
long ADOComm::Execute(ADODB::_CommandPtr &pCommand, const long lCommandTimeout)
{
	// CommandTimeout  
	if (lCommandTimeout >= 0) {
		pCommand->PutCommandTimeout(lCommandTimeout);
	}

	_variant_t varRecordsAffected;
	pCommand->PutRefActiveConnection(pConnection_);
	pCommand->Execute(&varRecordsAffected, &vtMissing, ADODB::adExecuteNoRecords); // NoRecords	
	pCommand->PutRefActiveConnection(NULL);   

	return (long)varRecordsAffected;
}
コード例 #2
0
ファイル: ADO.cpp プロジェクト: cdecl/GlassLib
void ADOComm::OpenRs(ADODB::_CommandPtr &pCommand, CursorLocationEnum adCursorLocation, const long lCommandTimeout)
{
	if (lCommandTimeout >= 0) {
		pCommand->PutCommandTimeout(lCommandTimeout);
	}

	pCommand->PutRefActiveConnection(pConnection_);
	pConnection_->PutCursorLocation(adCursorLocation);

	_variant_t varRecordsAffected;
	pRecordset_ = pCommand->Execute(&varRecordsAffected, &vtMissing, pCommand->GetCommandType());
	pCommand->PutRefActiveConnection(NULL);

	if (adCursorLocation != adUseServer) {
		pRecordset_->PutRefActiveConnection(NULL); 
	}
}
コード例 #3
0
ファイル: ADO.cpp プロジェクト: cdecl/GlassLib
//////////////////////////////////////////////////////////////////////
// Query Excute
long ADOComm::Execute(const _bstr_t &bstrSql, const long lCommandTimeout, bool bPrepared)
{
	ADODB::_CommandPtr pCommand;
	pCommand.CreateInstance(__uuidof(Command));

	// CommandTimeout  
	if (lCommandTimeout >= 0) {
		pCommand->PutCommandTimeout(lCommandTimeout);
	}

	pCommand->PutCommandType(ADODB::adCmdText);
	pCommand->PutCommandText(bstrSql);
	pCommand->PutPrepared(bPrepared ? VARIANT_TRUE : VARIANT_FALSE);
	
	_variant_t varRecordsAffected;
	pCommand->PutRefActiveConnection(pConnection_);
	pCommand->Execute(&varRecordsAffected, &vtMissing, ADODB::adExecuteNoRecords); // NoRecords
	pCommand->PutRefActiveConnection(NULL);

	return (long)varRecordsAffected;
}
コード例 #4
0
ファイル: ADO.cpp プロジェクト: cdecl/GlassLib
//////////////////////////////////////////////////////////////////////
// Recordset Open
void ADOComm::OpenRs(const _bstr_t &bstrSql, CursorLocationEnum adCursorLocation, const long lCommandTimeout, bool bPrepared)
{
	ADODB::_CommandPtr pCommand;
	pCommand.CreateInstance(__uuidof(Command));

	pCommand->PutCommandType(ADODB::adCmdText);
	pCommand->PutCommandText(bstrSql);
	pCommand->PutPrepared(bPrepared ? VARIANT_TRUE : VARIANT_FALSE);
	
	if (lCommandTimeout >= 0) {
		pCommand->PutCommandTimeout(lCommandTimeout);
	}

	pCommand->PutRefActiveConnection(pConnection_);
	pConnection_->PutCursorLocation(adCursorLocation);

	_variant_t varRecordsAffected;
	pRecordset_ = pCommand->Execute(&varRecordsAffected, &vtMissing, ADODB::adCmdText);
	pCommand->PutRefActiveConnection(NULL);

	if (adCursorLocation != adUseServer) {
		pRecordset_->PutRefActiveConnection(NULL); 
	}
}