本文整理汇总了C++中CSocket::dbt5Send方法的典型用法代码示例。如果您正苦于以下问题:C++ CSocket::dbt5Send方法的具体用法?C++ CSocket::dbt5Send怎么用?C++ CSocket::dbt5Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocket
的用法示例。
在下文中一共展示了CSocket::dbt5Send方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: marketFeedDB
//.........这里部分代码省略.........
&(pMessage->TxnInput.TradeResultTxnInput), tradeResult);
break;
#endif
#ifdef TRADESTATUS
case TRADE_STATUS:
iRet = pThrParam->pBrokerageHouse->RunTradeStatus(
&(pMessage->TxnInput.TradeStatusTxnInput),
tradeStatus);
break;
#endif
#ifdef TRADEUPDATE
case TRADE_UPDATE:
iRet = pThrParam->pBrokerageHouse->RunTradeUpdate(
&(pMessage->TxnInput.TradeUpdateTxnInput), tradeUpdate);
break;
#endif
/*case DATA_MAINTENANCE:
iRet = pThrParam->pBrokerageHouse->RunDataMaintenance(
&(pMessage->TxnInput.DataMaintenanceTxnInput),
dataMaintenance);
break;
case TRADE_CLEANUP:
iRet = pThrParam->pBrokerageHouse->RunTradeCleanup(
&(pMessage->TxnInput.TradeCleanupTxnInput),
tradeCleanup);
break;*/
default:
//cout << "wrong txn type" << endl;
iRet = ERR_TYPE_WRONGTXN;
}
txn_cnt++;
pDBConnection->txn_cnt = txn_cnt;
if(txn_cnt==1)gettimeofday(&(t_start_values[pThrParam->t_id]), NULL);
} catch (const char *str) {
pDBConnection->rollback();
#ifdef CAL_RESP_TIME
// gettimeofday(&t2, NULL);
// exec_time = difftimeval(t2, t1);
// txn_time += exec_time;
//pDBConnection->append_profile_node(t1, t2, pMessage->TxnType, false);
// pDBConnection->outfile<<"error: "<<str<<endl;
//#ifdef PROFILE_EACH_QUERY
// pDBConnection->print_profile_query();
//#endif
// pDBConnection->outfile.flush();
#endif
//ostringstream msg;
//msg << time(NULL) << " " << (long long) pthread_self() << " " <<
// szTransactionName[pMessage->TxnType] << "; "<<str<<endl;
//pThrParam->pBrokerageHouse->logErrorMessage(msg.str());
iRet = CBaseTxnErr::EXPECTED_ROLLBACK;
//cout<<"query fail:"<<str<<endl;
commit = false;
abort_cnt++;
pDBConnection->abort_cnt = abort_cnt;
//XXX:debug for trade result
}
gettimeofday(&t2, NULL);
exec_time = difftimeval(t2, t1);
txn_time += exec_time;
pDBConnection->txn_time = txn_time;
#ifdef CAL_RESP_TIME
// pDBConnection->append_profile_node(t1, t2, pMessage->TxnType, true);
// pDBConnection->outfile<<commit<<" start=( "<<t1.tv_sec<<" "<<t1.tv_usec<<" ), end=( "<<t2.tv_sec<<" "<<t2.tv_usec<<" ), "<<exec_time<<", txn_cnt = "<<txn_cnt<<"total: "<<txn_time<<endl;
#ifdef PROFILE_EACH_QUERY
// pDBConnection->print_profile_query();
#endif
// pDBConnection->outfile.flush();
#endif
// send status to driver
Reply.iStatus = iRet;
try {
sockDrv.dbt5Send(reinterpret_cast<void *>(&Reply), sizeof(Reply));
} catch(CSocketErr *pErr) {
sockDrv.dbt5Disconnect();
ostringstream osErr;
osErr << "Error on Send: " << pErr->ErrorText() <<
" at BrokerageHouse::workerThread" << endl;
pThrParam->pBrokerageHouse->logErrorMessage(osErr.str());
delete pErr;
// The socket has been closed, break and let this thread die.
break;
}
} while (true);
// delete pDBConnection; // close connection with the database
close(pThrParam->iSockfd); // close socket connection with the driver
delete pThrParam;
delete pMessage;
} catch (CSocketErr *err) {
}
return NULL;
}
示例2: tpccDB
//.........这里部分代码省略.........
double receiving_time = 0;
do {
try {
sockDrv.dbt5Receive(reinterpret_cast<void *>(pMessage),
sizeof(TMsgDriverTPCC));
} catch(CSocketErr *pErr) {
sockDrv.dbt5Disconnect();
delete pErr;
// The socket has been closed, break and let this thread die.
break;
}
timeval t1, t2;
double exec_time;
gettimeofday(&t1, NULL);
commit = true;
iRet = CBaseTxnErr::SUCCESS;
try {
// Parse Txn type
switch (pMessage->TxnType) {
case NEWORDER:
iRet = pThrParam->pTPCC->RunNewOrder(&pMessage->TxnInput.neworderTxnInput, tpccDB);
break;
case PAYMENT:
iRet = pThrParam->pTPCC->RunPayment(&pMessage->TxnInput.paymentTxnInput, tpccDB);
break;
case DELIVERY:
iRet = pThrParam->pTPCC->RunDelivery(&pMessage->TxnInput.deliveryTxnInput, tpccDB);
break;
case STOCKLEVEL:
iRet = pThrParam->pTPCC->RunStocklevel(&pMessage->TxnInput.stocklevelTxnInput, tpccDB);
break;
case ORDERSTATUS:
iRet = pThrParam->pTPCC->RunOrderstatus(&pMessage->TxnInput.orderstatusTxnInput, tpccDB);
break;
default:
pDBConnection->outfile<<"Wrong txn type!"<<endl;
iRet = ERR_TYPE_WRONGTXN;
}
txn_cnt++;
pDBConnection->txn_cnt = txn_cnt;
}catch (const char *str) {
pDBConnection->rollback();
//#ifdef CAL_RESP_TIME
// gettimeofday(&t2, NULL);
// exec_time = difftimeval(t2, t1);
// txn_time += exec_time;
//#ifdef PROFILE_EACH_QUERY
// pDBConnection->print_profile_query();
//#endif
// pDBConnection->outfile.flush();
//#endif
//cout<<"error: "<<str<<endl;
iRet = CBaseTxnErr::EXPECTED_ROLLBACK;
commit = false;
abort_cnt++;
pDBConnection->abort_cnt = abort_cnt;
//XXX:debug for trade result
}
gettimeofday(&t2, NULL);
exec_time = difftimeval(t2, t1);
txn_time += exec_time;
pDBConnection->txn_time = txn_time;
#ifdef CAL_RESP_TIME
// pDBConnection->outfile<<commit<<" start=( "<<t1.tv_sec<<" "<<t1.tv_usec<<" ), end=( "<<t2.tv_sec<<" "<<t2.tv_usec<<" ), "<<exec_time<<", txn_cnt = "<<txn_cnt<<"total: "<<txn_time<<endl;
#ifdef PROFILE_EACH_QUERY
// pDBConnection->print_profile_query();
#endif
//pDBConnection->outfile<<"commit txn "<<txn_cnt<<endl;
// pDBConnection->outfile.flush();
#endif
// send status to driver
Reply.iStatus = iRet;
try {
sockDrv.dbt5Send(reinterpret_cast<void *>(&Reply), sizeof(Reply));
} catch(CSocketErr *pErr) {
sockDrv.dbt5Disconnect();
delete pErr;
// The socket has been closed, break and let this thread die.
break;
}
} while (true);
delete pDBConnection; // close connection with the database
close(pThrParam->iSockfd); // close socket connection with the driver
delete pThrParam;
delete pMessage;
} catch (CSocketErr *err) {
}
return NULL;
}