MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
userInterface.cpp
1 /*
2  Copyright (C) 2005, 2006, 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
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 /***************************************************************
20 * I N C L U D E D F I L E S *
21 ***************************************************************/
22 
23 #include <ndb_global.h>
24 #ifndef NDB_WIN32
25 #include <sys/time.h>
26 #endif
27 
28 #include "ndb_error.hpp"
29 #include "userInterface.h"
30 #include <NdbThread.h>
31 #include <NdbTick.h>
32 #include <NdbMutex.h>
33 #include <NdbSleep.h>
34 #include "ndb_schema.hpp"
35 #include <NDBT.hpp>
36 #include <NdbSchemaCon.hpp>
37 
38 /***************************************************************
39 * L O C A L C O N S T A N T S *
40 ***************************************************************/
41 
42 /***************************************************************
43 * L O C A L D A T A S T R U C T U R E S *
44 ***************************************************************/
45 
46 /***************************************************************
47 * L O C A L F U N C T I O N S *
48 ***************************************************************/
49 
50 extern int localDbPrepare(UserHandle *uh);
51 
52 /***************************************************************
53 * L O C A L D A T A *
54 ***************************************************************/
55 
56 /***************************************************************
57 * P U B L I C D A T A *
58 ***************************************************************/
59 
60 
61 /***************************************************************
62 ****************************************************************
63 * L O C A L F U N C T I O N S C O D E S E C T I O N *
64 ****************************************************************
65 ***************************************************************/
66 
67 /***************************************************************
68 ****************************************************************
69 * P U B L I C F U N C T I O N S C O D E S E C T I O N *
70 ****************************************************************
71 ***************************************************************/
72 
73 /*-----------------------------------*/
74 /* Time related Functions */
75 /* */
76 /* Returns a double value in seconds */
77 /*-----------------------------------*/
78 double userGetTimeSync(void)
79 {
80  static int initialized = 0;
81  static NDB_TICKS initSecs = 0;
82  static Uint32 initMicros = 0;
83  double timeValue = 0;
84 
85  if ( !initialized ) {
86  initialized = 1;
87  NdbTick_CurrentMicrosecond(&initSecs, &initMicros);
88  timeValue = 0.0;
89  } else {
90  NDB_TICKS secs = 0;
91  Uint32 micros = 0;
92 
93  NdbTick_CurrentMicrosecond(&secs, &micros);
94 
95  double s = (double)secs - (double)initSecs;
96  double us = (double)secs - (double)initMicros;
97 
98  timeValue = s + (us / 1000000.0);
99  }
100 
101  return timeValue;
102 }
103 
104 // 0 - OK
105 // 1 - Retry transaction
106 // 2 - Permanent
107 int
108 userDbCommit(UserHandle *uh){
109  if(uh->pCurrTrans != 0){
110  /* int check = */ uh->pCurrTrans->execute( Commit );
111  NdbError err = uh->pCurrTrans->getNdbError();
112  uh->pNDB->closeTransaction(uh->pCurrTrans);
113  uh->pCurrTrans = 0;
114 
115  if(err.status != NdbError::Success)
116  ndbout << err << endl;
117 
118  if(err.status == NdbError::TemporaryError &&
120  NdbSleep_SecSleep(3);
121  }
122 
123  return err.status;
124  }
125  return 2;
126 }
127 
133 #ifdef __cplusplus
134 extern "C" {
135 #endif
136 extern int useTableLogging;
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 
142 int
143 create_table_server(Ndb * pNdb){
144  int check;
145  NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
146  if( MySchemaTransaction == NULL )
147  error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
148 
149  NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
150  if( MySchemaOp == NULL )
151  error_handler("getNdbSchemaOp", MySchemaTransaction->getNdbError(), 0);
152 
153  // Create table
154  check = MySchemaOp->createTable( SERVER_TABLE,
155  8, // Table size
156  TupleKey, // Key Type
157  1 // Nr of Pages
158  ,DistributionGroup,
159  6,
160  78,
161  80,
162  1,
163  useTableLogging
164  );
165  if( check == -1 )
166  error_handler("createTable", MySchemaTransaction->getNdbError(), 0);
167 
168  check = MySchemaOp->createAttribute
169  ( SERVER_SUBSCRIBER_SUFFIX,
170  TupleKey,
171  sizeof(char) << 3,
172  SUBSCRIBER_NUMBER_SUFFIX_LENGTH,
173  String,
174  MMBased,
175  NotNullAttribute,
176  0,
177  0,
178  1,
179  16);
180  if( check == -1 )
181  error_handler("createAttribute (subscriber suffix)",
182  MySchemaTransaction->getNdbError(), 0);
183 
184  // Create first column, primary key
185  check = MySchemaOp->createAttribute( SERVER_ID,
186  TupleKey,
187  sizeof(ServerId) << 3,
188  1,
189  UnSigned,
190  MMBased,
191  NotNullAttribute );
192  if( check == -1 )
193  error_handler("createAttribute (serverid)",
194  MySchemaTransaction->getNdbError(), 0);
195 
196 
197  check = MySchemaOp->createAttribute( SERVER_NAME,
198  NoKey,
199  sizeof(char) << 3,
200  SERVER_NAME_LENGTH,
201  String,
202  MMBased,
203  NotNullAttribute );
204  if( check == -1 )
205  error_handler("createAttribute (server name)",
206  MySchemaTransaction->getNdbError(), 0);
207 
208 
209  check = MySchemaOp->createAttribute( SERVER_READS,
210  NoKey,
211  sizeof(Counter) << 3,
212  1,
213  UnSigned,
214  MMBased,
215  NotNullAttribute );
216  if( check == -1 )
217  error_handler("createAttribute (server reads)",
218  MySchemaTransaction->getNdbError(), 0);
219 
220  check = MySchemaOp->createAttribute( SERVER_INSERTS,
221  NoKey,
222  sizeof(Counter) << 3,
223  1,
224  UnSigned,
225  MMBased,
226  NotNullAttribute );
227  if( check == -1 )
228  error_handler("createAttribute (server inserts)",
229  MySchemaTransaction->getNdbError(), 0);
230 
231  check = MySchemaOp->createAttribute( SERVER_DELETES,
232  NoKey,
233  sizeof(Counter) << 3,
234  1,
235  UnSigned,
236  MMBased,
237  NotNullAttribute );
238  if( check == -1 )
239  error_handler("createAttribute (server deletes)",
240  MySchemaTransaction->getNdbError(), 0);
241 
242  if( MySchemaTransaction->execute() == -1 ) {
243  error_handler("schemaTransaction->execute()",
244  MySchemaTransaction->getNdbError(), 0);
245  }
246  NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
247  return 0;
248 }
249 
250 int
251 create_table_group(Ndb * pNdb){
252  int check;
253 
254  NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
255  if( MySchemaTransaction == NULL )
256  error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
257 
258  NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
259  if( MySchemaOp == NULL )
260  error_handler("getNdbSchemaOp", MySchemaTransaction->getNdbError(), 0);
261 
262  // Create table
263  check = MySchemaOp->createTable( GROUP_TABLE,
264  8, // Table size
265  TupleKey, // Key Type
266  1 // Nr of Pages
267  ,All,
268  6,
269  78,
270  80,
271  1,
272  useTableLogging
273  );
274 
275  if( check == -1 )
276  error_handler("createTable", MySchemaTransaction->getNdbError(), 0);
277 
278  // Create first column, primary key
279  check = MySchemaOp->createAttribute( GROUP_ID,
280  TupleKey,
281  sizeof(GroupId) << 3,
282  1,
283  UnSigned,
284  MMBased,
285  NotNullAttribute );
286  if( check == -1 )
287  error_handler("createAttribute (group id)",
288  MySchemaTransaction->getNdbError(), 0);
289 
290  check = MySchemaOp->createAttribute( NDB_GROUP_NAME,
291  NoKey,
292  sizeof(char) << 3,
293  GROUP_NAME_LENGTH,
294  String,
295  MMBased,
296  NotNullAttribute );
297  if( check == -1 )
298  error_handler("createAttribute (group name)",
299  MySchemaTransaction->getNdbError(), 0);
300 
301 
302  check = MySchemaOp->createAttribute( GROUP_ALLOW_READ,
303  NoKey,
304  sizeof(Permission) << 3,
305  1,
306  String,
307  MMBased,
308  NotNullAttribute );
309  if( check == -1 )
310  error_handler("createAttribute (group read)",
311  MySchemaTransaction->getNdbError(), 0);
312 
313 
314  check = MySchemaOp->createAttribute( GROUP_ALLOW_INSERT,
315  NoKey,
316  sizeof(Permission) << 3,
317  1,
318  UnSigned,
319  MMBased,
320  NotNullAttribute );
321  if( check == -1 )
322  error_handler("createAttribute (group insert)",
323  MySchemaTransaction->getNdbError(), 0);
324 
325  check = MySchemaOp->createAttribute( GROUP_ALLOW_DELETE,
326  NoKey,
327  sizeof(Permission) << 3,
328  1,
329  UnSigned,
330  MMBased,
331  NotNullAttribute );
332  if( check == -1 )
333  error_handler("createAttribute (group delete)",
334  MySchemaTransaction->getNdbError(), 0);
335 
336  if( MySchemaTransaction->execute() == -1 ) {
337  error_handler("schemaTransaction->execute()",
338  MySchemaTransaction->getNdbError(), 0);
339  }
340  NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
341  return 0;
342 }
343 
344 int
345 create_table_subscriber(Ndb * pNdb){
346  int check;
347  NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
348  if( MySchemaTransaction == NULL )
349  error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
350 
351  NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
352  if( MySchemaOp == NULL )
353  error_handler("getNdbSchemaOp", MySchemaTransaction->getNdbError(), 0);
354 
355  // Create table
356  check = MySchemaOp->createTable( SUBSCRIBER_TABLE,
357  8, // Table size
358  TupleKey, // Key Type
359  1 // Nr of Pages
360  ,DistributionGroup,
361  6,
362  78,
363  80,
364  1,
365  useTableLogging
366  );
367  if( check == -1 )
368  error_handler("createTable", MySchemaTransaction->getNdbError(), 0);
369 
370  // Create first column, primary key
371  check = MySchemaOp->createAttribute
372  ( SUBSCRIBER_NUMBER,
373  TupleKey,
374  sizeof(char) << 3,
375  SUBSCRIBER_NUMBER_LENGTH,
376  String,
377  MMBased,
378  NotNullAttribute,
379  0,
380  0,
381  1,
382  16);
383  if( check == -1 )
384  error_handler("createAttribute (subscriber number)",
385  MySchemaTransaction->getNdbError(), 0);
386 
387  check = MySchemaOp->createAttribute( SUBSCRIBER_NAME,
388  NoKey,
389  sizeof(char) << 3,
390  SUBSCRIBER_NAME_LENGTH,
391  String,
392  MMBased,
393  NotNullAttribute );
394  if( check == -1 )
395  error_handler("createAttribute (subscriber name)",
396  MySchemaTransaction->getNdbError(), 0);
397 
398 
399  check = MySchemaOp->createAttribute( SUBSCRIBER_GROUP,
400  NoKey,
401  sizeof(GroupId) << 3,
402  1,
403  UnSigned,
404  MMBased,
405  NotNullAttribute );
406  if( check == -1 )
407  error_handler("createAttribute (subscriber_group)",
408  MySchemaTransaction->getNdbError(), 0);
409 
410 
411  check = MySchemaOp->createAttribute( SUBSCRIBER_LOCATION,
412  NoKey,
413  sizeof(Location) << 3,
414  1,
415  UnSigned,
416  MMBased,
417  NotNullAttribute );
418  if( check == -1 )
419  error_handler("createAttribute (server reads)",
420  MySchemaTransaction->getNdbError(), 0);
421 
422  check = MySchemaOp->createAttribute( SUBSCRIBER_SESSIONS,
423  NoKey,
424  sizeof(ActiveSessions) << 3,
425  1,
426  UnSigned,
427  MMBased,
428  NotNullAttribute );
429  if( check == -1 )
430  error_handler("createAttribute (subscriber_sessions)",
431  MySchemaTransaction->getNdbError(), 0);
432 
433  check = MySchemaOp->createAttribute( SUBSCRIBER_CHANGED_BY,
434  NoKey,
435  sizeof(char) << 3,
436  CHANGED_BY_LENGTH,
437  String,
438  MMBased,
439  NotNullAttribute );
440  if( check == -1 )
441  error_handler("createAttribute (subscriber_changed_by)",
442  MySchemaTransaction->getNdbError(), 0);
443 
444  check = MySchemaOp->createAttribute( SUBSCRIBER_CHANGED_TIME,
445  NoKey,
446  sizeof(char) << 3,
447  CHANGED_TIME_LENGTH,
448  String,
449  MMBased,
450  NotNullAttribute );
451  if( check == -1 )
452  error_handler("createAttribute (subscriber_changed_time)",
453  MySchemaTransaction->getNdbError(), 0);
454 
455  if( MySchemaTransaction->execute() == -1 ) {
456  error_handler("schemaTransaction->execute()",
457  MySchemaTransaction->getNdbError(), 0);
458  }
459  NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
460  return 0;
461 }
462 
463 int
464 create_table_session(Ndb * pNdb){
465  int check;
466  NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
467  if( MySchemaTransaction == NULL )
468  error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
469 
470  NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
471  if( MySchemaOp == NULL )
472  error_handler("getNdbSchemaOp",
473  MySchemaTransaction->getNdbError(), 0);
474 
475  // Create table
476  check = MySchemaOp->createTable( SESSION_TABLE,
477  8, // Table size
478  TupleKey, // Key Type
479  1 // Nr of Pages
480  ,DistributionGroup,
481  6,
482  78,
483  80,
484  1,
485  useTableLogging
486  );
487  if( check == -1 )
488  error_handler("createTable", MySchemaTransaction->getNdbError(), 0);
489 
490  check = MySchemaOp->createAttribute( SESSION_SUBSCRIBER,
491  TupleKey,
492  sizeof(char) << 3,
493  SUBSCRIBER_NUMBER_LENGTH,
494  String,
495  MMBased,
496  NotNullAttribute,
497  0,
498  0,
499  1,
500  16);
501  if( check == -1 )
502  error_handler("createAttribute (session_subscriber)",
503  MySchemaTransaction->getNdbError(), 0);
504 
505  // Create first column, primary key
506  check = MySchemaOp->createAttribute( SESSION_SERVER,
507  TupleKey,
508  sizeof(ServerId) << 3,
509  1,
510  UnSigned,
511  MMBased,
512  NotNullAttribute );
513  if( check == -1 )
514  error_handler("createAttribute (session_server)",
515  MySchemaTransaction->getNdbError(), 0);
516 
517 
518  check = MySchemaOp->createAttribute( SESSION_DATA,
519  NoKey,
520  sizeof(char) << 3,
521  SESSION_DETAILS_LENGTH,
522  String,
523  MMBased,
524  NotNullAttribute );
525  if( check == -1 )
526  error_handler("createAttribute (session_data)",
527  MySchemaTransaction->getNdbError(), 0);
528 
529  if( MySchemaTransaction->execute() == -1 ) {
530  error_handler("schemaTransaction->execute()",
531  MySchemaTransaction->getNdbError(), 0);
532  }
533  NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
534  return 0;
535 }
536 
537 void
538 create_table(const char * name, int (* function)(Ndb * pNdb), Ndb* pNdb){
539  printf("creating table %s...", name);
540  if(pNdb->getDictionary()->getTable(name) != 0){
541  printf(" it already exists\n");
542  return;
543  } else {
544  printf("\n");
545  }
546  function(pNdb);
547  printf("creating table %s... done\n", name);
548 }
549 
550 static int dbCreate(Ndb * pNdb)
551 {
552  create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNdb);
553  create_table(GROUP_TABLE , create_table_group, pNdb);
554  create_table(SESSION_TABLE , create_table_session, pNdb);
555  create_table(SERVER_TABLE , create_table_server, pNdb);
556  return 0;
557 }
558 
559 #ifndef NDB_WIN32
560 #include <unistd.h>
561 #endif
562 
563 UserHandle*
564 userDbConnect(uint32 createDb, const char *dbName)
565 {
567  if(con->connect(12, 5, 1) != 0)
568  {
569  ndbout << "Unable to connect to management server." << endl;
570  return 0;
571  }
572  if (con->wait_until_ready(30,0) < 0)
573  {
574  ndbout << "Cluster nodes not ready in 30 seconds." << endl;
575  return 0;
576  }
577 
578  Ndb * pNdb = new Ndb(con, dbName);
579 
580  //printf("Initializing...\n");
581  pNdb->init();
582 
583  //printf("Waiting...");
584  while(pNdb->waitUntilReady() != 0){
585  //printf("...");
586  }
587  // printf("done\n");
588 
589  if( createDb )
590  dbCreate(pNdb);
591 
592 
593  UserHandle * uh = new UserHandle;
594  uh->pNCC = con;
595  uh->pNDB = pNdb;
596  uh->pCurrTrans = 0;
597 
598  return uh;
599 }
600 
601 void userDbDisconnect(UserHandle *uh)
602 {
603  delete uh;
604 }
605 
606 int userDbInsertServer(UserHandle *uh,
607  ServerId serverId,
608  SubscriberSuffix suffix,
609  ServerName name)
610 {
611  int check;
612 
613  uint32 noOfRead = 0;
614  uint32 noOfInsert = 0;
615  uint32 noOfDelete = 0;
616 
617  NdbConnection * MyTransaction = 0;
618  if(uh->pCurrTrans != 0){
619  MyTransaction = uh->pCurrTrans;
620  } else {
621  uh->pCurrTrans = MyTransaction = uh->pNDB->startTransaction();
622  }
623  if (MyTransaction == NULL)
624  error_handler("startTranscation", uh->pNDB->getNdbError(), 0);
625 
626  NdbOperation *MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
627  CHECK_NULL(MyOperation, "getNdbOperation", MyTransaction);
628 
629  check = MyOperation->insertTuple();
630  CHECK_MINUS_ONE(check, "insert tuple", MyTransaction);
631 
632  check = MyOperation->equal(SERVER_ID, (char*)&serverId);
633  CHECK_MINUS_ONE(check, "setValue id", MyTransaction);
634 
635  check = MyOperation->setValue(SERVER_SUBSCRIBER_SUFFIX, suffix);
636  CHECK_MINUS_ONE(check, "setValue suffix", MyTransaction);
637 
638  check = MyOperation->setValue(SERVER_NAME, name);
639  CHECK_MINUS_ONE(check, "setValue name", MyTransaction);
640 
641  check = MyOperation->setValue(SERVER_READS, (char*)&noOfRead);
642  CHECK_MINUS_ONE(check, "setValue reads", MyTransaction);
643 
644  check = MyOperation->setValue(SERVER_INSERTS, (char*)&noOfInsert);
645  CHECK_MINUS_ONE(check, "setValue inserts", MyTransaction);
646 
647  check = MyOperation->setValue(SERVER_DELETES, (char*)&noOfDelete);
648  CHECK_MINUS_ONE(check, "setValue deletes", MyTransaction);
649 
650  return 0;
651 }
652 
653 int userDbInsertSubscriber(UserHandle *uh,
654  SubscriberNumber number,
655  uint32 groupId,
656  SubscriberName name)
657 {
658  int check;
659  uint32 activeSessions = 0;
660  Location l = 0;
661  ChangedBy changedBy;
662  ChangedTime changedTime;
663  BaseString::snprintf(changedBy, sizeof(changedBy), "ChangedBy");
664  BaseString::snprintf(changedTime, sizeof(changedTime), "ChangedTime");
665 
666  NdbConnection * MyTransaction = 0;
667  if(uh->pCurrTrans != 0){
668  MyTransaction = uh->pCurrTrans;
669  } else {
670  uh->pCurrTrans = MyTransaction = uh->pNDB->startTransaction();
671  }
672  if (MyTransaction == NULL)
673  error_handler("startTranscation", uh->pNDB->getNdbError(), 0);
674 
675  NdbOperation *MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
676  CHECK_NULL(MyOperation, "getNdbOperation", MyTransaction);
677 
678  check = MyOperation->insertTuple();
679  CHECK_MINUS_ONE(check, "insertTuple", MyTransaction);
680 
681  check = MyOperation->equal(SUBSCRIBER_NUMBER, number);
682  CHECK_MINUS_ONE(check, "equal", MyTransaction);
683 
684  check = MyOperation->setValue(SUBSCRIBER_NAME, name);
685  CHECK_MINUS_ONE(check, "setValue name", MyTransaction);
686 
687  check = MyOperation->setValue(SUBSCRIBER_GROUP, (char*)&groupId);
688  CHECK_MINUS_ONE(check, "setValue group", MyTransaction);
689 
690  check = MyOperation->setValue(SUBSCRIBER_LOCATION, (char*)&l);
691  CHECK_MINUS_ONE(check, "setValue location", MyTransaction);
692 
693  check = MyOperation->setValue(SUBSCRIBER_SESSIONS, (char*)&activeSessions);
694  CHECK_MINUS_ONE(check, "setValue sessions", MyTransaction);
695 
696  check = MyOperation->setValue(SUBSCRIBER_CHANGED_BY, changedBy);
697  CHECK_MINUS_ONE(check, "setValue changedBy", MyTransaction);
698 
699  check = MyOperation->setValue(SUBSCRIBER_CHANGED_TIME, changedTime);
700  CHECK_MINUS_ONE(check, "setValue changedTime", MyTransaction);
701 
702  return 0;
703 }
704 
705 int userDbInsertGroup(UserHandle *uh,
706  GroupId groupId,
707  GroupName name,
708  Permission allowRead,
709  Permission allowInsert,
710  Permission allowDelete)
711 {
712  int check;
713 
714  NdbConnection * MyTransaction = 0;
715  if(uh->pCurrTrans != 0){
716  MyTransaction = uh->pCurrTrans;
717  } else {
718  uh->pCurrTrans = MyTransaction = uh->pNDB->startTransaction();
719  }
720  if (MyTransaction == NULL)
721  error_handler("startTranscation", uh->pNDB->getNdbError(), 0);
722 
723  NdbOperation *MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
724  CHECK_NULL(MyOperation, "getNdbOperation", MyTransaction);
725 
726  check = MyOperation->insertTuple();
727  CHECK_MINUS_ONE(check, "insertTuple", MyTransaction);
728 
729  check = MyOperation->equal(GROUP_ID, (char*)&groupId);
730  CHECK_MINUS_ONE(check, "equal", MyTransaction);
731 
732  check = MyOperation->setValue(NDB_GROUP_NAME, name);
733  CHECK_MINUS_ONE(check, "setValue name", MyTransaction);
734 
735  check = MyOperation->setValue(GROUP_ALLOW_READ, (char*)&allowRead);
736  CHECK_MINUS_ONE(check, "setValue allowRead", MyTransaction);
737 
738  check = MyOperation->setValue(GROUP_ALLOW_INSERT, (char*)&allowInsert);
739  CHECK_MINUS_ONE(check, "setValue allowInsert", MyTransaction);
740 
741  check = MyOperation->setValue(GROUP_ALLOW_DELETE, (char*)&allowDelete);
742  CHECK_MINUS_ONE(check, "setValue allowDelete", MyTransaction);
743 
744  return 0;
745 }
746