Esempio n. 1
0
void
UPDATECONTEXT_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	SRVR_CONTEXT_def *srvrContext;

	long* param[1];
	retcode = decodeParameters(1, param, pnode->r_buffer(), pnode->r_buffer_length());
	if (retcode != CEE_SUCCESS)
	{
//LCOV_EXCL_START
		strcpy( errStrBuf2, "odbcs_srvr.cpp");
		strcpy( errStrBuf3, "SRVR-UPDATECONTEXT_IOMessage");
		strcpy( errStrBuf4, "buffer overflow");
		sprintf( errStrBuf5, "retcode <%d>", retcode);
		logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP );
		exit(1000);
//LCOV_EXCL_STOP
	}

	srvrContext	= (SRVR_CONTEXT_def*)param[0];

	odbc_SQLSvc_UpdateServerContext_ame_(
		 objtag_
	  ,  call_id_
	  ,  srvrContext
	  );
}
CEE_status
odbc_SQLSvc_TerminateDialogue_ts_res_(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ const struct odbc_SQLSvc_TerminateDialogue_exc_ *exception_
  )
{
	SRVRTRACE_ENTER(FILE_OIOM+2);
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;

	CEERCV_IOMessage_exc_ RCVexception_;
	IDL_short error;
	short reply_count;
	CEERCV_IOMessage_reply_seq_ reply;

	char* buffer = NULL;
	UInt32 message_length = 0;

	sts = odbc_SQLSvc_TerminateDialogue_param_res_(
			  pnode
			, buffer
			, message_length
			, exception_
	);
	if (sts == CEE_SUCCESS)
		sts = pnode->send_response(buffer, message_length, call_id_);
	SRVRTRACE_EXIT(FILE_OIOM+2);
	return sts;
}
Esempio n. 3
0
void
MONITORCALL_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	DIALOGUE_ID_def dialogueId;

	long* param[1];
	retcode = decodeParameters(1, param, pnode->r_buffer(), pnode->r_buffer_length());
	if (retcode != CEE_SUCCESS)
	{
//LCOV_EXCL_START
		strcpy( errStrBuf2, "odbcs_srvr.cpp");
		strcpy( errStrBuf3, "SRVR-MONITORCALL_IOMessage");
		strcpy( errStrBuf4, "buffer overflow");
		sprintf( errStrBuf5, "retcode <%d>", retcode);
		logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP );
		exit(1000);
