本文整理汇总了C++中NdbOperation::simpleRead方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbOperation::simpleRead方法的具体用法?C++ NdbOperation::simpleRead怎么用?C++ NdbOperation::simpleRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbOperation
的用法示例。
在下文中一共展示了NdbOperation::simpleRead方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memcpy
void
T3_Callback_2(int result, NdbConnection * pCON, void * threadData){
ThreadData * td = (ThreadData *)threadData;
CHECK_MINUS_ONE(result, "T3-2: NoCommit", pCON);
Uint32 permission = td->transactionData.permission;
Uint32 sessions = td->transactionData.sessions;
Uint32 server_bit = td->transactionData.server_bit;
if(((permission & server_bit) == server_bit) &&
((sessions & server_bit) == server_bit)){
memcpy(td->transactionData.suffix,
&td->transactionData.number
[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH],
SUBSCRIBER_NUMBER_SUFFIX_LENGTH);
DEBUG5("T3(%.*s, %.2d): - Callback 2 - reading(%.*s)\n",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number,
td->transactionData.server_id,
SUBSCRIBER_NUMBER_SUFFIX_LENGTH,
td->transactionData.suffix);
/* Operation 3 */
NdbOperation * MyOp = pCON->getNdbOperation(SESSION_TABLE);
CHECK_NULL(MyOp, "T3-3: getNdbOperation",
pCON);
MyOp->simpleRead();
MyOp->equal(IND_SESSION_SUBSCRIBER,
(char*)td->transactionData.number);
MyOp->equal(IND_SESSION_SERVER,
(char*)&td->transactionData.server_id);
MyOp->getValue(IND_SESSION_DATA,
(char *)td->transactionData.session_details);
/* Operation 4 */
MyOp = pCON->getNdbOperation(SERVER_TABLE);
CHECK_NULL(MyOp, "T3-4: getNdbOperation",
pCON);
MyOp->interpretedUpdateTuple();
MyOp->equal(IND_SERVER_ID,
(char*)&td->transactionData.server_id);
MyOp->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
(char*)td->transactionData.suffix);
MyOp->incValue(IND_SERVER_READS, (uint32)1);
td->transactionData.branchExecuted = 1;
} else {
DEBUG3("T3(%.*s, %.2d): - Callback 2 - no read\n",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number,
td->transactionData.server_id);
td->transactionData.branchExecuted = 0;
}
pCON->executeAsynchPrepare( Commit, T3_Callback_3, td );
}
示例2: memcpy
void
T3_Callback_2(int result, NdbConnection * pCON, void * threadData){
ThreadData * td = (ThreadData *)threadData;
if (result == -1) {
CHECK_ALLOWED_ERROR("T3-2: execute", td, pCON->getNdbError());
td->pNDB->closeTransaction(pCON);
start_T3(td->pNDB, td, stat_async);
return;
}//if
Uint32 permission = td->transactionData.permission;
Uint32 sessions = td->transactionData.sessions;
Uint32 server_bit = td->transactionData.server_bit;
if(((permission & server_bit) == server_bit) &&
((sessions & server_bit) == server_bit)){
memcpy(td->transactionData.suffix,
&td->transactionData.number[SFX_START],
SUBSCRIBER_NUMBER_SUFFIX_LENGTH);
DEBUG5("T3(%.*s, %.2d): - Callback 2 - reading(%.*s)",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number,
td->transactionData.server_id,
SUBSCRIBER_NUMBER_SUFFIX_LENGTH,
td->transactionData.suffix);
/* Operation 3 */
NdbOperation * MyOp = pCON->getNdbOperation(SESSION_TABLE);
CHECK_NULL(MyOp, "T3-3: getNdbOperation", td,
pCON->getNdbError());
MyOp->simpleRead();
MyOp->equal(IND_SESSION_SUBSCRIBER,
(char*)td->transactionData.number);
MyOp->equal(IND_SESSION_SERVER,
(char*)&td->transactionData.server_id);
MyOp->getValue(IND_SESSION_DATA,
(char *)td->transactionData.session_details);
/* Operation 4 */
MyOp = pCON->getNdbOperation(SERVER_TABLE);
CHECK_NULL(MyOp, "T3-4: getNdbOperation", td,
pCON->getNdbError());
MyOp->interpretedUpdateTuple();
MyOp->equal(IND_SERVER_ID,
(char*)&td->transactionData.server_id);
MyOp->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
(char*)td->transactionData.suffix);
MyOp->incValue(IND_SERVER_READS, (uint32)1);
td->transactionData.branchExecuted = 1;
} else {
DEBUG3("T3(%.*s, %.2d): - Callback 2 - no read",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number,
td->transactionData.server_id);
td->transactionData.branchExecuted = 0;
}
if (stat_async == 1) {
pCON->executeAsynchPrepare( Commit , T3_Callback_3, td);
} else {
int result = pCON->execute( Commit );
T3_Callback_3(result, pCON, (void*)td);
return;
}//if
}
示例3: memcpy
void
T3_Callback_2(int result, NdbConnection * pCON, void * threadData) {
ThreadData * td = (ThreadData *)threadData;
if (result == -1) {
CHECK_ALLOWED_ERROR("T3-2: execute", td, pCON->getNdbError());
td->pNDB->closeTransaction(pCON);
start_T3(td->pNDB, td, stat_async);
return;
}//if
Uint32 permission = td->transactionData.permission;
Uint32 sessions = td->transactionData.sessions;
Uint32 server_bit = td->transactionData.server_bit;
if(((permission & server_bit) == server_bit) &&
((sessions & server_bit) == server_bit)) {
memcpy(td->transactionData.suffix,
&td->transactionData.number[SFX_START],
SUBSCRIBER_NUMBER_SUFFIX_LENGTH);
DEBUG5("T3(%.*s, %.2d): - Callback 2 - reading(%.*s)",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number,
td->transactionData.server_id,
SUBSCRIBER_NUMBER_SUFFIX_LENGTH,
td->transactionData.suffix);
/* Operations 3 + 4 */
if (td->ndbRecordSharedData)
{
/* Op 3 */
char* rowPtr= (char*) &td->transactionData;
const NdbRecord* record= td->ndbRecordSharedData->
sessionTableNdbRecord;
Uint32 m=0;
unsigned char* mask= (unsigned char*) &m;
SET_MASK(mask, IND_SESSION_DATA);
const NdbOperation* MyOp = pCON->readTuple(record, rowPtr, record, rowPtr,
NdbOperation::LM_SimpleRead,
mask);
CHECK_NULL((void*) MyOp, "T3-3: readTuple", td,
pCON->getNdbError());
/* Op 4 */
record= td->ndbRecordSharedData->
serverTableNdbRecord;
m= 0;
/* Attach interpreted program */
NdbOperation::OperationOptions opts;
opts.optionsPresent= NdbOperation::OperationOptions::OO_INTERPRETED;
opts.interpretedCode= td->ndbRecordSharedData->incrServerReadsProg;
MyOp= pCON->updateTuple(record, rowPtr, record, rowPtr, mask,
&opts,
sizeof(opts));
CHECK_NULL((void*) MyOp, "T3-3: updateTuple", td,
pCON->getNdbError());
}
else
{
NdbOperation * MyOp = pCON->getNdbOperation(SESSION_TABLE);
CHECK_NULL(MyOp, "T3-3: getNdbOperation", td,
pCON->getNdbError());
MyOp->simpleRead();
MyOp->equal(IND_SESSION_SUBSCRIBER,
(char*)td->transactionData.number);
MyOp->equal(IND_SESSION_SERVER,
(char*)&td->transactionData.server_id);
MyOp->getValue(IND_SESSION_DATA,
(char *)td->transactionData.session_details);
MyOp = pCON->getNdbOperation(SERVER_TABLE);
CHECK_NULL(MyOp, "T3-4: getNdbOperation", td,
pCON->getNdbError());
MyOp->interpretedUpdateTuple();
MyOp->equal(IND_SERVER_ID,
(char*)&td->transactionData.server_id);
MyOp->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
(char*)td->transactionData.suffix);
MyOp->incValue(IND_SERVER_READS, (uint32)1);
}
td->transactionData.branchExecuted = 1;
} else {
DEBUG3("T3(%.*s, %.2d): - Callback 2 - no read",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number,
td->transactionData.server_id);
td->transactionData.branchExecuted = 0;
}
if (stat_async == 1) {
pCON->executeAsynchPrepare( Commit , T3_Callback_3, td);
} else {
int result = pCON->execute( Commit );
//.........这里部分代码省略.........