本文整理汇总了C++中CConnect::setOutContext方法的典型用法代码示例。如果您正苦于以下问题:C++ CConnect::setOutContext方法的具体用法?C++ CConnect::setOutContext怎么用?C++ CConnect::setOutContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConnect
的用法示例。
在下文中一共展示了CConnect::setOutContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INITIALIZE_DIALOG
SQLRETURN INITIALIZE_DIALOG(SRVR_CALL_CONTEXT *srvrCallContext)
{
CEE_status sts;
CConnect *pConnection;
SQLRETURN rc = SQL_SUCCESS;
// RAJANI - for password expiry
CONNECT_FIELD_ITEMS connectFieldItems;
bool bChangePwd = false;
odbc_SQLSvc_InitializeDialogue_exc_ exception_ = {0,0,0};
OUT_CONNECTION_CONTEXT_def outContext;
pConnection = (CConnect *)srvrCallContext->sqlHandle;
short retry = 0;
retryInitializeDialogue:
do
{
sts = odbc_SQLSvc_InitializeDialogue_(NULL,
srvrCallContext,
srvrCallContext->u.connectParams.userDesc,
srvrCallContext->u.connectParams.inContext,
srvrCallContext->dialogueId,
&exception_,
&outContext);
if (sts == CEE_SUCCESS) break;
Sleep(100);
}
while (sts == COMM_LINK_FAIL_EXCEPTION && retry++ < 3);
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","INITIALIZE_DIALOG");
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(SERVER_ERROR, IDS_08_S01, 0, FORMAT_ERROR((long)pConnection->m_srvrTCPIPSystem));
else if (sts == TRANSPORT_ERROR)
pConnection->setDiagRec(SERVER_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,"INITIALIZE_DIALOG failed");
return SQL_ERROR;
}
// Start CCF
pConnection->setExceptionErrors(exception_.exception_nr, exception_.exception_detail);
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_:
//.........这里部分代码省略.........