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


C++ CConnect::getExceptionNr方法代码示例

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


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

示例1: ENDTRANSACT

SQLRETURN ENDTRANSACT(SRVR_CALL_CONTEXT *srvrCallContext)
{
	CEE_status	sts;

    struct odbc_SQLSvc_EndTransaction_exc_ exception_ = {0,0,0};
	ERROR_DESC_LIST_def sqlWarning = {0,0};
	
	UDWORD timerTimeout = srvrCallContext->connectionTimeout;
	CConnect *pConnection = (CConnect *)srvrCallContext->sqlHandle;
	
	if (timerTimeout != 0)
		timerTimeout = (timerTimeout < 180)? 180: timerTimeout;

	sts = odbc_SQLDrvr_EndTransaction_pst_(
									srvrCallContext,
									srvrCallContext->dialogueId,
									srvrCallContext->u.completionType,
                                    &exception_,
                                    &sqlWarning);


	if (sts != CEE_SUCCESS)
	{
		if (sts == CEE_INTERNALFAIL)
			pConnection->setDiagRec(DRIVER_ERROR, IDS_EXCEPTION_MSG,0,"SQL SERVER",
				NULL,SQL_ROW_NUMBER_UNKNOWN,SQL_COLUMN_NUMBER_UNKNOWN,2,"Internal Error","ENDTRANSACT");
		else if (sts == TIMEOUT_EXCEPTION)
				pConnection->setDiagRec(DRIVER_ERROR, IDS_S1_T00, 0, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem));
		else if (sts == COMM_LINK_FAIL_EXCEPTION)
				pConnection->setDiagRec(DRIVER_ERROR, IDS_08_S01, 0, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem));
		else if (sts == TRANSPORT_ERROR)
				pConnection->setDiagRec(DRIVER_ERROR, IDS_08_S02, 0, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem));
		else
			pConnection->setDiagRec(DRIVER_ERROR, IDS_S1_000, sts, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem), 
				NULL, SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1,"ENDTRANSACT failed");
		return SQL_ERROR;
	}

    odbc_SQLSvc_EndTransaction_ccf_ (srvrCallContext,
                                     &exception_,
                                     &sqlWarning);

	// 
	// cleanup
	//

	if(exception_.exception_nr == odbc_SQLSvc_EndTransaction_SQLError_exn_ &&
	   exception_.u.SQLError.errorList._length > 0 )
  	      delete[] exception_.u.SQLError.errorList._buffer;

	if(sqlWarning._length > 0)
		delete[] sqlWarning._buffer;


	switch (pConnection->getExceptionNr())
	{
		case CEE_SUCCESS:
			return SQL_SUCCESS;
		case odbc_SQLSvc_EndTransaction_SQLInvalidHandle_exn_:
			return SQL_INVALID_HANDLE;
		default:
			return SQL_ERROR;
	}
} // ENDTRANSACT()
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:64,代码来源:netconnect.cpp

示例2: GETOBJREF


