MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_user_transaction.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  BenchmarkTime start;
56  get_time(&start);
57 
58  int check;
59  NdbRecAttr * check2;
60 
61  NdbConnection * MyTransaction = pNDB->startTransaction();
62  if (MyTransaction == NULL)
63  error_handler("T1: startTranscation", pNDB->getNdbErrorString(), 0);
64 
65  NdbOperation *MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
66  CHECK_NULL(MyOperation, "T1: getNdbOperation", MyTransaction);
67 
68  check = MyOperation->updateTuple();
69  CHECK_MINUS_ONE(check, "T1: updateTuple",
70  MyTransaction);
71 
72  check = MyOperation->equal(SUBSCRIBER_NUMBER,
73  number);
74  CHECK_MINUS_ONE(check, "T1: equal subscriber",
75  MyTransaction);
76 
77  check = MyOperation->setValue(SUBSCRIBER_LOCATION,
78  (char *)&new_location);
79  CHECK_MINUS_ONE(check, "T1: setValue location",
80  MyTransaction);
81 
82  check = MyOperation->setValue(SUBSCRIBER_CHANGED_BY,
83  changed_by);
84  CHECK_MINUS_ONE(check, "T1: setValue changed_by",
85  MyTransaction);
86 
87  check = MyOperation->setValue(SUBSCRIBER_CHANGED_TIME,
88  changed_time);
89  CHECK_MINUS_ONE(check, "T1: setValue changed_time",
90  MyTransaction);
91 
92  check = MyTransaction->execute( Commit );
93  CHECK_MINUS_ONE(check, "T1: Commit",
94  MyTransaction);
95 
96  pNDB->closeTransaction(MyTransaction);
97 
98  get_time(transaction_time);
99  time_diff(transaction_time, &start);
100  return 0;
101 }
102 
117 int
118 T2(void * obj,
119  const SubscriberNumber number,
120  Location * readLocation,
121  ChangedBy changed_by,
122  ChangedTime changed_time,
123  SubscriberName subscriberName,
124  BenchmarkTime * transaction_time){
125 
126  Ndb * pNDB = (Ndb *) obj;
127 
128  BenchmarkTime start;
129  get_time(&start);
130 
131  int check;
132  NdbRecAttr * check2;
133 
134  NdbConnection * MyTransaction = pNDB->startTransaction();
135  if (MyTransaction == NULL)
136  error_handler("T2: startTranscation", pNDB->getNdbErrorString(), 0);
137 
138  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
139  CHECK_NULL(MyOperation, "T2: getNdbOperation",
140  MyTransaction);
141 
142 
143  check = MyOperation->readTuple();
144  CHECK_MINUS_ONE(check, "T2: readTuple",
145  MyTransaction);
146 
147  check = MyOperation->equal(SUBSCRIBER_NUMBER,
148  number);
149  CHECK_MINUS_ONE(check, "T2: equal subscriber",
150  MyTransaction);
151 
152  check2 = MyOperation->getValue(SUBSCRIBER_LOCATION,
153  (char *)readLocation);
154  CHECK_NULL(check2, "T2: getValue location",
155  MyTransaction);
156 
157  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_BY,
158  changed_by);
159  CHECK_NULL(check2, "T2: getValue changed_by",
160  MyTransaction);
161 
162  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_TIME,
163  changed_time);
164  CHECK_NULL(check2, "T2: getValue changed_time",
165  MyTransaction);
166 
167  check2 = MyOperation->getValue(SUBSCRIBER_NAME,
168  subscriberName);
169  CHECK_NULL(check2, "T2: getValue name",
170  MyTransaction);
171 
172  check = MyTransaction->execute( Commit );
173  CHECK_MINUS_ONE(check, "T2: Commit",
174  MyTransaction);
175 
176  pNDB->closeTransaction(MyTransaction);
177 
178  get_time(transaction_time);
179  time_diff(transaction_time, &start);
180  return 0;
181 }
182 
200 int
201 T3(void * obj,
202  const SubscriberNumber inNumber,
203  const SubscriberSuffix inSuffix,
204  const ServerId inServerId,
205  const ServerBit inServerBit,
206  SessionDetails outSessionDetails,
207  ChangedBy outChangedBy,
208  ChangedTime outChangedTime,
209  Location * outLocation,
210  BranchExecuted * outBranchExecuted,
211  BenchmarkTime * outTransactionTime){
212 
213  Ndb * pNDB = (Ndb *) obj;
214 
215  GroupId groupId;
216  ActiveSessions sessions;
217  Permission permission;
218 
219  BenchmarkTime start;
220  get_time(&start);
221 
222  int check;
223  NdbRecAttr * check2;
224 
225  NdbConnection * MyTransaction = pNDB->startTransaction();
226  if (MyTransaction == NULL)
227  error_handler("T3-1: startTranscation", pNDB->getNdbErrorString(), 0);
228 
229  NdbOperation *MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
230  CHECK_NULL(MyOperation, "T3-1: getNdbOperation",
231  MyTransaction);
232 
233 
234  check = MyOperation->readTuple();
235  CHECK_MINUS_ONE(check, "T3-1: readTuple",
236  MyTransaction);
237 
238  check = MyOperation->equal(SUBSCRIBER_NUMBER,
239  inNumber);
240  CHECK_MINUS_ONE(check, "T3-1: equal subscriber",
241  MyTransaction);
242 
243  check2 = MyOperation->getValue(SUBSCRIBER_LOCATION,
244  (char *)outLocation);
245  CHECK_NULL(check2, "T3-1: getValue location",
246  MyTransaction);
247 
248  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_BY,
249  outChangedBy);
250  CHECK_NULL(check2, "T3-1: getValue changed_by",
251  MyTransaction);
252 
253  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_TIME,
254  outChangedTime);
255  CHECK_NULL(check2, "T3-1: getValue changed_time",
256  MyTransaction);
257 
258  check2 = MyOperation->getValue(SUBSCRIBER_GROUP,
259  (char *)&groupId);
260  CHECK_NULL(check2, "T3-1: getValue group",
261  MyTransaction);
262 
263  check2 = MyOperation->getValue(SUBSCRIBER_SESSIONS,
264  (char *)&sessions);
265  CHECK_NULL(check2, "T3-1: getValue sessions",
266  MyTransaction);
267 
268  check = MyTransaction->execute( NoCommit );
269  CHECK_MINUS_ONE(check, "T3-1: NoCommit",
270  MyTransaction);
271 
272  /* Operation 2 */
273 
274  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
275  CHECK_NULL(MyOperation, "T3-2: getNdbOperation",
276  MyTransaction);
277 
278 
279  check = MyOperation->readTuple();
280  CHECK_MINUS_ONE(check, "T3-2: readTuple",
281  MyTransaction);
282 
283  check = MyOperation->equal(GROUP_ID,
284  (char*)&groupId);
285  CHECK_MINUS_ONE(check, "T3-2: equal group",
286  MyTransaction);
287 
288  check2 = MyOperation->getValue(GROUP_ALLOW_READ,
289  (char *)&permission);
290  CHECK_NULL(check2, "T3-2: getValue allow_read",
291  MyTransaction);
292 
293  check = MyTransaction->execute( NoCommit );
294  CHECK_MINUS_ONE(check, "T3-2: NoCommit",
295  MyTransaction);
296 
297  DEBUG3("T3(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
298 
299  if(((permission & inServerBit) == inServerBit) &&
300  ((sessions & inServerBit) == inServerBit)){
301 
302  DEBUG("reading - ");
303 
304  /* Operation 3 */
305 
306  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
307  CHECK_NULL(MyOperation, "T3-3: getNdbOperation",
308  MyTransaction);
309 
310  check = MyOperation->readTuple();
311  CHECK_MINUS_ONE(check, "T3-3: readTuple",
312  MyTransaction);
313 
314  check = MyOperation->equal(SESSION_SUBSCRIBER,
315  (char*)inNumber);
316  CHECK_MINUS_ONE(check, "T3-3: equal number",
317  MyTransaction);
318 
319  check = MyOperation->equal(SESSION_SERVER,
320  (char*)&inServerId);
321  CHECK_MINUS_ONE(check, "T3-3: equal server id",
322  MyTransaction);
323 
324  check2 = MyOperation->getValue(SESSION_DATA,
325  (char *)outSessionDetails);
326  CHECK_NULL(check2, "T3-3: getValue session details",
327  MyTransaction);
328 
329  check = MyTransaction->execute( NoCommit );
330  CHECK_MINUS_ONE(check, "T3-3: NoCommit",
331  MyTransaction);
332 
333  /* Operation 4 */
334 
335  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
336  CHECK_NULL(MyOperation, "T3-4: getNdbOperation",
337  MyTransaction);
338 
339  check = MyOperation->interpretedUpdateTuple();
340  CHECK_MINUS_ONE(check, "T3-4: interpretedUpdateTuple",
341  MyTransaction);
342 
343  check = MyOperation->equal(SERVER_ID,
344  (char*)&inServerId);
345  CHECK_MINUS_ONE(check, "T3-4: equal serverId",
346  MyTransaction);
347 
348  check = MyOperation->equal(SERVER_SUBSCRIBER_SUFFIX,
349  (char*)inSuffix);
350  CHECK_MINUS_ONE(check, "T3-4: equal suffix",
351  MyTransaction);
352 
353  check = MyOperation->incValue(SERVER_READS, (uint32)1);
354  CHECK_MINUS_ONE(check, "T3-4: inc value",
355  MyTransaction);
356 
357  check = MyTransaction->execute( NoCommit );
358  CHECK_MINUS_ONE(check, "T3-4: NoCommit",
359  MyTransaction);
360 
361  (* outBranchExecuted) = 1;
362  } else {
363  (* outBranchExecuted) = 0;
364  }
365  DEBUG("commit\n");
366  check = MyTransaction->execute( Commit );
367  CHECK_MINUS_ONE(check, "T3: Commit",
368  MyTransaction);
369 
370  pNDB->closeTransaction(MyTransaction);
371 
372  get_time(outTransactionTime);
373  time_diff(outTransactionTime, &start);
374  return 0;
375 }
376 
377 
395 int
396 T4(void * obj,
397  const SubscriberNumber inNumber,
398  const SubscriberSuffix inSuffix,
399  const ServerId inServerId,
400  const ServerBit inServerBit,
401  const SessionDetails inSessionDetails,
402  ChangedBy outChangedBy,
403  ChangedTime outChangedTime,
404  Location * outLocation,
405  DoRollback inDoRollback,
406  BranchExecuted * outBranchExecuted,
407  BenchmarkTime * outTransactionTime){
408 
409  Ndb * pNDB = (Ndb *) obj;
410 
411  GroupId groupId;
412  ActiveSessions sessions;
413  Permission permission;
414 
415  BenchmarkTime start;
416  get_time(&start);
417 
418  int check;
419  NdbRecAttr * check2;
420 
421  NdbConnection * MyTransaction = pNDB->startTransaction();
422  if (MyTransaction == NULL)
423  error_handler("T4-1: startTranscation", pNDB->getNdbErrorString(), 0);
424 
425  DEBUG3("T4(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
426 
427  NdbOperation * MyOperation = 0;
428 
429  MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
430  CHECK_NULL(MyOperation, "T4-1: getNdbOperation",
431  MyTransaction);
432 
433  check = MyOperation->readTupleExclusive();
434  CHECK_MINUS_ONE(check, "T4-1: readTuple",
435  MyTransaction);
436 
437  check = MyOperation->equal(SUBSCRIBER_NUMBER,
438  inNumber);
439  CHECK_MINUS_ONE(check, "T4-1: equal subscriber",
440  MyTransaction);
441 
442  check2 = MyOperation->getValue(SUBSCRIBER_LOCATION,
443  (char *)outLocation);
444  CHECK_NULL(check2, "T4-1: getValue location",
445  MyTransaction);
446 
447  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_BY,
448  outChangedBy);
449  CHECK_NULL(check2, "T4-1: getValue changed_by",
450  MyTransaction);
451 
452  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_TIME,
453  outChangedTime);
454  CHECK_NULL(check2, "T4-1: getValue changed_time",
455  MyTransaction);
456 
457  check2 = MyOperation->getValue(SUBSCRIBER_GROUP,
458  (char *)&groupId);
459  CHECK_NULL(check2, "T4-1: getValue group",
460  MyTransaction);
461 
462  check2 = MyOperation->getValue(SUBSCRIBER_SESSIONS,
463  (char *)&sessions);
464  CHECK_NULL(check2, "T4-1: getValue sessions",
465  MyTransaction);
466 
467  check = MyTransaction->execute( NoCommit );
468  CHECK_MINUS_ONE(check, "T4-1: NoCommit",
469  MyTransaction);
470 
471  /* Operation 2 */
472  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
473  CHECK_NULL(MyOperation, "T4-2: getNdbOperation",
474  MyTransaction);
475 
476  check = MyOperation->readTuple();
477  CHECK_MINUS_ONE(check, "T4-2: readTuple",
478  MyTransaction);
479 
480  check = MyOperation->equal(GROUP_ID,
481  (char*)&groupId);
482  CHECK_MINUS_ONE(check, "T4-2: equal group",
483  MyTransaction);
484 
485  check2 = MyOperation->getValue(GROUP_ALLOW_INSERT,
486  (char *)&permission);
487  CHECK_NULL(check2, "T4-2: getValue allow_insert",
488  MyTransaction);
489 
490  check = MyTransaction->execute( NoCommit );
491  CHECK_MINUS_ONE(check, "T4-2: NoCommit",
492  MyTransaction);
493 
494  if(((permission & inServerBit) == inServerBit) &&
495  ((sessions & inServerBit) == 0)){
496 
497  DEBUG("inserting - ");
498 
499  /* Operation 3 */
500  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
501  CHECK_NULL(MyOperation, "T4-3: getNdbOperation",
502  MyTransaction);
503 
504  check = MyOperation->insertTuple();
505  CHECK_MINUS_ONE(check, "T4-3: insertTuple",
506  MyTransaction);
507 
508  check = MyOperation->equal(SESSION_SUBSCRIBER,
509  (char*)inNumber);
510  CHECK_MINUS_ONE(check, "T4-3: equal number",
511  MyTransaction);
512 
513  check = MyOperation->equal(SESSION_SERVER,
514  (char*)&inServerId);
515  CHECK_MINUS_ONE(check, "T4-3: equal server id",
516  MyTransaction);
517 
518  check = MyOperation->setValue(SESSION_DATA,
519  (char *)inSessionDetails);
520  CHECK_MINUS_ONE(check, "T4-3: setValue session details",
521  MyTransaction);
522 
523  check = MyTransaction->execute( NoCommit );
524  CHECK_MINUS_ONE(check, "T4-3: NoCommit",
525  MyTransaction);
526 
527  /* Operation 4 */
528  MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
529  CHECK_NULL(MyOperation, "T4-4: getNdbOperation",
530  MyTransaction);
531 
532  check = MyOperation->interpretedUpdateTuple();
533  CHECK_MINUS_ONE(check, "T4-4: interpretedUpdateTuple",
534  MyTransaction);
535 
536  check = MyOperation->equal(SUBSCRIBER_NUMBER,
537  (char*)inNumber);
538  CHECK_MINUS_ONE(check, "T4-4: equal number",
539  MyTransaction);
540 
541  check = MyOperation->incValue(SUBSCRIBER_SESSIONS,
542  (uint32)inServerBit);
543  CHECK_MINUS_ONE(check, "T4-4: inc value",
544  MyTransaction);
545 
546  check = MyTransaction->execute( NoCommit );
547  CHECK_MINUS_ONE(check, "T4-4: NoCommit",
548  MyTransaction);
549 
550  /* Operation 5 */
551  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
552  CHECK_NULL(MyOperation, "T4-5: getNdbOperation",
553  MyTransaction);
554 
555  check = MyOperation->interpretedUpdateTuple();
556  CHECK_MINUS_ONE(check, "T4-5: interpretedUpdateTuple",
557  MyTransaction);
558 
559  check = MyOperation->equal(SERVER_ID,
560  (char*)&inServerId);
561  CHECK_MINUS_ONE(check, "T4-5: equal serverId",
562  MyTransaction);
563 
564  check = MyOperation->equal(SERVER_SUBSCRIBER_SUFFIX,
565  (char*)inSuffix);
566  CHECK_MINUS_ONE(check, "T4-5: equal suffix",
567  MyTransaction);
568 
569  check = MyOperation->incValue(SERVER_INSERTS, (uint32)1);
570  CHECK_MINUS_ONE(check, "T4-5: inc value",
571  MyTransaction);
572 
573  check = MyTransaction->execute( NoCommit );
574  CHECK_MINUS_ONE(check, "T4-5: NoCommit",
575  MyTransaction);
576 
577  (* outBranchExecuted) = 1;
578  } else {
579  DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
580  DEBUG1("%s", ((sessions & inServerBit) ? "in session - " : "no in session - "));
581  (* outBranchExecuted) = 0;
582  }
583 
584  if(!inDoRollback){
585  DEBUG("commit\n");
586  check = MyTransaction->execute( Commit );
587  CHECK_MINUS_ONE(check, "T4: Commit",
588  MyTransaction);
589  } else {
590  DEBUG("rollback\n");
591  check = MyTransaction->execute(Rollback);
592  CHECK_MINUS_ONE(check, "T4:Rollback",
593  MyTransaction);
594 
595  }
596 
597  pNDB->closeTransaction(MyTransaction);
598 
599  get_time(outTransactionTime);
600  time_diff(outTransactionTime, &start);
601  return 0;
602 }
603 
604 
621 int
622 T5(void * obj,
623  const SubscriberNumber inNumber,
624  const SubscriberSuffix inSuffix,
625  const ServerId inServerId,
626  const ServerBit inServerBit,
627  ChangedBy outChangedBy,
628  ChangedTime outChangedTime,
629  Location * outLocation,
630  DoRollback inDoRollback,
631  BranchExecuted * outBranchExecuted,
632  BenchmarkTime * outTransactionTime){
633 
634  Ndb * pNDB = (Ndb *) obj;
635  NdbConnection * MyTransaction = 0;
636  NdbOperation * MyOperation = 0;
637 
638  GroupId groupId;
639  ActiveSessions sessions;
640  Permission permission;
641 
642  BenchmarkTime start;
643  get_time(&start);
644 
645  int check;
646  NdbRecAttr * check2;
647 
648  MyTransaction = pNDB->startTransaction();
649  if (MyTransaction == NULL)
650  error_handler("T5-1: startTranscation", pNDB->getNdbErrorString(), 0);
651 
652  MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
653  CHECK_NULL(MyOperation, "T5-1: getNdbOperation",
654  MyTransaction);
655 
656 
657  check = MyOperation->readTupleExclusive();
658  CHECK_MINUS_ONE(check, "T5-1: readTuple",
659  MyTransaction);
660 
661  check = MyOperation->equal(SUBSCRIBER_NUMBER,
662  inNumber);
663  CHECK_MINUS_ONE(check, "T5-1: equal subscriber",
664  MyTransaction);
665 
666  check2 = MyOperation->getValue(SUBSCRIBER_LOCATION,
667  (char *)outLocation);
668  CHECK_NULL(check2, "T5-1: getValue location",
669  MyTransaction);
670 
671  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_BY,
672  outChangedBy);
673  CHECK_NULL(check2, "T5-1: getValue changed_by",
674  MyTransaction);
675 
676  check2 = MyOperation->getValue(SUBSCRIBER_CHANGED_TIME,
677  outChangedTime);
678  CHECK_NULL(check2, "T5-1: getValue changed_time",
679  MyTransaction);
680 
681  check2 = MyOperation->getValue(SUBSCRIBER_GROUP,
682  (char *)&groupId);
683  CHECK_NULL(check2, "T5-1: getValue group",
684  MyTransaction);
685 
686  check2 = MyOperation->getValue(SUBSCRIBER_SESSIONS,
687  (char *)&sessions);
688  CHECK_NULL(check2, "T5-1: getValue sessions",
689  MyTransaction);
690 
691  check = MyTransaction->execute( NoCommit );
692  CHECK_MINUS_ONE(check, "T5-1: NoCommit",
693  MyTransaction);
694 
695  /* Operation 2 */
696 
697  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
698  CHECK_NULL(MyOperation, "T5-2: getNdbOperation",
699  MyTransaction);
700 
701 
702  check = MyOperation->readTuple();
703  CHECK_MINUS_ONE(check, "T5-2: readTuple",
704  MyTransaction);
705 
706  check = MyOperation->equal(GROUP_ID,
707  (char*)&groupId);
708  CHECK_MINUS_ONE(check, "T5-2: equal group",
709  MyTransaction);
710 
711  check2 = MyOperation->getValue(GROUP_ALLOW_DELETE,
712  (char *)&permission);
713  CHECK_NULL(check2, "T5-2: getValue allow_delete",
714  MyTransaction);
715 
716  check = MyTransaction->execute( NoCommit );
717  CHECK_MINUS_ONE(check, "T5-2: NoCommit",
718  MyTransaction);
719 
720  DEBUG3("T5(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);
721 
722  if(((permission & inServerBit) == inServerBit) &&
723  ((sessions & inServerBit) == inServerBit)){
724 
725  DEBUG("deleting - ");
726 
727  /* Operation 3 */
728  MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
729  CHECK_NULL(MyOperation, "T5-3: getNdbOperation",
730  MyTransaction);
731 
732  check = MyOperation->deleteTuple();
733  CHECK_MINUS_ONE(check, "T5-3: deleteTuple",
734  MyTransaction);
735 
736  check = MyOperation->equal(SESSION_SUBSCRIBER,
737  (char*)inNumber);
738  CHECK_MINUS_ONE(check, "T5-3: equal number",
739  MyTransaction);
740 
741  check = MyOperation->equal(SESSION_SERVER,
742  (char*)&inServerId);
743  CHECK_MINUS_ONE(check, "T5-3: equal server id",
744  MyTransaction);
745 
746  check = MyTransaction->execute( NoCommit );
747  CHECK_MINUS_ONE(check, "T5-3: NoCommit",
748  MyTransaction);
749 
750  /* Operation 4 */
751  MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
752  CHECK_NULL(MyOperation, "T5-4: getNdbOperation",
753  MyTransaction);
754 
755  check = MyOperation->interpretedUpdateTuple();
756  CHECK_MINUS_ONE(check, "T5-4: interpretedUpdateTuple",
757  MyTransaction);
758 
759  check = MyOperation->equal(SUBSCRIBER_NUMBER,
760  (char*)inNumber);
761  CHECK_MINUS_ONE(check, "T5-4: equal number",
762  MyTransaction);
763 
764  check = MyOperation->subValue(SUBSCRIBER_SESSIONS,
765  (uint32)inServerBit);
766  CHECK_MINUS_ONE(check, "T5-4: dec value",
767  MyTransaction);
768 
769  check = MyTransaction->execute( NoCommit );
770  CHECK_MINUS_ONE(check, "T5-4: NoCommit",
771  MyTransaction);
772 
773  /* Operation 5 */
774  MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
775  CHECK_NULL(MyOperation, "T5-5: getNdbOperation",
776  MyTransaction);
777 
778 
779  check = MyOperation->interpretedUpdateTuple();
780  CHECK_MINUS_ONE(check, "T5-5: interpretedUpdateTuple",
781  MyTransaction);
782 
783  check = MyOperation->equal(SERVER_ID,
784  (char*)&inServerId);
785  CHECK_MINUS_ONE(check, "T5-5: equal serverId",
786  MyTransaction);
787 
788  check = MyOperation->equal(SERVER_SUBSCRIBER_SUFFIX,
789  (char*)inSuffix);
790  CHECK_MINUS_ONE(check, "T5-5: equal suffix",
791  MyTransaction);
792 
793  check = MyOperation->incValue(SERVER_DELETES, (uint32)1);
794  CHECK_MINUS_ONE(check, "T5-5: inc value",
795  MyTransaction);
796 
797  check = MyTransaction->execute( NoCommit );
798  CHECK_MINUS_ONE(check, "T5-5: NoCommit",
799  MyTransaction);
800 
801  (* outBranchExecuted) = 1;
802  } else {
803  DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
804  DEBUG1("%s", ((sessions & inServerBit) ? "in session - " : "no in session - "));
805  (* outBranchExecuted) = 0;
806  }
807 
808  if(!inDoRollback){
809  DEBUG("commit\n");
810  check = MyTransaction->execute( Commit );
811  CHECK_MINUS_ONE(check, "T5: Commit",
812  MyTransaction);
813  } else {
814  DEBUG("rollback\n");
815  check = MyTransaction->execute(Rollback);
816  CHECK_MINUS_ONE(check, "T5:Rollback",
817  MyTransaction);
818 
819  }
820 
821  pNDB->closeTransaction(MyTransaction);
822 
823  get_time(outTransactionTime);
824  time_diff(outTransactionTime, &start);
825  return 0;
826 }
827