MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_user_transaction5.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  Ndb * pNDB = (Ndb *) obj;
218 
219  GroupId groupId;
220  ActiveSessions sessions;
221  Permission permission;
222 
223  BenchmarkTime start;
224  get_time(&start);
225 
226  int check;
227  NdbRecAttr * check2;
228 
229  NdbConnection * MyTransaction = pNDB->startTransaction();
230  if (MyTransaction == NULL)
231  error_handler("T3-1: startTranscation", pNDB->getNdbErrorString(), 0);
232 
233  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
234  CHECK_NULL(MyOperation, "T3-1: getNdbOperation",
235  MyTransaction);
236 
237  check = MyOperation->readTuple();
238  CHECK_MINUS_ONE(check, "T3-1: readTuple",
239  MyTransaction);
240 
241  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
242  inNumber);
243  CHECK_MINUS_ONE(check, "T3-1: equal subscriber",
244  MyTransaction);
245 
246  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
247  (char *)outLocation);
248  CHECK_NULL(check2, "T3-1: getValue location",
249  MyTransaction);
250 
251  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
252  outChangedBy);
253  CHECK_NULL(check2, "T3-1: getValue changed_by",
254  MyTransaction);
255 
256  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
257  outChangedTime);
258  CHECK_NULL(check2, "T3-1: getValue changed_time",
259  MyTransaction);
260 
261  check2 = MyOperation->getValue(IND_SUBSCRIBER_GROUP,
262  (char *)&groupId);
263  CHECK_NULL(check2, "T3-1: getValue group",
264  MyTransaction);
265 
266  check2 = MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
267  (char *)&sessions);
268  CHECK_NULL(check2, "T3-1: getValue sessions",
269  MyTransaction);
270 
271  check = MyTransaction->execute( NoCommit );
272  CHECK_MINUS_ONE(check, "T3-1: NoCommit",
273  MyTransaction);
274 
275  /* Operation 2 */
276 
277  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
278  CHECK_NULL(MyOperation, "T3-2: getNdbOperation",
279  MyTransaction);
280 
281 
282  check = MyOperation->readTuple();
283  CHECK_MINUS_ONE(check, "T3-2: readTuple",
284  MyTransaction);
285 
286  check = MyOperation->equal(IND_GROUP_ID,
287  (char*)&groupId);
288  CHECK_MINUS_ONE(check, "T3-2: equal group",
289  MyTransaction);
290 
291  check2 = MyOperation->getValue(IND_GROUP_ALLOW_READ,
292  (char *)&permission);
293  CHECK_NULL(check2, "T3-2: getValue allow_read",
294  MyTransaction);
295 
296  check = MyTransaction->execute( NoCommit );
297  CHECK_MINUS_ONE(check, "T3-2: NoCommit",
298  MyTransaction);
299 
300  DEBUG3("T3(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
301 
302  if(((permission & inServerBit) == inServerBit) &&
303  ((sessions & inServerBit) == inServerBit)){
304 
305  DEBUG("reading - ");
306 
307  /* Operation 3 */
308  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
309  CHECK_NULL(MyOperation, "T3-3: getNdbOperation",
310  MyTransaction);
311 
312  check = MyOperation->simpleRead();
313  CHECK_MINUS_ONE(check, "T3-3: readTuple",
314  MyTransaction);
315 
316  check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
317  (char*)inNumber);
318  CHECK_MINUS_ONE(check, "T3-3: equal number",
319  MyTransaction);
320 
321  check = MyOperation->equal(IND_SESSION_SERVER,
322  (char*)&inServerId);
323  CHECK_MINUS_ONE(check, "T3-3: equal server id",
324  MyTransaction);
325 
326  check2 = MyOperation->getValue(IND_SESSION_DATA,
327  (char *)outSessionDetails);
328  CHECK_NULL(check2, "T3-3: getValue session details",
329  MyTransaction);
330 
331  /* Operation 4 */
332  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
333  CHECK_NULL(MyOperation, "T3-4: getNdbOperation",
334  MyTransaction);
335 
336  check = MyOperation->interpretedUpdateTuple();
337  CHECK_MINUS_ONE(check, "T3-4: interpretedUpdateTuple",
338  MyTransaction);
339 
340  check = MyOperation->equal(IND_SERVER_ID,
341  (char*)&inServerId);
342  CHECK_MINUS_ONE(check, "T3-4: equal serverId",
343  MyTransaction);
344 
345  check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
346  (char*)inSuffix);
347  CHECK_MINUS_ONE(check, "T3-4: equal suffix",
348  MyTransaction);
349 
350  check = MyOperation->incValue(IND_SERVER_READS, (uint32)1);
351  CHECK_MINUS_ONE(check, "T3-4: inc value",
352  MyTransaction);
353  (* outBranchExecuted) = 1;
354  } else {
355  (* outBranchExecuted) = 0;
356  }
357  DEBUG("commit...");
358  check = MyTransaction->execute( Commit );
359  CHECK_MINUS_ONE(check, "T3: Commit",
360  MyTransaction);
361 
362  pNDB->closeTransaction(MyTransaction);
363 
364  DEBUG("done\n");
365  get_time(outTransactionTime);
366  time_diff(outTransactionTime, &start);
367  return 0;
368 }
369 
370 
388 int
389 T4(void * obj,
390  const SubscriberNumber inNumber,
391  const SubscriberSuffix inSuffix,
392  const ServerId inServerId,
393  const ServerBit inServerBit,
394  const SessionDetails inSessionDetails,
395  ChangedBy outChangedBy,
396  ChangedTime outChangedTime,
397  Location * outLocation,
398  DoRollback inDoRollback,
399  BranchExecuted * outBranchExecuted,
400  BenchmarkTime * outTransactionTime){
401 
402  Ndb * pNDB = (Ndb *) obj;
403 
404  GroupId groupId;
405  ActiveSessions sessions;
406  Permission permission;
407 
408  BenchmarkTime start;
409  get_time(&start);
410 
411  int check;
412  NdbRecAttr * check2;
413 
414  NdbConnection * MyTransaction = pNDB->startTransaction();
415  if (MyTransaction == NULL)
416  error_handler("T4-1: startTranscation", pNDB->getNdbErrorString(), 0);
417 
418  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
419  CHECK_NULL(MyOperation, "T4-1: getNdbOperation",
420  MyTransaction);
421 
422  check = MyOperation->interpretedUpdateTuple();
423  CHECK_MINUS_ONE(check, "T4-1: readTuple",
424  MyTransaction);
425 
426  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
427  inNumber);
428  CHECK_MINUS_ONE(check, "T4-1: equal subscriber",
429  MyTransaction);
430 
431  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
432  (char *)outLocation);
433  CHECK_NULL(check2, "T4-1: getValue location",
434  MyTransaction);
435 
436  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
437  outChangedBy);
438  CHECK_NULL(check2, "T4-1: getValue changed_by",
439  MyTransaction);
440 
441  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
442  outChangedTime);
443  CHECK_NULL(check2, "T4-1: getValue changed_time",
444  MyTransaction);
445 
446  check2 = MyOperation->getValue(IND_SUBSCRIBER_GROUP,
447  (char *)&groupId);
448  CHECK_NULL(check2, "T4-1: getValue group",
449  MyTransaction);
450 
451  check2 = MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
452  (char *)&sessions);
453  CHECK_NULL(check2, "T4-1: getValue sessions",
454  MyTransaction);
455 
456  check = MyOperation->incValue(IND_SUBSCRIBER_SESSIONS,
457  (uint32)inServerBit);
458  CHECK_MINUS_ONE(check, "T4-4: inc value",
459  MyTransaction);
460 
461  check = MyTransaction->execute( NoCommit );
462  CHECK_MINUS_ONE(check, "T4-1: NoCommit",
463  MyTransaction);
464 
465  /* Operation 2 */
466 
467  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
468  CHECK_NULL(MyOperation, "T4-2: getNdbOperation",
469  MyTransaction);
470 
471  check = MyOperation->readTuple();
472  CHECK_MINUS_ONE(check, "T4-2: readTuple",
473  MyTransaction);
474 
475  check = MyOperation->equal(IND_GROUP_ID,
476  (char*)&groupId);
477  CHECK_MINUS_ONE(check, "T4-2: equal group",
478  MyTransaction);
479 
480  check2 = MyOperation->getValue(IND_GROUP_ALLOW_INSERT,
481  (char *)&permission);
482  CHECK_NULL(check2, "T4-2: getValue allow_insert",
483  MyTransaction);
484 
485  check = MyTransaction->execute( NoCommit );
486  CHECK_MINUS_ONE(check, "T4-2: NoCommit",
487  MyTransaction);
488 
489  DEBUG3("T4(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
490 
491  if(((permission & inServerBit) == inServerBit) &&
492  ((sessions & inServerBit) == 0)){
493 
494  DEBUG("inserting - ");
495 
496  /* Operation 3 */
497 
498  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
499  CHECK_NULL(MyOperation, "T4-3: getNdbOperation",
500  MyTransaction);
501 
502  check = MyOperation->insertTuple();
503  CHECK_MINUS_ONE(check, "T4-3: insertTuple",
504  MyTransaction);
505 
506  check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
507  (char*)inNumber);
508  CHECK_MINUS_ONE(check, "T4-3: equal number",
509  MyTransaction);
510 
511  check = MyOperation->equal(IND_SESSION_SERVER,
512  (char*)&inServerId);
513  CHECK_MINUS_ONE(check, "T4-3: equal server id",
514  MyTransaction);
515 
516  check = MyOperation->setValue(SESSION_DATA,
517  (char *)inSessionDetails);
518  CHECK_MINUS_ONE(check, "T4-3: setValue session details",
519  MyTransaction);
520 
521  /* Operation 4 */
522 
523  /* Operation 5 */
524  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
525  CHECK_NULL(MyOperation, "T4-5: getNdbOperation",
526  MyTransaction);
527 
528  check = MyOperation->interpretedUpdateTuple();
529  CHECK_MINUS_ONE(check, "T4-5: interpretedUpdateTuple",
530  MyTransaction);
531 
532  check = MyOperation->equal(IND_SERVER_ID,
533  (char*)&inServerId);
534  CHECK_MINUS_ONE(check, "T4-5: equal serverId",
535  MyTransaction);
536 
537  check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
538  (char*)inSuffix);
539  CHECK_MINUS_ONE(check, "T4-5: equal suffix",
540  MyTransaction);
541 
542  check = MyOperation->incValue(IND_SERVER_INSERTS, (uint32)1);
543  CHECK_MINUS_ONE(check, "T4-5: inc value",
544  MyTransaction);
545 
546  (* outBranchExecuted) = 1;
547  } else {
548  DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
549  DEBUG1("%s", ((sessions & inServerBit) ? "in session - " : "no in session - "));
550  (* outBranchExecuted) = 0;
551  }
552 
553  if(!inDoRollback && (* outBranchExecuted)){
554  DEBUG("commit\n");
555  check = MyTransaction->execute( Commit );
556  CHECK_MINUS_ONE(check, "T4: Commit",
557  MyTransaction);
558  } else {
559  DEBUG("rollback\n");
560  check = MyTransaction->execute(Rollback);
561  CHECK_MINUS_ONE(check, "T4:Rollback",
562  MyTransaction);
563 
564  }
565 
566  pNDB->closeTransaction(MyTransaction);
567 
568  get_time(outTransactionTime);
569  time_diff(outTransactionTime, &start);
570  return 0;
571 }
572 
573 
590 int
591 T5(void * obj,
592  const SubscriberNumber inNumber,
593  const SubscriberSuffix inSuffix,
594  const ServerId inServerId,
595  const ServerBit inServerBit,
596  ChangedBy outChangedBy,
597  ChangedTime outChangedTime,
598  Location * outLocation,
599  DoRollback inDoRollback,
600  BranchExecuted * outBranchExecuted,
601  BenchmarkTime * outTransactionTime){
602 
603  Ndb * pNDB = (Ndb *) obj;
604  NdbConnection * MyTransaction = 0;
605  NdbOperation * MyOperation = 0;
606 
607  GroupId groupId;
608  ActiveSessions sessions;
609  Permission permission;
610 
611  BenchmarkTime start;
612  get_time(&start);
613 
614  int check;
615  NdbRecAttr * check2;
616 
617  MyTransaction = pNDB->startTransaction();
618  if (MyTransaction == NULL)
619  error_handler("T5-1: startTranscation", pNDB->getNdbErrorString(), 0);
620 
621  MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
622  CHECK_NULL(MyOperation, "T5-1: getNdbOperation",
623  MyTransaction);
624 
625  check = MyOperation->interpretedUpdateTuple();
626  CHECK_MINUS_ONE(check, "T5-1: readTuple",
627  MyTransaction);
628 
629  check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
630  inNumber);
631  CHECK_MINUS_ONE(check, "T5-1: equal subscriber",
632  MyTransaction);
633 
634  check2 = MyOperation->getValue(IND_SUBSCRIBER_LOCATION,
635  (char *)outLocation);
636  CHECK_NULL(check2, "T5-1: getValue location",
637  MyTransaction);
638 
639  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY,
640  outChangedBy);
641  CHECK_NULL(check2, "T5-1: getValue changed_by",
642  MyTransaction);
643 
644  check2 = MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME,
645  outChangedTime);
646  CHECK_NULL(check2, "T5-1: getValue changed_time",
647  MyTransaction);
648 
649  check2 = MyOperation->getValue(IND_SUBSCRIBER_GROUP,
650  (char *)&groupId);
651  CHECK_NULL(check2, "T5-1: getValue group",
652  MyTransaction);
653 
654  check2 = MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
655  (char *)&sessions);
656  CHECK_NULL(check2, "T5-1: getValue sessions",
657  MyTransaction);
658 
659  check = MyOperation->subValue(IND_SUBSCRIBER_SESSIONS,
660  (uint32)inServerBit);
661  CHECK_MINUS_ONE(check, "T5-4: dec value",
662  MyTransaction);
663 
664  check = MyTransaction->execute( NoCommit );
665  CHECK_MINUS_ONE(check, "T5-1: NoCommit",
666  MyTransaction);
667 
668  /* Operation 2 */
669 
670  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
671  CHECK_NULL(MyOperation, "T5-2: getNdbOperation",
672  MyTransaction);
673 
674 
675  check = MyOperation->readTuple();
676  CHECK_MINUS_ONE(check, "T5-2: readTuple",
677  MyTransaction);
678 
679  check = MyOperation->equal(IND_GROUP_ID,
680  (char*)&groupId);
681  CHECK_MINUS_ONE(check, "T5-2: equal group",
682  MyTransaction);
683 
684  check2 = MyOperation->getValue(IND_GROUP_ALLOW_DELETE,
685  (char *)&permission);
686  CHECK_NULL(check2, "T5-2: getValue allow_delete",
687  MyTransaction);
688 
689  check = MyTransaction->execute( NoCommit );
690  CHECK_MINUS_ONE(check, "T5-2: NoCommit",
691  MyTransaction);
692 
693  DEBUG3("T5(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
694 
695  if(((permission & inServerBit) == inServerBit) &&
696  ((sessions & inServerBit) == inServerBit)){
697 
698  DEBUG("deleting - ");
699 
700  /* Operation 3 */
701  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
702  CHECK_NULL(MyOperation, "T5-3: getNdbOperation",
703  MyTransaction);
704 
705  check = MyOperation->deleteTuple();
706  CHECK_MINUS_ONE(check, "T5-3: deleteTuple",
707  MyTransaction);
708 
709  check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
710  (char*)inNumber);
711  CHECK_MINUS_ONE(check, "T5-3: equal number",
712  MyTransaction);
713 
714  check = MyOperation->equal(IND_SESSION_SERVER,
715  (char*)&inServerId);
716  CHECK_MINUS_ONE(check, "T5-3: equal server id",
717  MyTransaction);
718 
719  /* Operation 4 */
720 
721  /* Operation 5 */
722  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
723  CHECK_NULL(MyOperation, "T5-5: getNdbOperation",
724  MyTransaction);
725 
726 
727  check = MyOperation->interpretedUpdateTuple();
728  CHECK_MINUS_ONE(check, "T5-5: interpretedUpdateTuple",
729  MyTransaction);
730 
731  check = MyOperation->equal(IND_SERVER_ID,
732  (char*)&inServerId);
733  CHECK_MINUS_ONE(check, "T5-5: equal serverId",
734  MyTransaction);
735 
736  check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
737  (char*)inSuffix);
738  CHECK_MINUS_ONE(check, "T5-5: equal suffix",
739  MyTransaction);
740 
741  check = MyOperation->incValue(IND_SERVER_DELETES, (uint32)1);
742  CHECK_MINUS_ONE(check, "T5-5: inc value",
743  MyTransaction);
744 
745  (* outBranchExecuted) = 1;
746  } else {
747  DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
748  DEBUG1("%s", ((sessions & inServerBit) ? "in session - " : "no in session - "));
749  (* outBranchExecuted) = 0;
750  }
751 
752  if(!inDoRollback && (* outBranchExecuted)){
753  DEBUG("commit\n");
754  check = MyTransaction->execute( Commit );
755  CHECK_MINUS_ONE(check, "T5: Commit",
756  MyTransaction);
757  } else {
758  DEBUG("rollback\n");
759  check = MyTransaction->execute(Rollback);
760  CHECK_MINUS_ONE(check, "T5:Rollback",
761  MyTransaction);
762 
763  }
764 
765  pNDB->closeTransaction(MyTransaction);
766 
767  get_time(outTransactionTime);
768  time_diff(outTransactionTime, &start);
769  return 0;
770 }
771