//.........这里部分代码省略.........
				exception_.u.ASNotAvailable.ErrorText);
		break;	
	case odbcas_ASSvc_GetObjRefHdl_LogonUserFailure_exn_ :
		PVOID lpMsgBuf;
		FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
				NULL,
				exception_.u.LogonUserFailure.errorCode,
				MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), // Default language
				(LPTSTR) &lpMsgBuf,
				0,
				NULL);
		pConnection->setDiagRec(ASSOC_SERVER_ERROR, IDS_UNABLE_TO_LOGON,
			exception_.u.LogonUserFailure.errorCode,
			 (char *)lpMsgBuf);
		LocalFree(lpMsgBuf);
		break;
	case odbcas_ASSvc_GetObjRefHdl_ASNotAvailable_exn_ :
		pConnection->setDiagRec(ASSOC_SERVER_ERROR,IDS_ASSOC_SRVR_NOT_AVAILABLE, 0,
			exception_.u.ASNotAvailable.ErrorText);
		break;
	case odbcas_ASSvc_GetObjRefHdl_DSNotAvailable_exn_:
		pConnection->setDiagRec(ASSOC_SERVER_ERROR,IDS_DS_NOT_AVAILABLE,0L,	
			exception_.u.DSNotAvailable.ErrorText);
		break;
	case odbcas_ASSvc_GetObjRefHdl_PortNotAvailable_exn_:
		pConnection->setDiagRec(ASSOC_SERVER_ERROR, IDS_PORT_NOT_AVAILABLE);
		break;
	case odbcas_ASSvc_GetObjRefHdl_InvalidUser_exn_:
		pConnection->setDiagRec(ASSOC_SERVER_ERROR, IDS_28_000);
		break;
	case odbcas_ASSvc_GetObjRefHdl_ASTimeout_exn_ :
		pConnection->setDiagRec(ASSOC_SERVER_ERROR, IDS_S1_T00);
		break;
	case odbcas_ASSvc_GetObjRefHdl_ASNoSrvrHdl_exn_ :
		pConnection->setDiagRec(ASSOC_SERVER_ERROR,IDS_NO_SRVR_AVAILABLE, 0,
			exception_.u.ASNotAvailable.ErrorText);
		break;
	case odbcas_ASSvc_GetObjRefHdl_ASTryAgain_exn_ :
	case -27:
		break;
	case -29:
		break;
	default:
		pConnection->setDiagRec(exception_.exception_nr, GET_OBJECT_REF_PROCNAME,
				pConnection->getSrvrIdentity());
		break;
	}	/* Ends CCF */

	
	switch (pConnection->getExceptionNr())
	{
	case CEE_SUCCESS:
		pConnection->getVersion(&version, NSK_ODBCAS_COMPONENT);
		if (version.componentId != NSK_ODBCAS_COMPONENT ||
			version.majorVersion != NSK_VERSION_MAJOR_1 ||
			version.minorVersion != NSK_VERSION_MINOR_0 )
		{
			char tmp[100];
			IDL_short majorVersion = version.majorVersion;
			IDL_short minorVersion = version.minorVersion;
			majorVersion = (majorVersion > 0)? majorVersion - 1: majorVersion;
			sprintf(tmp,"Incorrect AS version: %d.%d, expected: %d.%d",majorVersion,minorVersion,NSK_VERSION_MAJOR_1 - 1,NSK_VERSION_MINOR_0);
			pConnection->setDiagRec(ASSOC_SERVER_ERROR, IDS_S1_000, 0, tmp,NULL, 0, 0, 1, tmp);
			rc = SQL_ERROR;
		}
		break;
	case odbcas_ASSvc_GetObjRefHdl_ASTryAgain_exn_:
		_ftime(&time_curr);
		curTimeout = (long)(time_curr.time - time_start.time);

		if ((dwTimeout != 0) && (dwTimeout <= curTimeout))
		{
			pConnection->setDiagRec(ASSOC_SERVER_ERROR, IDS_S1_T00);
			rc = SQL_ERROR;
			break;
		}
		else
		{
			if(dwTimeout != 0)
				srvrCallContext->u.connectParams.loginTimeout = dwTimeout - curTimeout;

			Sleep(dwSleep); 
			getObjRefRetryCnt++;
			goto TryAgain;
		}
		break;
	default:
		rc = SQL_ERROR;
		break;
	}

	/*
	 * CleanUp
	 */ 

	if(versionList._buffer != NULL)
		delete versionList._buffer;

	return rc;
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:101,代码来源:netconnect.cpp

示例3: TERMINATE_DIALOG

