21 #include "user_populate.h"
24 #include <ndb_global.h>
27 #include "ndb_schema.hpp"
28 #include "ndb_error.hpp"
31 insert_subscriber(
void * obj,
32 SubscriberNumber number,
36 ActiveSessions activeSessions,
38 ChangedTime changedTime){
43 if (MyTransaction == NULL)
44 error_handler(
"startTranscation", pNDB->getNdbErrorString(), 0);
47 CHECK_NULL(MyOperation,
"getNdbOperation", MyTransaction);
49 check = MyOperation->insertTuple();
50 CHECK_MINUS_ONE(check,
"insertTuple", MyTransaction);
52 check = MyOperation->equal(SUBSCRIBER_NUMBER, number);
53 CHECK_MINUS_ONE(check,
"equal", MyTransaction);
55 check = MyOperation->setValue(SUBSCRIBER_NAME, name);
56 CHECK_MINUS_ONE(check,
"setValue name", MyTransaction);
58 check = MyOperation->setValue(SUBSCRIBER_GROUP, (
char*)&groupId);
59 CHECK_MINUS_ONE(check,
"setValue group", MyTransaction);
61 check = MyOperation->setValue(SUBSCRIBER_LOCATION, (
char*)&l);
62 CHECK_MINUS_ONE(check,
"setValue location", MyTransaction);
64 check = MyOperation->setValue(SUBSCRIBER_SESSIONS, (
char*)&activeSessions);
65 CHECK_MINUS_ONE(check,
"setValue sessions", MyTransaction);
67 check = MyOperation->setValue(SUBSCRIBER_CHANGED_BY, changedBy);
68 CHECK_MINUS_ONE(check,
"setValue changedBy", MyTransaction);
70 check = MyOperation->setValue(SUBSCRIBER_CHANGED_TIME, changedTime);
71 CHECK_MINUS_ONE(check,
"setValue changedTime", MyTransaction);
73 check = MyTransaction->
execute( Commit );
74 CHECK_MINUS_ONE(check,
"commit", MyTransaction);
81 insert_server(
void * obj,
83 SubscriberSuffix suffix,
92 if (MyTransaction == NULL)
93 error_handler(
"startTranscation", pNDB->getNdbErrorString(), 0);
96 CHECK_NULL(MyOperation,
"getNdbOperation", MyTransaction);
98 check = MyOperation->insertTuple();
99 CHECK_MINUS_ONE(check,
"insert tuple", MyTransaction);
101 check = MyOperation->equal(SERVER_ID, (
char*)&serverId);
102 CHECK_MINUS_ONE(check,
"setValue id", MyTransaction);
104 check = MyOperation->setValue(SERVER_SUBSCRIBER_SUFFIX, suffix);
105 CHECK_MINUS_ONE(check,
"setValue suffix", MyTransaction);
107 check = MyOperation->setValue(SERVER_NAME, name);
108 CHECK_MINUS_ONE(check,
"setValue name", MyTransaction);
110 check = MyOperation->setValue(SERVER_READS, (
char*)&noOfRead);
111 CHECK_MINUS_ONE(check,
"setValue reads", MyTransaction);
113 check = MyOperation->setValue(SERVER_INSERTS, (
char*)&noOfInsert);
114 CHECK_MINUS_ONE(check,
"setValue inserts", MyTransaction);
116 check = MyOperation->setValue(SERVER_DELETES, (
char*)&noOfDelete);
117 CHECK_MINUS_ONE(check,
"setValue deletes", MyTransaction);
119 check = MyTransaction->
execute( Commit );
120 CHECK_MINUS_ONE(check,
"commit", MyTransaction);
127 insert_group(
void * obj,
130 Permission allowRead,
131 Permission allowInsert,
132 Permission allowDelete){
137 if (MyTransaction == NULL)
138 error_handler(
"startTranscation", pNDB->getNdbErrorString(), 0);
141 CHECK_NULL(MyOperation,
"getNdbOperation", MyTransaction);
143 check = MyOperation->insertTuple();
144 CHECK_MINUS_ONE(check,
"insertTuple", MyTransaction);
146 check = MyOperation->equal(GROUP_ID, (
char*)&groupId);
147 CHECK_MINUS_ONE(check,
"equal", MyTransaction);
149 check = MyOperation->setValue(GROUP_NAME, name);
150 CHECK_MINUS_ONE(check,
"setValue name", MyTransaction);
152 check = MyOperation->setValue(GROUP_ALLOW_READ, (
char*)&allowRead);
153 CHECK_MINUS_ONE(check,
"setValue allowRead", MyTransaction);
155 check = MyOperation->setValue(GROUP_ALLOW_INSERT, (
char*)&allowInsert);
156 CHECK_MINUS_ONE(check,
"setValue allowInsert", MyTransaction);
158 check = MyOperation->setValue(GROUP_ALLOW_DELETE, (
char*)&allowDelete);
159 CHECK_MINUS_ONE(check,
"setValue allowDelete", MyTransaction);
161 check = MyTransaction->
execute( Commit );
162 CHECK_MINUS_ONE(check,
"commit", MyTransaction);