//LCOV_EXCL_STOP
	}

	dialogueId	= *(IDL_long*)param[0];

	odbc_SQLSvc_MonitorCall_ame_(
		 objtag_
	  ,  call_id_
	  ,  dialogueId
	  );
}
Esempio n. 4
0
void
SQLDISCONNECT_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	char *curptr;

	DIALOGUE_ID_def dialogueId;

	curptr = pnode->r_buffer();

	// Copy 1st Parameter
	// copy dailogueId
	dialogueId = *(IDL_long *)(curptr);

	odbc_SQLSvc_TerminateDialogue_ame_(
		  objtag_
		, call_id_
		, dialogueId
	  );
}
void
odbc_SQLSrvr_UpdateLob_ts_res_(
	/* In   */ CEE_tag_def objtag_
  , /* In   */ const CEE_handle_def * call_id_
  , /* In   */ const struct odbc_SQLSvc_UpdateLob_exc_ * exception_
  )
{
	CInterface * pnode = (CInterface *) objtag_;

	CEE_status sts = CEE_SUCCESS;

	IDL_short error;
	CEERCV_IOMessage_reply_seq_ reply;

	char * buffer = NULL;
	UInt32 message_length = 0;

	sts = odbc_SQLsrvr_UpdateLob_param_res_(
		      pnode
		    , buffer
		    , message_length
		    , exception_
		    );

	if (sts == CEE_SUCCESS)
		sts = pnode->send_response(buffer, message_length, call_id_);
}
Esempio n. 6
0
void
SQLENDTRAN_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{

	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	IDL_char	*curptr;
	IDL_long inputPosition = 0;

	DIALOGUE_ID_def dialogueId;
	IDL_unsigned_short transactionOpt;

	curptr = pnode->r_buffer();

	dialogueId = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(dialogueId);

	transactionOpt = *(IDL_unsigned_short*)(curptr+inputPosition);
	inputPosition += sizeof(transactionOpt);

	odbc_SQLSrvr_EndTransaction_ame_(
			objtag_
		  , call_id_
		  , dialogueId
		  , transactionOpt);

} // SQLENDTRAN_IOMessage()
CEE_status
odbc_SQLSrvr_EndTransaction_ts_res_(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ const struct odbc_SQLSvc_EndTransaction_exc_ *exception_
  , /* In    */ ERROR_DESC_LIST_def *sqlWarning
  )
{
	SRVRTRACE_ENTER(FILE_OIOM+13);
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;

	CEERCV_IOMessage_exc_ RCVexception_;
	IDL_short error;
	short reply_count;
	CEERCV_IOMessage_reply_seq_ reply;

	char* buffer = NULL;
	UInt32 message_length = 0;

	odbc_SQLSrvr_EndTransaction_param_res_(
			  pnode
			, buffer
			, message_length
			, exception_
			, sqlWarning
	);
	if (sts == CEE_SUCCESS)
		sts = pnode->send_response(buffer, message_length, call_id_);
	SRVRTRACE_EXIT(FILE_OIOM+13);
	return sts;

} // odbc_SQLSrvr_EndTransaction_ts_res_()
CEE_status
odbc_SQLSrvr_SetConnectionOption_ts_res_(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ const struct odbc_SQLSvc_SetConnectionOption_exc_ *exception_
  , /* In    */ ERROR_DESC_LIST_def *sqlWarning
  )
{
	SRVRTRACE_ENTER(FILE_OIOM+3);
	CInterface* pnode = (CInterface*)objtag_;
	CEE_status sts = CEE_SUCCESS;

	IDL_char* buffer = NULL;
	IDL_unsigned_long message_length = 0;

	sts = odbc_SQLSrvr_SetConnectionOption_param_res_(
			  pnode
			, buffer
			, message_length
			, exception_
			, sqlWarning
	);
	if (sts == CEE_SUCCESS)
		sts = pnode->send_response(buffer, message_length, call_id_);
	SRVRTRACE_EXIT(FILE_OIOM+3);
	return sts;
}
Esempio n. 9
0
void CInterfaceManager::Load()
{
	m_oMutex.Enter();
	if(m_pAutoLibrary == NULL)
	{
		uint32 i, nCount;
		CString oLibDir;
		const char* sAppHome = CFilePathInfo::GetInstance()->GetHome();
		oLibDir += sAppHome;
		oLibDir += "/lib/";
		oLibDir += m_sLibDir;
		m_pAutoLibrary = new CAutoLibrary(oLibDir.GetStr());
		nCount = m_oInterfaces.GetSize();
		for(i=nCount; i; --i)
		{
			CInterface* pInterface = m_oInterfaces[i-1];
			if(QueryInterface(pInterface->GetInterfaceName()) != pInterface)
			{
				m_oMutex.Leave();
				FocpAbort(( "re-register interface :%s",  pInterface->GetInterfaceName()));
			}
		}
	}
	m_oMutex.Leave();
}
CEE_status
odbc_SQLSrvr_Close_ts_res_(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ IDL_long returnCode
  , /* In    */ IDL_long rowsAffected
  , /* In    */ IDL_long sqlWarningOrErrorLength
  , /* In    */ BYTE *sqlWarningOrError
  )
{
	SRVRTRACE_ENTER(FILE_OIOM+12);

	CInterface* pnode = (CInterface*)objtag_;
	CEE_status sts = CEE_SUCCESS;

	IDL_char* buffer = NULL;
	IDL_unsigned_long message_length = 0;

	odbc_SQLSrvr_Close_param_res_(
			  pnode
			, buffer
			, message_length
			, returnCode
			, sqlWarningOrErrorLength
			, sqlWarningOrError
			, rowsAffected
	);

	if (sts == CEE_SUCCESS)
		sts = pnode->send_response(buffer, message_length, call_id_);
	SRVRTRACE_EXIT(FILE_OIOM+12);
	return sts;
}
Esempio n. 11
0
int main( int argc, char **argv )
{
    CInterface interface;
    interface.init();
    interface.async_call_this_method_run_in_ioservice_thead(100, callback_func);
    getchar();
    interface.uninit();
    return 0;
}
Esempio n. 12
0
v8::Handle<v8::Value> V8CInterface::getPlatformMethodCustom(const v8::Arguments& args)
{
    CInterface* imp = V8CInterface::toNative(args.Holder());
    RefPtr<CPlatform> cPlatform = imp->getPlatform();
    if (!cPlatform)
        return throwError(v8SyntaxError, "Cannot create new CPlatform object.", args.GetIsolate());
    if (!openclFlag)
        return throwError(v8SyntaxError, "Cannot call getPlatform when OpenCL is not loaded.", args.GetIsolate());
    return toV8(cPlatform.get(), v8::Handle<v8::Object>(), args.GetIsolate());
}
Esempio n. 13
0
int main(const int argc, const char **argv) {

	std::stringstream usage;
	std::string cc = "";

	// hash map for fetching options data
	options_map op_data;

	try {
		// process command line arguments and 'usage' should contain
		// the usage message.
		OptionParser op(argc, argv, usage);

		int rval = op.processOptions(op_data);

		if (rval == 0) {
			// fetch user input from the interfacing code
			CInterface ci;

			// yes means load readline support
			cc = ci.getUserInput(op_data["r"] == "yes");
		} else if (rval == 2) {
			std::cout << usage.str();
			return 0;
		}

	} catch (po::error & e) {
		std::cout << "Invalid options passed ...\n";
		std::cout << usage.str();
		return 1;
	}

	// add data meant to be appended to the beginning
	cc = op_data["a"] + "\n" + cc;

	// remove beginning and trailing whitespaces with custom function
	cc = Utility::trim(cc);

	// write to file only if content is not totally blank
	if (!cc.empty()) {
		Journal journal;
		journal.takeNote(cc);

		std::string dateformat = op_data["d"];
		if (dateformat.begin() == dateformat.end()) {
			dateformat = "%d/%m/%Y-%H:%M:%S";
		}

		journal.saveNote(dateformat);
	}

	return 0;
}
CEE_status
odbc_SQLSrvr_Execute_ts_res_(
    /* In    */       CEE_tag_def     objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */       IDL_long        returnCode
  , /* In    */       IDL_long        sqlWarningOrErrorLength
  , /* In    */       BYTE           *sqlWarningOrError
  , /* In    */       IDL_long        rowsReturned
  , /* In    */       IDL_long        sqlQueryType
  , /* In    */       IDL_long        estimatedCost
  , /* In    */       IDL_long        outValuesLength
  , /* In    */       BYTE           *outValues
  , /* In    */		  IDL_long outputDescLength // Used with execdirect
  , /* In    */		  BYTE *outputDesc          // Used with execdirect
  , /* In    */		  Long stmtHandle       // Used for SPJ result sets
  , /* In    */       IDL_long   stmtHandleKey  
                          )
{
  SRVRTRACE_ENTER(FILE_OIOM+23);

  CInterface                   *pnode = (CInterface*)objtag_;
  CEE_status                    sts = CEE_SUCCESS;
  CEERCV_IOMessage_exc_         RCVexception_;
  IDL_short                     error;
  short                         reply_count;
  CEERCV_IOMessage_reply_seq_   reply;
  char                         *buffer = NULL;
  UInt32 message_length = 0;

  odbc_SQLSrvr_Execute_param_res_( pnode
			       , buffer
			       , message_length
			       , returnCode
			       , sqlWarningOrErrorLength
			       , sqlWarningOrError
			       , rowsReturned
				   , sqlQueryType
				   , estimatedCost
			       , outValuesLength
			       , outValues
				   , outputDescLength
				   , outputDesc
				   , stmtHandle
				   , stmtHandleKey
				   );

  if (sts == CEE_SUCCESS)
    sts = pnode->send_response(buffer, message_length, call_id_);
  SRVRTRACE_EXIT(FILE_OIOM+11);
  return sts;

}  // end odbc_SQLSrvr_Execute_ts_res_
CEE_status
odbc_SQLSrvr_Prepare_ts_res_(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In   */ IDL_long returnCode
  , /* In   */ IDL_long sqlWarningOrErrorLength
  , /* In   */ BYTE *sqlWarningOrError
  , /* In   */ IDL_long sqlQueryType
  , /* In   */ IDL_long stmtHandleKey
  , /* In   */ IDL_long estimatedCost
  , /* In   */ IDL_long inputDescLength
  , /* In   */ BYTE *inputDesc
  , /* In   */ IDL_long outputDescLength
  , /* In   */ BYTE *outputDesc
 )
{
	SRVRTRACE_ENTER(FILE_OIOM+11);
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;

	CEERCV_IOMessage_exc_ RCVexception_;
	IDL_short error;
	short reply_count;
	CEERCV_IOMessage_reply_seq_ reply;

	char* buffer = NULL;
	UInt32 message_length = 0;

	odbc_SQLSrvr_Prepare_param_res_(
			  pnode
			, buffer
			, message_length
			, returnCode
			, sqlWarningOrErrorLength
			, sqlWarningOrError
			, sqlQueryType
			, stmtHandleKey
			, estimatedCost
			, inputDescLength
			, inputDesc
			, outputDescLength
			, outputDesc
	);

	if (sts == CEE_SUCCESS)
	{
		sts = pnode->send_response(buffer, message_length, call_id_);
	}
	SRVRTRACE_EXIT(FILE_OIOM+11);
	return sts;
} /* odbc_SQLSrvr_Prepare_ts_res_() */
Esempio n. 16
0
void V8CInterface::getPlatformMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
    CInterface* imp = V8CInterface::toNative(args.Holder());
    RefPtr<CPlatform> cPlatform = imp->getPlatform();
    if (!cPlatform) {
        throwError(v8SyntaxError, "Cannot create new CPlatform object.", args.GetIsolate());
        return;
    }
    if (!openclFlag) {
        throwError(v8SyntaxError, "Cannot call getPlatform when OpenCL is not loaded.", args.GetIsolate());
        return;
    }
    v8SetReturnValue(args, toV8(cPlatform.get(), v8::Handle<v8::Object>(), args.GetIsolate()));
}
Esempio n. 17
0
void
SQLSETCONNECTATTR_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	IDL_char	*curptr;
	IDL_long inputPosition = 0;

	DIALOGUE_ID_def dialogueId;
	IDL_short  connectionOption;
	IDL_long   optionValueNum;
    IDL_long   optionValueStrLen = 0;
	IDL_string optionValueStr = NULL;

	curptr = pnode->r_buffer();

	dialogueId = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(dialogueId);

	connectionOption = *(IDL_short*)(curptr+inputPosition);
	inputPosition += sizeof(connectionOption);

	optionValueNum	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(optionValueNum);

	optionValueStrLen = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(optionValueStrLen);

	if(optionValueStrLen > 0)
	{
		optionValueStr = curptr+inputPosition;
		inputPosition += optionValueStrLen;
	}


	odbc_SQLSrvr_SetConnectionOption_ame_(
			objtag_
		  , call_id_
		  , dialogueId
		  , connectionOption
		  , optionValueNum
		  , optionValueStr);

} // SQLSETCONNECTATTR_IOMessage()
Esempio n. 18
0
int nfdump2dot (char* input, char* output, char* ip, char* role_nums, bool summarize_client_roles=true, bool summarize_multi_client_roles=true, bool summarize_server_roles=true, bool summarize_p2p_roles=true){
	// return immediately if parameters are empty
	if(!input)
		return 1;
	if(!output)
		return 2;
	if(!ip)
		return 3;
	if(!role_nums)
		return 4;

	// needed for the references
	std::string in_filename = input;
	std::string outfilename = output;
	std::string IP_str = ip;
	std::string role_num_str = role_nums;

	// parse role number string
	set<uint32_t> role_num_set;
	vector<string> parts;
	boost::split(parts, role_num_str, boost::is_any_of(","));
	try {
		for (vector<string>::const_iterator it = parts.begin(); it!=parts.end(); ++it) {
			if ((*it) == "") {
				continue;
			}
			role_num_set.insert(boost::lexical_cast<uint32_t>(*it));
		}
	} catch (boost::bad_lexical_cast const& e) {
		cerr << "unable to convert role number string to role numbers:" << e.what() << endl;
		return 5;
	}

	// do not try to summarize multi-client roles when not even client-roles are summarized (Bug in haplib?)
	if(!summarize_client_roles)
		summarize_multi_client_roles = false;

	// create the binary represantation of the summary-flags
	int sum = 1*summarize_client_roles + 2*summarize_multi_client_roles + 4*summarize_server_roles + 8*summarize_p2p_roles;
	CInterface::summarize_flags_t sum_flags = *((CInterface::summarize_flags_t*)(void*)(&sum));

	CInterface libif;
	bool ok = libif.get_graphlet(in_filename, outfilename, IP_str, sum_flags, (CInterface::filter_flags_t)0, role_num_set);

	if(!ok)
		return 6;

	return 0;
}
Esempio n. 19
0
void
SQLFREESTMT_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	IDL_char *stmtLabel = NULL;
	IDL_long  stmtLabelLength = 0;
	DIALOGUE_ID_def dialogueId = 0;
	IDL_unsigned_short freeResourceOpt = 0;

	IDL_char   *curptr = NULL;
	IDL_long   inputPosition = 0;

	curptr = pnode->r_buffer();

	// 1st Parameter: Dialogue Id
	dialogueId = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(dialogueId);

	// 2nd Param: Statement label
    stmtLabelLength = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(stmtLabelLength);

	if(stmtLabelLength > 0)
	{
        stmtLabel = curptr + inputPosition;
		inputPosition += stmtLabelLength;
	}

	// 3rd Parameter: Free resource options
    freeResourceOpt = *(IDL_unsigned_short*)(curptr+inputPosition);
	inputPosition += sizeof(freeResourceOpt);


	odbc_SQLSrvr_Close_ame_(
			objtag_
		  , call_id_
		  , dialogueId
		  , stmtLabel
		  , freeResourceOpt
	);

} /* SQLFREESTMT_IOMessage() */
CEE_status
odbc_SQLSrvr_Fetch_ts_res_(
    /* In    */       CEE_tag_def     objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */       IDL_long        returnCode
  , /* In    */       IDL_long        sqlWarningOrErrorLength
  , /* In    */       BYTE           *sqlWarningOrError
  , /* In    */       IDL_long        rowsReturned
  , /* In    */       IDL_long        outValuesFormat
  , /* In    */       IDL_long        outValuesLength
  , /* In    */       BYTE           *outValues
                          )
{
  SRVRTRACE_ENTER(FILE_OIOM+23);

  CInterface                   *pnode = (CInterface*)objtag_;
  CEE_status                    sts = CEE_SUCCESS;
  CEERCV_IOMessage_exc_         RCVexception_;
  IDL_short                     error;
  short                         reply_count;
  CEERCV_IOMessage_reply_seq_   reply;
  char                         *buffer = NULL;
  UInt32                        message_length = 0;

  odbc_SQLSrvr_Fetch_param_res_( pnode
			       , buffer
			       , message_length
			       , returnCode
			       , sqlWarningOrErrorLength
			       , sqlWarningOrError
			       , rowsReturned
			       , outValuesFormat
			       , outValuesLength
			       , outValues
                               );

  if (sts == CEE_SUCCESS)
    {
    sts = pnode->send_response(buffer, message_length, call_id_);
    }
  SRVRTRACE_EXIT(FILE_OIOM+11);
  return sts;

}  // end odbc_SQLSrvr_Fetch_ts_res_
Esempio n. 21
0
/*=================================================================
* Function ID :  SMT_EveryDayGetAllInitAssistantThread
* Input       :  void
* Output      :  void
* Author      :  
* Date        :  2009  8
* Return	  :  void
* Description :  主线程(定时获取黑名单)12小时
* Notice	  :  
*
*=================================================================*/
UINT SMT_EveryDayGetAllInitAssistantThread( LPVOID pParam )
{
	DWORD		nDStartTime=GetTickCount();
	int         FunId;
	int         updata1=0;
	int         updata2=0;
	time_t      rawtime;
	struct tm * timeinfo;
	try
	{        
		while( g_StartFlag )
		{   
			           
            time ( &rawtime );    
            timeinfo = localtime ( &rawtime ); 

      //执行设置黑名单更新时间1
		   if  ((timeinfo->tm_hour  == g_IniFilePara.DownBlacktime1) && (updata1!=timeinfo->tm_mday))
		   {
			   FunId=SMT_SMARTFRONTDOWNALLBLACK_EVERYDAY;
                 	g_CInterface.SMT_GetAllInitBlackList(FunId);					
					updata1=timeinfo->tm_mday;
		   }
        //执行设置黑名单更新时间2
		    if  ((timeinfo->tm_hour  == g_IniFilePara.DownBlacktime2) && (updata2!=timeinfo->tm_mday))
		    	{
					FunId=SMT_SMARTFRONTDOWNALLBLACK_EVERYDAY;
                 	g_CInterface.SMT_GetAllInitBlackList(FunId);					
					updata2=timeinfo->tm_mday;
				}
		}
	
	}
	catch(...)
	{
		((CSmartCommunicationDlg*)pParam)->WriteLog("调用金仕达接口时出现异常,前置自动停止运行!!");
		MessageBox(NULL,"调用金仕达接口时出现异常,前置自动停止运行!!","严重错误",MB_OK);
		((CSmartCommunicationDlg*)pParam)->OnButtonStop();
	}
	return 0;
}
CEE_status
odbc_SQLSrvr_GetSQLCatalogs_ts_res_(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ const struct odbc_SQLSvc_GetSQLCatalogs_exc_ *exception_
  , /* In    */ const IDL_char *catStmtLabel
  , /* In    */ SQLItemDescList_def *outputDesc
  , /* In    */ ERROR_DESC_LIST_def *sqlWarning
  , /* In    */ SRVR_STMT_HDL *pSrvrStmt
  )
{
	SRVRTRACE_ENTER(FILE_OIOM+14);
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;

	CEERCV_IOMessage_exc_ RCVexception_;
	IDL_short error;
	short reply_count;
	CEERCV_IOMessage_reply_seq_ reply;

	char* buffer = NULL;
	UInt32 message_length = 0;

	odbc_SQLSrvr_GetSQLCatalogs_param_res_(
			  pnode
			, buffer
			, message_length
			, exception_
			, catStmtLabel
			, outputDesc
			, sqlWarning
			, pSrvrStmt
	);
	if (sts == CEE_SUCCESS)
		sts = pnode->send_response(buffer, message_length, call_id_);
	SRVRTRACE_EXIT(FILE_OIOM+14);
	return sts;

} // odbc_SQLSrvr_GetSQLCatalogs_ts_res_()
CEE_status
odbc_SQLSrvr_ExtractLob_ts_res_(
    /* In   */ CEE_tag_def    objtag_
  , /* In   */ const CEE_handle_def *call_id_
  , /* In   */ const struct odbc_SQLsrvr_ExtractLob_exc_ *exception_
  , /* In   */ IDL_long_long  lobDataLen
  , /* In   */ BYTE       *lobDataValue
  )
{
    CInterface* pnode = (CInterface *)objtag_;

    CEE_status sts = CEE_SUCCESS;

    IDL_short error;
    CEERCV_IOMessage_reply_seq_ reply;

    char * buffer = NULL;
    UInt32 message_length = 0;

    sts = odbc_SQLsrvr_ExtractLob_param_res_(
              pnode
            , buffer
            , message_length
            , exception_
            , lobDataLen
            , lobDataValue
            );

    if (sts == CEE_SUCCESS)
        sts = pnode->send_response(buffer, message_length, call_id_);

    if (lobDataValue != NULL)
    {
        delete [] lobDataValue;
        lobDataValue = NULL;
    }
    return sts;
}
Esempio n. 24
0
/*=================================================================
* Function ID :  SMT_StartQueryTaskThread
* Input       :  void
* Output      :  void
* Author      :  
* Date        :  2006  2
* Return	  :  void
* Description :  主线程(定时获取任务)
* Notice	  :  
*
*=================================================================*/
UINT SMT_StartQueryTaskThread( LPVOID pParam )
{	
	try
	{
		g_CInterface.SMT_GetSysTask();
	}
	catch(...)
	{
		((CSmartCommunicationDlg*)pParam)->WriteLog("调用金仕达接口时出现异常,前置自动停止运行!!");
		MessageBox(NULL,"调用金仕达接口时出现异常,前置自动停止运行!!","严重错误",MB_OK);
		((CSmartCommunicationDlg*)pParam)->OnButtonStop();
	}
	return 0;
}
Esempio n. 25
0
void CPartie::Commencer (CInterface & Interface, player_info_t Joueur1Information, player_info_t Joueur2Information)
{
//MatRem 14/02/2003

	// Groove - 29/03/2003 - Inicialisation du plateau
	Interface.InitialiserPlateau (ReglesJeu.GetGrilleAdr ());
	
	//Initialisation du joueur 1

	//Joueur Humain
	if(Joueur1Information.Type==JOUEUR_HUMAIN)
		pJoueur1 = new CJoueurHumain (&Interface, Joueur1Information.szNom,JOUEUR_1);
	
	//Joueur Ia
	if(Joueur1Information.Type==JOUEUR_IA)
	{

		//On initialise le fichier à charger par rapport au niveau de l'ia
		char * s;
		switch(Joueur1Information.Niveau)
		{
		case	NIVEAU_IA_1:	s="ia1.dat"; break;
		case	NIVEAU_IA_2:	s="ia2.dat"; break;
		case	NIVEAU_IA_3:	s="ia3.dat"; break;
		case	NIVEAU_IA_4:	s="ia4.dat"; break;
		case	NIVEAU_IA_5:	s="ia5.dat"; break;
		default:				s="ia5.dat"; break;
		}

		//On crée le joueur1 dynamiquement
		pJoueur1 = new CJoueurIA(s,&Interface,JOUEUR_1);
	}

	
	//Initialisation du joueur 2
	
	//Joueur Humain
	if(Joueur2Information.Type==JOUEUR_HUMAIN)
		pJoueur2 = new CJoueurHumain(&Interface, Joueur2Information.szNom,JOUEUR_2);
	
	//Joueur Ia
	if(Joueur2Information.Type==JOUEUR_IA)
	{
		char * s;
		switch(Joueur2Information.Niveau)
		{
		case	NIVEAU_IA_1:	s="ia1.dat"; break;
		case	NIVEAU_IA_2:	s="ia2.dat"; break;
		case	NIVEAU_IA_3:	s="ia3.dat"; break;
		case	NIVEAU_IA_4:	s="ia4.dat"; break;
		case	NIVEAU_IA_5:	s="ia5.dat"; break;
		default:				s="ia1.dat"; break;
		}

		pJoueur2 = new CJoueurIA(s,&Interface,JOUEUR_2);
	}
	
	//Initialisation des scores
	pJoueur1->SetScore(2);
	pJoueur2->SetScore(2);
	
	//Initialisation des régles du jeu donc de la grille
	ReglesJeu.Initialiser();
	
	//initialisation du drapeau de fin de partie et du tour 
	bEstPartieFini=false;
	TourJoueur=TOUR_JOUEUR_1;
}
Esempio n. 26
0
bool CHttpProtocol::notifySelected(ISocket *sock,unsigned selected, IPersistentHandler* persistentHandler, bool shouldClose)
{
    try
    {
        char name[256];
        int port = sock->name(name, 255);

        CEspApplicationPort *apport = queryApplicationPort(port);

        if(apport == NULL)
            throw MakeStringException(-1, "binding not found!");
        
        if(apport != NULL)
        {
            Owned<ISocket> accepted;
            if (persistentHandler == nullptr)
                accepted.setown(sock->accept());
            else
                accepted.set(sock);
            if (accepted.get() != NULL)
            {
                char peername[256];
                int port = accepted->peer_name(peername, 256);

    #if defined(_DEBUG)
                DBGLOG("HTTP connection from %s:%d on %s socket", peername, port, persistentHandler?"persistent":"new");
    #endif          

                if(m_maxConcurrentThreads > 0)
                {
                    // Using Threading pool instead of generating one thread per request.
                    void ** holder = new void*[7];
                    holder[0] = (void*)(accepted.getLink());
                    holder[1] = (void*)apport;
                    int maxEntityLength = getMaxRequestEntityLength();
                    holder[2] = (void*)&maxEntityLength;
                    bool useSSL = false;
                    holder[3] = (void*)&useSSL;
                    ISecureSocketContext* ctx = NULL;
                    holder[4] = (void*)ctx;
                    holder[5] = (void*)persistentHandler;
                    holder[6] = (void*)&shouldClose;
                    try
                    {
                        http_thread_pool->start((void*)holder, "", m_threadCreateTimeout > 0?m_threadCreateTimeout*1000:0);
                    }
                    catch(...)
                    {
                        IERRLOG("Error starting thread from http thread pool.");
                        if(accepted.get())
                        {
                            accepted->close();
                            //Assumption here is that if start() throws exception, that means the new 
                            //thread hasn't been started, so there's no other thread holding a link.
                            CInterface* ci = dynamic_cast<CInterface*>(accepted.get());
                            if(ci && ci->IsShared())
                                accepted->Release();
                        }
                        delete [] holder;
                        throw;
                    }
                    delete [] holder;
                }
                else
                {
                    /* create one thread per request */
                    CHttpThread *workthread = new CHttpThread(accepted.getLink(), apport, CEspProtocol::getViewConfig(), false, nullptr, persistentHandler);
                    workthread->setMaxRequestEntityLength(getMaxRequestEntityLength());
                    workthread->setShouldClose(shouldClose);
                    workthread->start();
                    workthread->Release();
                }
            }
        }
        else
        {
            throw MakeStringException(-1, "can't acquire bindings IEspHttpBinding interface (via dynamic_cast)!");
        }
    }
    catch (IException *e) 
    {
        StringBuffer estr;
        IERRLOG("Exception(%d, %s) in CHttpProtocol::notifySelected()", e->errorCode(), e->errorMessage(estr).str());
        e->Release();
    }
    catch(...)
    {
        IERRLOG("Unknown Exception in CHttpProtocol::notifySelected()");
    }

    return false;
}
Esempio n. 27
0
void
SQLFETCH_IOMessage(
    /* In    */       CEE_tag_def     objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ IDL_short operation_id
                   )
{
  CInterface    *pnode = (CInterface*)objtag_;

  IDL_char		*curptr;

  DIALOGUE_ID_def dialogueId           = 0;
  IDL_long        sqlAsyncEnable       = 0;
  IDL_long        queryTimeout         = 0;
  Long 			stmtHandle           = 0;
  IDL_long 		stmtHandleKey           = 0;
  IDL_long        stmtLength           = 0;
  IDL_string      stmtLabel            = NULL;
  IDL_long        stmtLabelCharset     = 0;
  IDL_unsigned_long_long   maxRowCnt            = 0;
  IDL_unsigned_long_long   maxRowLen            = 0;
  IDL_long        cursorLength         = 0;
  IDL_string      cursorName           = NULL;
  IDL_long        cursorCharset        = 0;
  IDL_long        setStmtOptionsLength = 0;
  IDL_string      setStmtOptions       = NULL;


  IDL_long inputPosition = 0;

  curptr = pnode->r_buffer();

  dialogueId     = *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(dialogueId);

  sqlAsyncEnable = *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(sqlAsyncEnable);

  queryTimeout	 = *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(queryTimeout);

  stmtHandleKey	 = *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(IDL_long);
  stmtHandle = 0;
  if( stmtHandleKey > 0 )
  	stmtHandle = srvrGlobal->stmtHandleMap[stmtHandleKey];

  stmtLength	 = *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(stmtLength);
  if (stmtLength > 0)
  {
    stmtLabel     = curptr+inputPosition;
    inputPosition += stmtLength;
    stmtLabelCharset  = *(IDL_long*)(curptr+inputPosition);
    inputPosition += sizeof(stmtLabelCharset);
  }

  maxRowCnt	 = *(IDL_unsigned_long_long*)(curptr+inputPosition);
  inputPosition += sizeof(maxRowCnt);

  maxRowLen	 = *(IDL_unsigned_long_long*)(curptr+inputPosition);
  inputPosition += sizeof(maxRowLen);

  /* Unused for now */
  cursorLength	 = *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(cursorLength);
  if (cursorLength > 0)
  {
    cursorName     = curptr+inputPosition;
    inputPosition += cursorLength;
    cursorCharset  = *(IDL_long*)(curptr+inputPosition);
    inputPosition += sizeof(cursorCharset);
  }

  /* Unused for now */
  setStmtOptionsLength	= *(IDL_long*)(curptr+inputPosition);
  inputPosition += sizeof(setStmtOptionsLength);
  if (setStmtOptionsLength > 0)
  {
     setStmtOptions = curptr+inputPosition;
	 inputPosition += setStmtOptionsLength;
  }

  odbc_SQLSrvr_Fetch_ame_(
	  objtag_
	, call_id_
	, dialogueId
	, operation_id
	, sqlAsyncEnable
	, queryTimeout
	, stmtHandle
	, stmtLabel
	, maxRowCnt
	, maxRowLen);

} /* SQLFETCH_IOMessage() */
Esempio n. 28
0
void
SQLPREPARE_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	IDL_char   *curptr = NULL;

	DIALOGUE_ID_def dialogueId = 0;
	IDL_long      sqlAsyncEnable = 0;
	IDL_long      queryTimeout = 0;
	IDL_short     stmtType = 0;
	IDL_long      sqlStmtType = 0;
	IDL_long      stmtLength = 0;
	IDL_char      *stmtLabel = NULL;
	IDL_long      stmtLabelCharset = 0;
	IDL_long      cursorLength = 0;
	IDL_string    cursorName = NULL;
	IDL_long      cursorCharset = 0;
	IDL_long      moduleNameLength = 0;
	IDL_char      *moduleName = NULL;
	IDL_long      moduleCharset = 0;
	IDL_long_long moduleTimestamp = 0;
	IDL_long      sqlStringLength = 0;
	IDL_string    sqlString = NULL;
	IDL_long      sqlStringCharset = 0;
	IDL_long      setStmtOptionsLength = 0;
	IDL_string    setStmtOptions = NULL;
    IDL_long      stmtExplainLabelLength = 0;
	IDL_string    stmtExplainLabel = NULL;
	IDL_long      maxRowsetSize = 0;
	IDL_long	  transactionIDLength = 0; // JDBC is the only one that will use this to join a transaction
	IDL_long_long transactionID = 0;     // JDBC is the only one that will use this to join a transaction
	IDL_long      holdableCursor = SQL_NONHOLDABLE; // default
	IDL_short	  *extTransId = NULL;
	IDL_short	ix;
	IDL_char	*temp = NULL;
	bool		all_zero=true;

	IDL_long inputPosition = 0;

	curptr = pnode->r_buffer();

	dialogueId = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(dialogueId);

	// to support SAP holdable cursor, the driver overloads this field with the value of the holdable cursor
	// because currently sqlAsyncEnable is not used.
	//sqlAsyncEnable	= *(IDL_long*)(curptr+inputPosition);
	holdableCursor	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(sqlAsyncEnable);

	queryTimeout	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(queryTimeout);

	stmtType		= *(IDL_short*)(curptr+inputPosition);
	inputPosition += sizeof(stmtType);

	sqlStmtType		= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(sqlStmtType);

	stmtLength		= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(stmtLength);
	if (stmtLength > 0)
	{
		stmtLabel = curptr+inputPosition;
		inputPosition += stmtLength;
		stmtLabelCharset = *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(stmtLabelCharset);
	}

	cursorLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(cursorLength);
	if (cursorLength > 0)
	{
		cursorName = curptr+inputPosition;
		inputPosition += cursorLength;
		cursorCharset = *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(cursorCharset);
	}

	moduleNameLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(moduleNameLength);
	if (moduleNameLength > 0)
	{
		moduleName = curptr+inputPosition;
		inputPosition += moduleNameLength;
		moduleCharset = *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(moduleCharset);
		moduleTimestamp = *(IDL_long_long*)(curptr+inputPosition);
		inputPosition += sizeof(moduleTimestamp);
	}

	sqlStringLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(sqlStringLength);
	if (sqlStringLength > 0)
	{
		sqlString = curptr+inputPosition;
		inputPosition += sqlStringLength;
		sqlStringCharset	= *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(sqlStringCharset);
	}

	setStmtOptionsLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(setStmtOptionsLength);
	if (setStmtOptionsLength > 0)
	{
		setStmtOptions = curptr+inputPosition;
		inputPosition += setStmtOptionsLength;
	}

	stmtExplainLabelLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(stmtExplainLabelLength);
	if (stmtExplainLabelLength > 0)
	{
		stmtExplainLabel = curptr+inputPosition;
		inputPosition += stmtExplainLabelLength;
	}

	maxRowsetSize  = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(maxRowsetSize);

	transactionIDLength = *(IDL_unsigned_long*)(curptr+inputPosition);
	inputPosition += sizeof(transactionIDLength);

	if(transactionIDLength > 0)
	{
//LCOV_EXCL_START
		if (transactionIDLength == 17){
			extTransId = (IDL_short*)(curptr+inputPosition);
			temp = (IDL_char*)(curptr+inputPosition);
			inputPosition += transactionIDLength;
			// need to check the extTransId, if it contains all 0 (17 bytes), change the address to NULL
			// this will prevent TMF_JOIN_EXT_ to be called at the odbc_SQLSrvr_..._ame_
			for (ix=0; ix<transactionIDLength; ix++)
			{
				if (*temp != 0) {
					all_zero=false;
					break;
				}
				temp++;
			}
			if (all_zero)
				extTransId = NULL;
		}
		else{
                   if(transactionIDLength == 5)
			transactionID = *(IDL_long*)(curptr+inputPosition);
                   if(transactionIDLength == 9)
			transactionID = *(IDL_long_long*)(curptr+inputPosition);
		   inputPosition += transactionIDLength;
		}
//LCOV_EXCL_STOP
	}


	odbc_SQLSrvr_Prepare_ame_(
			  objtag_
			, call_id_
			, dialogueId
			, sqlAsyncEnable
			, queryTimeout
			, stmtType
			, sqlStmtType
			, stmtLength
			, stmtLabel
			, stmtLabelCharset
			, cursorLength
			, cursorName
			, cursorCharset
			, moduleNameLength
			, moduleName
			, moduleCharset
			, moduleTimestamp
			, sqlStringLength
			, sqlString
			, sqlStringCharset
			, setStmtOptionsLength
			, setStmtOptions
            , stmtExplainLabelLength
			, stmtExplainLabel
			, maxRowsetSize
			, transactionID
			, extTransId
			, holdableCursor
		  );
} /* SQLPREPARE_IOMessage() */
Esempio n. 29
0
void
SQLCONNECT_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  )
{

	CInterface* pnode = (CInterface*)objtag_;

	CEE_status sts = CEE_SUCCESS;
	CEE_status retcode;

	char *curptr;

	CONNECTION_CONTEXT_def inContext;
	USER_DESC_def userDesc;
	DIALOGUE_ID_def dialogueId;

	VERSION_def version[4];
	VERSION_def* versionPtr = &version[0];

	IDL_long inputPosition = 0;

	IDL_long		datasourceLength = 0;     // includes null terminator
	IDL_long		catalogLength = 0;        // includes null terminator
	IDL_long	 	schemaLength = 0;         // includes null terminator
	IDL_long		locationLength = 0;       // includes null terminator
	IDL_long		userRoleLength = 0;       // includes null terminator
	IDL_long		computerNameLength = 0;   // includes null terminator
	IDL_long		windowTextLength = 0;     // includes null terminator
	IDL_long        connectOptionsLength = 0; // includes null terminator
	IDL_long		sessionNameLength = 0;	  // includes null terminator
	IDL_long		clientUserNameLength = 0; // includes null terminator
	IDL_long		maxCopyLen;

	IDL_unsigned_long userSidLength;
	IDL_long domainNameLength;
	IDL_long userNameLength;
	IDL_long passwordLength;

	curptr = pnode->r_buffer();


	// Copy values

	// Copy 1st Parameter

	// copy userDesc Type
	userDesc.userDescType = *(IDL_long *)(curptr + inputPosition);
   /*
    *  TBD after finalizing security arch
	*/
//    userDesc.userDescType = AUTHENTICATED_USER_TYPE;
	inputPosition += sizeof(userDesc.userDescType);

	// copy userSidLength
	userDesc.userSid._length = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(userDesc.userSid._length);


	// copy userSid
	if (userDesc.userSid._length > 0)
	{
		userDesc.userSid._buffer = (IDL_octet *)(curptr + inputPosition);
		inputPosition += userDesc.userSid._length;
	}
	else
		userDesc.userSid._buffer = NULL;


	// copy domainNameLength
	domainNameLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(domainNameLength);
	if (domainNameLength > 0)
	{
		userDesc.domainName = (IDL_char *)(curptr + inputPosition);
		inputPosition += domainNameLength;
	}
	else
		userDesc.domainName = NULL;

	// copy userNameLength
	userNameLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(userNameLength);
	if (userNameLength > 0)
	{
		userDesc.userName = (IDL_char *)(curptr + inputPosition);
		inputPosition += userNameLength;
	}
	else
		userDesc.userName = NULL;

	// copy passwordLength
	passwordLength = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(passwordLength);
	if (passwordLength > 0)
	{
		userDesc.password._buffer = (IDL_octet *)(curptr + inputPosition);
		inputPosition += passwordLength;
		userDesc.password._length = passwordLength - 1; // The authentication functions expect the non-null terminated length
	}
	else
	{
		userDesc.password._buffer = NULL;
		userDesc.password._length = 0;
	}


	// Copy 2nd Parameter
	datasourceLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(datasourceLength);
	if (datasourceLength > 0)
	{
		maxCopyLen = _min(sizeof(inContext.datasource),datasourceLength);
		strncpy(inContext.datasource,(curptr+inputPosition),maxCopyLen);
		inContext.datasource[maxCopyLen-1] = '\0';
		inputPosition += datasourceLength;
	}
	else
		inContext.datasource[0] = '\0';

	catalogLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(catalogLength);
	if (catalogLength > 0)
	{
		maxCopyLen = _min(sizeof(inContext.catalog),catalogLength);
		strncpy(inContext.catalog,(curptr+inputPosition),maxCopyLen);
		inContext.catalog[maxCopyLen-1] = '\0';
		inputPosition += catalogLength;
	}
	else
		inContext.catalog[0] = '\0';

	schemaLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(schemaLength);
	if (schemaLength > 0)
	{
		maxCopyLen = _min(sizeof(inContext.schema),schemaLength);
		strncpy(inContext.schema, (curptr + inputPosition), maxCopyLen);
		inContext.schema[maxCopyLen-1] = '\0';
		inputPosition += schemaLength;
	}
	else
		inContext.schema[0] = '\0';

	locationLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(locationLength);
	if (locationLength > 0)
	{
		maxCopyLen = _min(sizeof(inContext.location),locationLength);
		strncpy(inContext.location,(curptr + inputPosition),maxCopyLen);
		inContext.location[maxCopyLen-1] = '\0';
		inputPosition += locationLength;
	}
	else
		inContext.location[0] = '\0';

	userRoleLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(userRoleLength);
	if (userRoleLength > 0)
	{
		maxCopyLen = _min(sizeof(inContext.userRole),userRoleLength);
		strncpy(inContext.userRole, (curptr + inputPosition), maxCopyLen);
		inContext.userRole[maxCopyLen-1] = '\0';
		inputPosition += userRoleLength;
	}
	else
		inContext.userRole[0] = '\0';

	// copy accessMode
	inContext.accessMode = *(IDL_short *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.accessMode);

	// copy autoCommit
	inContext.autoCommit = *(IDL_short *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.autoCommit);

	// copy queryTimeoutSec
	inContext.queryTimeoutSec = *(IDL_long *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.queryTimeoutSec);

	// copy idleTimeoutSec
	inContext.idleTimeoutSec = *(IDL_long *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.idleTimeoutSec);

	// copy loginTimeoutSec
	inContext.loginTimeoutSec = *(IDL_long *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.loginTimeoutSec);

	// copy txnIsolationLevel
	inContext.txnIsolationLevel = *(IDL_short *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.txnIsolationLevel);

	//copy rowSetSize
	inContext.rowSetSize = *(IDL_short *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.rowSetSize);

	// copy diagnosticFlag
	inContext.diagnosticFlag = *(IDL_short *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.diagnosticFlag);

	// copy processId
	inContext.processId = *(IDL_unsigned_long *)(curptr+inputPosition);
	inputPosition += sizeof(inContext.processId);

	// copy computerName
	computerNameLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(computerNameLength);
	if (computerNameLength > 0)
	{
		maxCopyLen = _min(sizeof(inContext.computerName),computerNameLength);
		strncpy(inContext.computerName, (curptr + inputPosition), maxCopyLen);
		inContext.computerName[maxCopyLen-1] = '\0';
		inputPosition += computerNameLength;
	}
	else
		inContext.computerName[0] = '\0';

	// copy windowTextLength
	windowTextLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(windowTextLength);
	if (windowTextLength > 0)
	{
		inContext.windowText = (IDL_char *)(curptr+inputPosition);
		inputPosition += windowTextLength;
	}
	else
		inContext.windowText = NULL;


	// copy ctxACP
	inContext.ctxACP = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.ctxACP);

	// copy ctxDataLang
	inContext.ctxDataLang = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.ctxDataLang);

	// copy ctxErrorLang
	inContext.ctxErrorLang = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.ctxErrorLang);

	// copy ctxCtrlInferNCHAR
	inContext.ctxCtrlInferNCHAR = *(IDL_short *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.ctxCtrlInferNCHAR);

	// copy cpuToUse
	inContext.cpuToUse = *(IDL_short *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.cpuToUse);

	// copy cpuToUseEnd
	inContext.cpuToUseEnd = *(IDL_short *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.cpuToUseEnd);


	// copy connectOptions
	connectOptionsLength = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(connectOptionsLength);
	if (connectOptionsLength > 0)
	{
		inContext.connectOptions = (IDL_char *)(curptr+inputPosition);
		inputPosition += connectOptionsLength;
	}
	else
		inContext.connectOptions = NULL;

	// copy versionList Length
	inContext.clientVersionList._length = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.clientVersionList._length);

	if(inContext.clientVersionList._length > 0)
	{

		sts = CEE_TMP_ALLOCATE(call_id_, sizeof(VERSION_def) * inContext.clientVersionList._length, (void **)&inContext.clientVersionList._buffer);

		if(sts != CEE_SUCCESS)
		{
//LCOV_EXCL_START
		   strcpy( errStrBuf2, "odbcs_srvr.cpp");
		   strcpy( errStrBuf3, "SQLCONNECT_IOMessage");
		   strcpy( errStrBuf4, "CEE_TMP_ALLOCATE");
		   sprintf( errStrBuf5, "Failed to get <%d> bytes", sizeof(VERSION_def) * inContext.clientVersionList._length);
		   logError( NO_MEMORY, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP );
//LCOV_EXCL_STOP
		}

		memset(inContext.clientVersionList._buffer, 0, inContext.clientVersionList._length*sizeof(VERSION_def));
		versionPtr = inContext.clientVersionList._buffer;

		for (int i=0; i < inContext.clientVersionList._length; i++)
		{
			// copy componentId
			versionPtr->componentId = *(IDL_short *)(curptr + inputPosition);
			inputPosition += sizeof(versionPtr->componentId);

			// copy majorVersion
			versionPtr->majorVersion = *(IDL_short *)(curptr + inputPosition);
			inputPosition += sizeof(versionPtr->majorVersion);

			// copy minorVersion
			versionPtr->minorVersion = *(IDL_short *)(curptr + inputPosition);
			inputPosition += sizeof(versionPtr->minorVersion);

			// copy buildId
			versionPtr->buildId = *(IDL_unsigned_long *)(curptr + inputPosition);
			inputPosition += sizeof(versionPtr->buildId);

			// Get the next versionlist values
			versionPtr++;

		}
	}

 	// Copy 3rd Parameter
	// copy dailogueId
	dialogueId = *(IDL_long *)(curptr + inputPosition);
	inputPosition += sizeof(dialogueId);

    inContext.inContextOptions1 = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.inContextOptions1);

    inContext.inContextOptions2 = *(IDL_unsigned_long *)(curptr + inputPosition);
	inputPosition += sizeof(inContext.inContextOptions2);


	inContext.sessionName[0] = '\0';
	if(inContext.inContextOptions1 & INCONTEXT_OPT1_SESSIONNAME)
	{
		sessionNameLength = *(IDL_long *)(curptr + inputPosition);
		inputPosition += sizeof(sessionNameLength);

		maxCopyLen = _min(sizeof(inContext.sessionName),sessionNameLength);
		if(maxCopyLen > 0)
		{
			strncpy(inContext.sessionName,(IDL_char *)(curptr+inputPosition),maxCopyLen);
			inContext.sessionName[maxCopyLen -1] = '\0';
			inputPosition += sessionNameLength;
		}

	}

	if(inContext.inContextOptions1 & INCONTEXT_OPT1_CLIENT_USERNAME)
	{
		clientUserNameLength = *(IDL_long *)(curptr + inputPosition);
		inputPosition += sizeof(clientUserNameLength);
		if (clientUserNameLength > 0)
		{
			inContext.clientUserName = (IDL_char *)(curptr + inputPosition);
			inputPosition += clientUserNameLength;
		}
		else
			inContext.clientUserName = NULL;

	}
	else
		inContext.clientUserName = NULL;

	odbc_SQLSvc_InitializeDialogue_ame_(
		  objtag_
		, call_id_
		, &userDesc
		, &inContext
		, dialogueId
	  );
}
Esempio n. 30
0
void
SQLEXECUTE_IOMessage(
    /* In    */ CEE_tag_def objtag_
  , /* In    */ const CEE_handle_def *call_id_
  , /* In    */ short operation_id
  )
{
	CInterface* pnode = (CInterface*)objtag_;

	CEE_status	sts = CEE_SUCCESS;
	CEE_status	retcode;
	IDL_char	*curptr;
	IDL_unsigned_long i;


	DIALOGUE_ID_def dialogueId = 0;
	IDL_long   sqlAsyncEnable = 0;
    IDL_long   queryTimeout = 0;
	IDL_long   inputRowCnt = 0;
	IDL_long   maxRowsetSize = 0;
	IDL_long   sqlStmtType = 0;
	Long   stmtHandle = 0;
	IDL_long   stmtHandleKey = 0;
	IDL_long   stmtType = 0;
	IDL_long   sqlStringLength = 0;
	IDL_string sqlString = NULL;
	IDL_long   sqlStringCharset = 0;
	IDL_long   cursorLength = 0;
	IDL_string cursorName = NULL;
	IDL_long   cursorCharset = 0;
	IDL_long   stmtLength = 0;
	IDL_char  *stmtLabel = NULL;
	IDL_long   stmtLabelCharset = 0;
    IDL_long   stmtExplainLabelLength = 0;
	IDL_string stmtExplainLabel = NULL;
	IDL_long   inValuesLength = 0;
	BYTE      *inValues = NULL;
	IDL_long	transactionIDLength = 0; // JDBC is the only one that will use this to join a transaction
	IDL_long_long transactionID = 0;     // JDBC is the only one that will use this to join a transaction


	IDL_long  holdableCursor = SQL_NONHOLDABLE; //default
	IDL_long inputPosition = 0;
	IDL_short ix;

	curptr = pnode->r_buffer();

	dialogueId = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(dialogueId);

	// to support SAP holdable cursor, the driver overload this field with the value of holdableCursor
	// currently the sqlAsyncEnable is not used.
	//sqlAsyncEnable	= *(IDL_long*)(curptr+inputPosition);
	holdableCursor	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(sqlAsyncEnable);

	queryTimeout	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(queryTimeout);

	inputRowCnt		= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(inputRowCnt);

	maxRowsetSize	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(maxRowsetSize);

	sqlStmtType		= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(sqlStmtType);

	stmtHandleKey	 = *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(IDL_long);
	stmtHandle = 0;
	if( stmtHandleKey > 0 )
		stmtHandle = srvrGlobal->stmtHandleMap[stmtHandleKey];

	stmtType		= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(stmtType);

	sqlStringLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(sqlStringLength);
	if (sqlStringLength > 0)
	{
		sqlString = curptr+inputPosition;
		inputPosition += sqlStringLength;
		sqlStringCharset	= *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(sqlStringCharset);
	}

	cursorLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(cursorLength);
	if (cursorLength > 0)
	{
		cursorName = curptr+inputPosition;
		inputPosition += cursorLength;
		cursorCharset = *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(cursorCharset);
	}

	stmtLength		= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(stmtLength);
	if (stmtLength > 0)
	{
		stmtLabel = curptr+inputPosition;
		inputPosition += stmtLength;
		stmtLabelCharset = *(IDL_long*)(curptr+inputPosition);
		inputPosition += sizeof(stmtLabelCharset);
	}

	stmtExplainLabelLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(stmtExplainLabelLength);
	if (stmtExplainLabelLength > 0)
	{
		stmtExplainLabel = curptr+inputPosition;
		inputPosition += stmtExplainLabelLength;
	}

	inValuesLength	= *(IDL_long*)(curptr+inputPosition);
	inputPosition += sizeof(inValuesLength);
	if (inValuesLength > 0)
	{
		inValues = (BYTE *) curptr+inputPosition;
		inputPosition += inValuesLength;
	}

	transactionIDLength = *(IDL_unsigned_long*)(curptr+inputPosition);
	inputPosition += sizeof(transactionIDLength);

	if(transactionIDLength > 0)
	{
//LCOV_EXCL_START
//LCOV_EXCL_STOP
                   if(transactionIDLength == 5)
		      transactionID = *(IDL_long*)(curptr+inputPosition);
                   if(transactionIDLength == 9)
		      transactionID = *(IDL_long_long*)(curptr+inputPosition);

		   inputPosition += transactionIDLength;

	}


   if( operation_id == SRVR_API_SQLEXECUTE2)
   {
	   odbc_SQLSrvr_Execute2_ame_(
         objtag_,
         call_id_,
         dialogueId,
         sqlAsyncEnable,
         queryTimeout,
         inputRowCnt,
         sqlStmtType,
         stmtHandle,
         cursorName,
         cursorCharset,
         inValuesLength,
         inValues,
		 0,        // Sql Query Type (used for execdirect calls)
		 0,        // output Descriptor Length (used for execdirect calls)
		 NULL,     // output Descriptor (used for execdirect calls)
		 maxRowsetSize, //For DBT to obtain the Rowlength from Driver
		 transactionID, // JDBC sends this to join an existing transaction for SPJ calls
		 holdableCursor
		 );
   } /* if operation_id == SRVR_API_SQLEXECUTE2 */
   else if( operation_id == SRVR_API_SQLEXECDIRECT)
   {

	   odbc_SQLSrvr_ExecDirect_ame_(
         objtag_,
         call_id_,
         dialogueId,
         stmtLabel,
         cursorName,
         stmtExplainLabel,
         stmtType,
         sqlStmtType,
         sqlString,
         sqlAsyncEnable,
         queryTimeout,
	 inputRowCnt,
	 	transactionID, // JDBC sends this to join an existing transaction for SPJ calls
		holdableCursor
	 );

   } /* if operation_id == SRVR_API_SQLEXECDIRECT */


} // SQLEXECUTE_IOMessage()