MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_user_transaction4.cpp
1 /*
2  Copyright (C) 2003-2006 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 //#define DEBUG_ON
20 
21 extern "C" {
22 #include "user_transaction.h"
23 };
24 
25 #include "macros.h"
26 #include "ndb_schema.hpp"
27 #include "ndb_error.hpp"
28 
29 #include <time.h>
30 #include <NdbApi.hpp>
31 
45 int
46 T1(void * obj,
47  const SubscriberNumber number,
48  const Location new_location,
49  const ChangedBy changed_by,
50  const ChangedTime changed_time,
51  BenchmarkTime * transaction_time){
52 
53  Ndb * pNDB = (Ndb *) obj;
54 
55  DEBUG2("T1(%.*s):\n", SUBSCRIBER_NUMBER_LENGTH, number);
56 
57  BenchmarkTime start;
58  get_time(&start);
59 
60  int check;
61  NdbRecAttr * check2;
62 
63  NdbConnection * MyTransaction = pNDB->startTransaction();
64  if (MyTransaction == NULL)
65  error_handler("T1-1: startTranscation", pNDB->getNdbErrorString(), 0);
66 
67  NdbOperation *MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
68  CHECK_NULL(MyOperation, "T1: getNdbOperation", MyTransaction);
69 
70  check = MyOperation->updateTuple();
71  CHECK_MINUS_ONE(check, "T1: updateTuple",
72  MyTransaction);
73 
74  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
75  number);
76  CHECK_MINUS_ONE(check, "T1: equal subscriber",
77  MyTransaction);
78 
79  check = MyOperation->setValue(IND_SUBSCRIBER_LOCATION,
80  (char *)&new_location);
81  CHECK_MINUS_ONE(check, "T1: setValue location",
82  MyTransaction);
83 
84  check = MyOperation->setValue(IND_SUBSCRIBER_CHANGED_BY,
85  changed_by);
86  CHECK_MINUS_ONE(check, "T1: setValue changed_by",
87  MyTransaction);
88 
89  check = MyOperation->setValue(IND_SUBSCRIBER_CHANGED_TIME,
90  changed_time);
91  CHECK_MINUS_ONE(check, "T1: setValue changed_time",
92  MyTransaction);
93 
94  check = MyTransaction->execute( Commit );
95  CHECK_MINUS_ONE(check, "T1: Commit",
96  MyTransaction);
97 
98  pNDB->closeTransaction(MyTransaction);
99 
100  get_time(transaction_time);
101  time_diff(transaction_time, &start);
102  return 0;
103 }
104 
119 int
120 T2(void * obj,
121  const SubscriberNumber number,
122  Location * readLocation,
123  ChangedBy changed_by,
124  ChangedTime changed_time,
125  SubscriberName subscriberName,
126  BenchmarkTime * transaction_time){
127 
128  Ndb * pNDB = (Ndb *) obj;
129 
130  DEBUG2("T2(%.*s):\n", SUBSCRIBER_NUMBER_LENGTH, number);
131 
132  BenchmarkTime start;
133  get_time(&start);
134 
135  int check;
136  NdbRecAttr * check2;
137 
138  NdbConnection * MyTransaction = pNDB->startTransaction();
139  if (MyTransaction == NULL)
140  error_handler("T2-1: startTranscation", pNDB->getNdbErrorString(), 0);
141 
142  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
143  CHECK_NULL(MyOperation, "T2: getNdbOperation",
144  MyTransaction);
145 
146 
147  check = MyOperation->readTuple();
148  CHECK_MINUS_ONE(check, "T2: readTuple",
149  MyTransaction);
150 
151  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
152  number);
153  CHECK_MINUS_ONE(check, "T2: equal subscriber",
154  MyTransaction);
155 
156  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
157  (char *)readLocation);
158  CHECK_NULL(check2, "T2: getValue location",
159  MyTransaction);
160 
161  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
162  changed_by);
163  CHECK_NULL(check2, "T2: getValue changed_by",
164  MyTransaction);
165 
166  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
167  changed_time);
168  CHECK_NULL(check2, "T2: getValue changed_time",
169  MyTransaction);
170 
171  check2 = MyOperation->getValue(IND_SUBSCRIBER_NAME,
172  subscriberName);
173  CHECK_NULL(check2, "T2: getValue name",
174  MyTransaction);
175 
176  check = MyTransaction->execute( Commit );
177  CHECK_MINUS_ONE(check, "T2: Commit",
178  MyTransaction);
179 
180  pNDB->closeTransaction(MyTransaction);
181 
182  get_time(transaction_time);
183  time_diff(transaction_time, &start);
184  return 0;
185 }
186 
204 int
205 T3(void * obj,
206  const SubscriberNumber inNumber,
207  const SubscriberSuffix inSuffix,
208  const ServerId inServerId,
209  const ServerBit inServerBit,
210  SessionDetails outSessionDetails,
211  ChangedBy outChangedBy,
212  ChangedTime outChangedTime,
213  Location * outLocation,
214  BranchExecuted * outBranchExecuted,
215  BenchmarkTime * outTransactionTime){
216 
217  DEBUG3("T3(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
218 
219  Ndb * pNDB = (Ndb *) obj;
220 
221  GroupId groupId;
222  ActiveSessions sessions;
223  Permission permission;
224 
225  BenchmarkTime start;
226  get_time(&start);
227 
228  int check;
229  NdbRecAttr * check2;
230 
231  NdbConnection * MyTransaction = pNDB->startTransaction();
232  if (MyTransaction == NULL)
233  error_handler("T3-1: startTranscation", pNDB->getNdbErrorString(), 0);
234 
235  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
236  CHECK_NULL(MyOperation, "T3-1: getNdbOperation",
237  MyTransaction);
238 
239  check = MyOperation->readTuple();
240  CHECK_MINUS_ONE(check, "T3-1: readTuple",
241  MyTransaction);
242 
243  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
244  inNumber);
245  CHECK_MINUS_ONE(check, "T3-1: equal subscriber",
246  MyTransaction);
247 
248  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
249  (char *)outLocation);
250  CHECK_NULL(check2, "T3-1: getValue location",
251  MyTransaction);
252 
253  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
254  outChangedBy);
255  CHECK_NULL(check2, "T3-1: getValue changed_by",
256  MyTransaction);
257 
258  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
259  outChangedTime);
260  CHECK_NULL(check2, "T3-1: getValue changed_time",
261  MyTransaction);
262 
263  check2 = MyOperation->getValue(IND_SUBSCRIBER_GROUP,
264  (char *)&groupId);
265  CHECK_NULL(check2, "T3-1: getValue group",
266  MyTransaction);
267 
268  check2 = MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
269  (char *)&sessions);
270  CHECK_NULL(check2, "T3-1: getValue sessions",
271  MyTransaction);
272 
273  check = MyTransaction->execute( NoCommit );
274  CHECK_MINUS_ONE(check, "T3-1: NoCommit",
275  MyTransaction);
276 
277  /* Operation 2 */
278 
279  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
280  CHECK_NULL(MyOperation, "T3-2: getNdbOperation",
281  MyTransaction);
282 
283 
284  check = MyOperation->readTuple();
285  CHECK_MINUS_ONE(check, "T3-2: readTuple",
286  MyTransaction);
287 
288  check = MyOperation->equal(IND_GROUP_ID,
289  (char*)&groupId);
290  CHECK_MINUS_ONE(check, "T3-2: equal group",
291  MyTransaction);
292 
293  check2 = MyOperation->getValue(IND_GROUP_ALLOW_READ,
294  (char *)&permission);
295  CHECK_NULL(check2, "T3-2: getValue allow_read",
296  MyTransaction);
297 
298  check = MyTransaction->execute( NoCommit );
299  CHECK_MINUS_ONE(check, "T3-2: NoCommit",
300  MyTransaction);
301 
302  if(((permission & inServerBit) == inServerBit) &&
303  ((sessions & inServerBit) == inServerBit)){
304 
305  DEBUG("reading - ");
306 
307  /* Operation 3 */
308 
309  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
310  CHECK_NULL(MyOperation, "T3-3: getNdbOperation",
311  MyTransaction);
312 
313  check = MyOperation->readTuple();
314  CHECK_MINUS_ONE(check, "T3-3: readTuple",
315  MyTransaction);
316 
317  check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
318  (char*)inNumber);
319  CHECK_MINUS_ONE(check, "T3-3: equal number",
320  MyTransaction);
321 
322  check = MyOperation->equal(IND_SESSION_SERVER,
323  (char*)&inServerId);
324  CHECK_MINUS_ONE(check, "T3-3: equal server id",
325  MyTransaction);
326 
327  check2 = MyOperation->getValue(IND_SESSION_DATA,
328  (char *)outSessionDetails);
329  CHECK_NULL(check2, "T3-3: getValue session details",
330  MyTransaction);
331 
332  /* Operation 4 */
333  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
334  CHECK_NULL(MyOperation, "T3-4: getNdbOperation",
335  MyTransaction);
336 
337  check = MyOperation->interpretedUpdateTuple();
338  CHECK_MINUS_ONE(check, "T3-4: interpretedUpdateTuple",
339  MyTransaction);
340 
341  check = MyOperation->equal(IND_SERVER_ID,
342  (char*)&inServerId);
343  CHECK_MINUS_ONE(check, "T3-4: equal serverId",
344  MyTransaction);
345 
346  check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
347  (char*)inSuffix);
348  CHECK_MINUS_ONE(check, "T3-4: equal suffix",
349  MyTransaction);
350 
351  check = MyOperation->incValue(IND_SERVER_READS, (uint32)1);
352  CHECK_MINUS_ONE(check, "T3-4: inc value",
353  MyTransaction);
354  (* outBranchExecuted) = 1;
355  } else {
356  (* outBranchExecuted) = 0;
357  }
358  DEBUG("commit...");
359  check = MyTransaction->execute( Commit );
360  CHECK_MINUS_ONE(check, "T3: Commit",
361  MyTransaction);
362 
363  pNDB->closeTransaction(MyTransaction);
364 
365  DEBUG("done\n");
366  get_time(outTransactionTime);
367  time_diff(outTransactionTime, &start);
368  return 0;
369 }
370 
371 
389 int
390 T4(void * obj,
391  const SubscriberNumber inNumber,
392  const SubscriberSuffix inSuffix,
393  const ServerId inServerId,
394  const ServerBit inServerBit,
395  const SessionDetails inSessionDetails,
396  ChangedBy outChangedBy,
397  ChangedTime outChangedTime,
398  Location * outLocation,
399  DoRollback inDoRollback,
400  BranchExecuted * outBranchExecuted,
401  BenchmarkTime * outTransactionTime){
402 
403  DEBUG3("T4(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
404 
405  Ndb * pNDB = (Ndb *) obj;
406 
407  GroupId groupId;
408  ActiveSessions sessions;
409  Permission permission;
410 
411  BenchmarkTime start;
412  get_time(&start);
413 
414  int check;
415  NdbRecAttr * check2;
416 
417  NdbConnection * MyTransaction = pNDB->startTransaction();
418  if (MyTransaction == NULL)
419  error_handler("T4-1: startTranscation", pNDB->getNdbErrorString(), 0);
420 
421  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
422  CHECK_NULL(MyOperation, "T4-1: getNdbOperation",
423  MyTransaction);
424 
425  check = MyOperation->interpretedUpdateTuple();
426  CHECK_MINUS_ONE(check, "T4-1: readTuple",
427  MyTransaction);
428 
429  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
430  inNumber);
431  CHECK_MINUS_ONE(check, "T4-1: equal subscriber",
432  MyTransaction);
433 
434  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
435  (char *)outLocation);
436  CHECK_NULL(check2, "T4-1: getValue location",
437  MyTransaction);
438 
439  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
440  outChangedBy);
441  CHECK_NULL(check2, "T4-1: getValue changed_by",
442  MyTransaction);
443 
444  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
445  outChangedTime);
446  CHECK_NULL(check2, "T4-1: getValue changed_time",
447  MyTransaction);
448 
449  check2 = MyOperation->getValue(IND_SUBSCRIBER_GROUP,
450  (char *)&groupId);
451  CHECK_NULL(check2, "T4-1: getValue group",
452  MyTransaction);
453 
454  check2 = MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
455  (char *)&sessions);
456  CHECK_NULL(check2, "T4-1: getValue sessions",
457  MyTransaction);
458 
459  check = MyOperation->incValue(IND_SUBSCRIBER_SESSIONS,
460  (uint32)inServerBit);
461  CHECK_MINUS_ONE(check, "T4-4: inc value",
462  MyTransaction);
463 
464  check = MyTransaction->execute( NoCommit );
465  CHECK_MINUS_ONE(check, "T4-1: NoCommit",
466  MyTransaction);
467 
468  /* Operation 2 */
469 
470  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
471  CHECK_NULL(MyOperation, "T4-2: getNdbOperation",
472  MyTransaction);
473 
474  check = MyOperation->readTuple();
475  CHECK_MINUS_ONE(check, "T4-2: readTuple",
476  MyTransaction);
477 
478  check = MyOperation->equal(IND_GROUP_ID,
479  (char*)&groupId);
480  CHECK_MINUS_ONE(check, "T4-2: equal group",
481  MyTransaction);
482 
483  check2 = MyOperation->getValue(IND_GROUP_ALLOW_INSERT,
484  (char *)&permission);
485  CHECK_NULL(check2, "T4-2: getValue allow_insert",
486  MyTransaction);
487 
488  check = MyTransaction->execute( NoCommit );
489  CHECK_MINUS_ONE(check, "T4-2: NoCommit",
490  MyTransaction);
491 
492  if(((permission & inServerBit) == inServerBit) &&
493  ((sessions & inServerBit) == 0)){
494 
495  DEBUG("inserting - ");
496 
497  /* Operation 3 */
498 
499  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
500  CHECK_NULL(MyOperation, "T4-3: getNdbOperation",
501  MyTransaction);
502 
503  check = MyOperation->insertTuple();
504  CHECK_MINUS_ONE(check, "T4-3: insertTuple",
505  MyTransaction);
506 
507  check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
508  (char*)inNumber);
509  CHECK_MINUS_ONE(check, "T4-3: equal number",
510  MyTransaction);
511 
512  check = MyOperation->equal(IND_SESSION_SERVER,
513  (char*)&inServerId);
514  CHECK_MINUS_ONE(check, "T4-3: equal server id",
515  MyTransaction);
516 
517  check = MyOperation->setValue(SESSION_DATA,
518  (char *)inSessionDetails);
519  CHECK_MINUS_ONE(check, "T4-3: setValue session details",
520  MyTransaction);
521 
522  /* Operation 4 */
523 
524  /* Operation 5 */
525  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
526  CHECK_NULL(MyOperation, "T4-5: getNdbOperation",
527  MyTransaction);
528 
529  check = MyOperation->interpretedUpdateTuple();
530  CHECK_MINUS_ONE(check, "T4-5: interpretedUpdateTuple",
531  MyTransaction);
532 
533  check = MyOperation->equal(IND_SERVER_ID,
534  (char*)&inServerId);
535  CHECK_MINUS_ONE(check, "T4-5: equal serverId",
536  MyTransaction);
537 
538  check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
539  (char*)inSuffix);
540  CHECK_MINUS_ONE(check, "T4-5: equal suffix",
541  MyTransaction);
542 
543  check = MyOperation->incValue(IND_SERVER_INSERTS, (uint32)1);
544  CHECK_MINUS_ONE(check, "T4-5: inc value",
545  MyTransaction);
546 
547  (* outBranchExecuted) = 1;
548  } else {
549  DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
550  DEBUG1("%s", ((sessions & inServerBit) ? "in session - " : "no in session - "));
551  (* outBranchExecuted) = 0;
552  }
553 
554  if(!inDoRollback && (* outBranchExecuted)){
555  DEBUG("commit\n");
556  check = MyTransaction->execute( Commit );
557  CHECK_MINUS_ONE(check, "T4: Commit",
558  MyTransaction);
559  } else {
560  DEBUG("rollback\n");
561  check = MyTransaction->execute(Rollback);
562  CHECK_MINUS_ONE(check, "T4:Rollback",
563  MyTransaction);
564 
565  }
566 
567  pNDB->closeTransaction(MyTransaction);
568 
569  get_time(outTransactionTime);
570  time_diff(outTransactionTime, &start);
571  return 0;
572 }
573 
574 
591 int
592 T5(void * obj,
593  const SubscriberNumber inNumber,
594  const SubscriberSuffix inSuffix,
595  const ServerId inServerId,
596  const ServerBit inServerBit,
597  ChangedBy outChangedBy,
598  ChangedTime outChangedTime,
599  Location * outLocation,
600  DoRollback inDoRollback,
601  BranchExecuted * outBranchExecuted,
602  BenchmarkTime * outTransactionTime){
603 
604  DEBUG3("T5(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
605 
606  Ndb * pNDB = (Ndb *) obj;
607  NdbConnection * MyTransaction = 0;
608  NdbOperation * MyOperation = 0;
609 
610  GroupId groupId;
611  ActiveSessions sessions;
612  Permission permission;
613 
614  BenchmarkTime start;
615  get_time(&start);
616 
617  int check;
618  NdbRecAttr * check2;
619 
620  MyTransaction = pNDB->startTransaction();
621  if (MyTransaction == NULL)
622  error_handler("T5-1: startTranscation", pNDB->getNdbErrorString(), 0);
623 
624  MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
625  CHECK_NULL(MyOperation, "T5-1: getNdbOperation",
626  MyTransaction);
627 
628  check = MyOperation->interpretedUpdateTuple();
629  CHECK_MINUS_ONE(check, "T5-1: readTuple",
630  MyTransaction);
631 
632  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
633  inNumber);
634  CHECK_MINUS_ONE(check, "T5-1: equal subscriber",
635  MyTransaction);
636 
637  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
638  (char *)outLocation);
639  CHECK_NULL(check2, "T5-1: getValue location",
640  MyTransaction);
641 
642  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
643  outChangedBy);
644  CHECK_NULL(check2, "T5-1: getValue changed_by",
645  MyTransaction);
646 
647  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
648  outChangedTime);
649  CHECK_NULL(check2, "T5-1: getValue changed_time",
650  MyTransaction);
651 
652  check2 = MyOperation->getValue(IND_SUBSCRIBER_GROUP,
653  (char *)&groupId);
654  CHECK_NULL(check2, "T5-1: getValue group",
655  MyTransaction);
656 
657  check2 = MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
658  (char *)&sessions);
659  CHECK_NULL(check2, "T5-1: getValue sessions",
660  MyTransaction);
661 
662  check = MyOperation->subValue(IND_SUBSCRIBER_SESSIONS,
663  (uint32)inServerBit);
664  CHECK_MINUS_ONE(check, "T5-4: dec value",
665  MyTransaction);
666 
667  check = MyTransaction->execute( NoCommit );
668  CHECK_MINUS_ONE(check, "T5-1: NoCommit",
669  MyTransaction);
670 
671  /* Operation 2 */
672 
673  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
674  CHECK_NULL(MyOperation, "T5-2: getNdbOperation",
675  MyTransaction);
676 
677 
678  check = MyOperation->readTuple();
679  CHECK_MINUS_ONE(check, "T5-2: readTuple",
680  MyTransaction);
681 
682  check = MyOperation->equal(IND_GROUP_ID,
683  (char*)&groupId);
684  CHECK_MINUS_ONE(check, "T5-2: equal group",
685  MyTransaction);
686 
687  check2 = MyOperation->getValue(IND_GROUP_ALLOW_DELETE,
688  (char *)&permission);
689  CHECK_NULL(check2, "T5-2: getValue allow_delete",
690  MyTransaction);
691 
692  check = MyTransaction->execute( NoCommit );
693  CHECK_MINUS_ONE(check, "T5-2: NoCommit",
694  MyTransaction);
695 
696  if(((permission & inServerBit) == inServerBit) &&
697  ((sessions & inServerBit) == inServerBit)){
698 
699  DEBUG("deleting - ");
700 
701  /* Operation 3 */
702  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
703  CHECK_NULL(MyOperation, "T5-3: getNdbOperation",
704  MyTransaction);
705 
706  check = MyOperation->deleteTuple();
707  CHECK_MINUS_ONE(check, "T5-3: deleteTuple",
708  MyTransaction);
709 
710  check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
711  (char*)inNumber);
712  CHECK_MINUS_ONE(check, "T5-3: equal number",
713  MyTransaction);
714 
715  check = MyOperation->equal(IND_SESSION_SERVER,
716  (char*)&inServerId);
717  CHECK_MINUS_ONE(check, "T5-3: equal server id",
718  MyTransaction);
719 
720  /* Operation 4 */
721 
722  /* Operation 5 */
723  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
724  CHECK_NULL(MyOperation, "T5-5: getNdbOperation",
725  MyTransaction);
726 
727 
728  check = MyOperation->interpretedUpdateTuple();
729  CHECK_MINUS_ONE(check, "T5-5: interpretedUpdateTuple",
730  MyTransaction);
731 
732  check = MyOperation->equal(IND_SERVER_ID,
733  (char*)&inServerId);
734  CHECK_MINUS_ONE(check, "T5-5: equal serverId",
735  MyTransaction);
736 
737  check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
738  (char*)inSuffix);
739  CHECK_MINUS_ONE(check, "T5-5: equal suffix",
740  MyTransaction);
741 
742  check = MyOperation->incValue(IND_SERVER_DELETES, (uint32)1);
743  CHECK_MINUS_ONE(check, "T5-5: inc value",
744  MyTransaction);
745 
746  (* outBranchExecuted) = 1;
747  } else {
748  DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
749  DEBUG1("%s", ((sessions & inServerBit) ? "in session - " : "no in session - "));
750  (* outBranchExecuted) = 0;
751  }
752 
753  if(!inDoRollback && (* outBranchExecuted)){
754  DEBUG("commit\n");
755  check = MyTransaction->execute( Commit );
756  CHECK_MINUS_ONE(check, "T5: Commit",
757  MyTransaction);
758  } else {
759  DEBUG("rollback\n");
760  check = MyTransaction->execute(Rollback);
761  CHECK_MINUS_ONE(check, "T5:Rollback",
762  MyTransaction);
763 
764  }
765 
766  pNDB->closeTransaction(MyTransaction);
767 
768  get_time(outTransactionTime);
769  time_diff(outTransactionTime, &start);
770  return 0;
771 }
772