SQLRETURN TERMINATE_DIALOG(SRVR_CALL_CONTEXT *srvrCallContext)
{
	CEE_status	sts;
	long timerTimeout;

	odbc_SQLSvc_TerminateDialogue_exc_ exception_;

	CConnect *pConnection = (CConnect *)srvrCallContext->sqlHandle;
	timerTimeout = srvrCallContext->connectionTimeout > 10 ? srvrCallContext->connectionTimeout : 10;
	
	sts = odbc_SQLSvc_TerminateDialogue_(NULL,
		srvrCallContext,
		srvrCallContext->dialogueId,
		&exception_);

	if (sts != CEE_SUCCESS)
	{
		if (sts == CEE_INTERNALFAIL)
		{
			pConnection->setDiagRec(DRIVER_ERROR, IDS_EXCEPTION_MSG,0,"SQL SERVER",
				NULL,SQL_ROW_NUMBER_UNKNOWN,SQL_COLUMN_NUMBER_UNKNOWN,2,"Internal Error","TERMINATE_DIALOG");
			return SQL_ERROR;
		}
		pConnection->setDiagRec(DRIVER_ERROR, IDS_S1_000, sts, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem),
			NULL, SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, "TERMINATE_DIALOG failed");
		return SQL_SUCCESS_WITH_INFO;
	}

	// Start CCF
	pConnection->setExceptionErrors(exception_.exception_nr, exception_.exception_detail);
	switch (exception_.exception_nr) {
	case CEE_SUCCESS:
		pConnection->resetGetObjRefHdlOutput();
		break;
	case odbc_SQLSvc_TerminateDialogue_SQLError_exn_:
		if (exception_.exception_detail == 25000)
			pConnection->setDiagRec(DRIVER_ERROR, IDS_25_000);
		else
			pConnection->setDiagRec(&exception_.u.SQLError);
		break;
	case odbc_SQLSvc_TerminateDialogue_ParamError_exn_:
		pConnection->setDiagRec(SERVER_ERROR, IDS_PROGRAM_ERROR, exception_.exception_nr, 
							exception_.u.ParamError.ParamDesc);
		break;
	case odbc_SQLSvc_TerminateDialogue_InvalidConnection_exn_:
		pConnection->sendCDInfo(exception_.exception_nr);
		pConnection->setDiagRec(SERVER_ERROR, IDS_08_S01);
		break;
	default:
		pConnection->sendCDInfo(exception_.exception_nr);
		pConnection->setDiagRec(exception_.exception_nr, TERMINATE_DIALOG_PROCNAME,
				pConnection->getSrvrIdentity());
		break;
	}
	if (exception_.exception_detail != 25000)
		CloseIO (pConnection->m_srvrTCPIPSystem);
	// Close CCF

	//
	// cleanup
	//
	if(exception_.exception_nr == odbc_SQLSvc_TerminateDialogue_SQLError_exn_ &&
	   exception_.u.SQLError.errorList._length > 0 )
  	      delete[] exception_.u.SQLError.errorList._buffer;



	switch (pConnection->getExceptionNr())
	{
		case CEE_SUCCESS:
			return SQL_SUCCESS;
		default:
	// if transaction is open return SQL_ERROR
			if (pConnection->getExceptionDetail() == 25000)
				return -25000;
			else
	// Any other errors treat them as if it has been disconnected
				return SQL_SUCCESS_WITH_INFO;
	}

} // TERMINATE_DIALOG()
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:81,代码来源:netconnect.cpp

示例4: INITIALIZE_DIALOG


//.........这里部分代码省略.........
	switch ( exception_.exception_nr) 
	{
	case CEE_SUCCESS:
		pConnection->setOutContext(&outContext);
		break;
	case odbc_SQLSvc_InitializeDialogue_SQLError_exn_:
		if (exception_.exception_detail == 4415) // SECMXO_NO_CERTIFICATE
		{
			try{
				if (pConnection->m_SecPwd->switchCertificate()==SQL_SUCCESS) // successfully switched to the new certificate
					pConnection->setRetryEncryption();
				else // there is no certificate to switch to
					pConnection->setDiagRec(&exception_.u.SQLError);
			}
			catch (SecurityException se) {
				rc= se.getErrCode();
				pConnection->setSecurityError(rc, se.getSQLState(), se.getMsg());
			}
		}
		else
			pConnection->setDiagRec(&exception_.u.SQLError);
		break;
	case odbc_SQLSvc_InitializeDialogue_InvalidUser_exn_:
		if (outContext.outContextOptions1 & OUTCONTEXT_OPT1_DOWNLOAD_CERTIFICATE)
		{
			try {
				pConnection->m_SecPwd->switchCertificate(outContext.outContextOptionString, outContext.outContextOptionStringLen);
			} 
			catch (SecurityException se) {
				rc = se.getErrCode();
				pConnection->setSecurityError(rc, se.getSQLState(), se.getMsg());
			}
			if(rc == SQL_SUCCESS)
				pConnection->setRetryEncryption();
		}
		else if (srvrCallContext->u.connectParams.userDesc->userName != NULL && srvrCallContext->u.connectParams.userDesc->password._buffer != NULL)
			pConnection->setDiagRec(&exception_.u.SQLError);
		break;
	case odbc_SQLSvc_InitializeDialogue_ParamError_exn_:
		pConnection->setDiagRec(SQLMX_ERROR, IDS_28_000, exception_.exception_nr,
			(char*)(LPCTSTR)exception_.u.ParamError.ParamDesc, NULL, 
			SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, INITIALIZE_DIALOG_PROCNAME);
		break;
	case odbc_SQLSvc_InitializeDialogue_InvalidConnection_exn_:
		pConnection->setDiagRec(SERVER_ERROR, IDS_08_004_01);
		break;
	case odbc_SQLSvc_InitializeDialogue_SQLInvalidHandle_exn_:
		break;
	case odbc_SQLSvc_InitializeDialogue_SQLNeedData_exn_:
		break;
	default:
		pConnection->setDiagRec(exception_.exception_nr, INITIALIZE_DIALOG_PROCNAME,
				pConnection->getSrvrIdentity());
		break;
	}
	// End CCF
	
	switch (pConnection->getExceptionNr())
	{
		case CEE_SUCCESS:
			break;
		case odbc_SQLSvc_InitializeDialogue_SQLInvalidHandle_exn_:
			rc = SQL_INVALID_HANDLE;
			break;
		case odbc_SQLSvc_InitializeDialogue_SQLError_exn_: 
			if(pConnection->getExceptionDetail() == SQL_PASSWORD_EXPIRING || pConnection->getExceptionDetail() == SQL_PASSWORD_GRACEPERIOD)
			{
				pConnection->setOutContext(&outContext);
				rc = SQL_SUCCESS_WITH_INFO;
			}
			else
				rc = SQL_ERROR;
			break;
			//Arvind: When using a dummy username, it would get connected and can perform operations.
		case odbc_SQLSvc_InitializeDialogue_SQLNeedData_exn_:
			rc = SQL_NEED_DATA;
			break;
		default:
			rc = SQL_ERROR;
			break;
	}

	//
	// cleanup
	//
	if(exception_.exception_nr == odbc_SQLSvc_InitializeDialogue_SQLError_exn_ &&
	   exception_.u.SQLError.errorList._length > 0 )
  	      delete[] exception_.u.SQLError.errorList._buffer;
	if(exception_.exception_nr == odbc_SQLSvc_InitializeDialogue_InvalidUser_exn_ &&
	   exception_.u.InvalidUser.errorList._length > 0 )
  	      delete[] exception_.u.InvalidUser.errorList._buffer;
	if(outContext.versionList._length > 0)
		delete [] outContext.versionList._buffer;
	if((outContext.outContextOptions1 & OUTCONTEXT_OPT1_ROLENAME || outContext.outContextOptions1 & OUTCONTEXT_OPT1_DOWNLOAD_CERTIFICATE)
		&& outContext.outContextOptionStringLen > 0)
		delete [] outContext.outContextOptionString;

	return rc;

} // INITIALIZE_DIALOG()
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:101,代码来源:netconnect.cpp


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