37 {
"street_name",
DBA_CHAR, PCN_SIZE_OF(
Address, StreetName ), PCN_FALSE },
38 {
"street_no",
DBA_INT, PCN_SIZE_OF(
Address, StreetNo ), PCN_FALSE },
41 static const int NbCol = 6;
66 static const int Rows = 6;
70 { 1242,
"Lonesome Street", 12,
"Crime Town" },
71 { 123,
"Pistol Road", 13,
"Fort Mount" },
72 { 456,
"Banking Blv.", 43,
"Las Vegas" },
73 { 8976,
"ChancylleZee", 54,
"Paris" },
74 { 1122,
"Lucky", 111,
"Wild West" },
75 { 3211,
"Parlament St.", 11,
"Stockholm" }
90 { 1242,
"Joe",
"Dalton" , &ADD_TABLE_DATA[0] },
91 { 123,
"Lucky",
"Luke" , &ADD_TABLE_DATA[1] },
92 { 456,
"Averell",
"Dalton" , &ADD_TABLE_DATA[2] },
93 { 8976,
"Gaston",
"Lagaffe", &ADD_TABLE_DATA[3] },
94 { 1122,
"Jolly",
"Jumper" , &ADD_TABLE_DATA[4] },
95 { 3211,
"Leffe",
"Pagrotsky", &ADD_TABLE_DATA[5] },
100 { 1242,
"",
"", &ADD_TABLE_DATA_READ[0] },
101 { 123,
"",
"", &ADD_TABLE_DATA_READ[1] },
102 { 456,
"",
"", &ADD_TABLE_DATA_READ[2] },
103 { 8976,
"",
"", &ADD_TABLE_DATA_READ[3] },
104 { 1122,
"",
"", &ADD_TABLE_DATA_READ[4] },
105 { 3211,
"",
"", &ADD_TABLE_DATA_READ[5] }
108 static const char TABLE[] =
"employee_address";
114 ndbout <<
"Opening database" << endl;
117 ndbout <<
"Creating tables" << endl;
120 ndbout <<
"Checking for table existance" << endl;
126 CreateBindings(
void){
127 ndbout <<
"Creating bindings" << endl;
147 ndbout <<
"Testing basic array operations" << endl;
151 NdbSleep_SecSleep(1);
153 NdbSleep_SecSleep(1);
154 CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
155 CompareRows(ADD_TABLE_DATA, Rows-2, ADD_TABLE_DATA_READ);
158 AlterRows (EMP_TABLE_DATA, Rows-2);
159 AlterRows (ADD_TABLE_DATA, Rows-2);
161 NdbSleep_SecSleep(1);
163 NdbSleep_SecSleep(1);
164 CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
165 CompareRows(ADD_TABLE_DATA, Rows-2, ADD_TABLE_DATA_READ);
168 AlterRows (EMP_TABLE_DATA, Rows);
169 AlterRows (ADD_TABLE_DATA, Rows);
171 NdbSleep_SecSleep(1);
173 NdbSleep_SecSleep(1);
174 CompareRows(EMP_TABLE_DATA, Rows, EMP_TABLE_DATA_READ);
175 CompareRows(ADD_TABLE_DATA, Rows, ADD_TABLE_DATA_READ);
179 NdbSleep_SecSleep(1);
184 ndbout <<
"Testing array of pointer operations" << endl;
187 for(
int i = 0;
i<Rows;
i++){
188 EmpData[
i] = &EMP_TABLE_DATA[
i];
189 EmpDataRead[
i] = &EMP_TABLE_DATA_READ[
i];
192 void *
const * EMP_TABLE_DATA2 = (
void *
const *)EmpData;
193 void *
const * EMP_TABLE_DATA_READ2 = (
void *
const *)EmpDataRead;
197 NdbSleep_SecSleep(1);
198 DBA_ReadRows (Bind, EMP_TABLE_DATA_READ2, Rows-2, readCallback);
199 NdbSleep_SecSleep(1);
200 CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
201 CompareRows(ADD_TABLE_DATA, Rows-2, ADD_TABLE_DATA_READ);
204 AlterRows (ADD_TABLE_DATA, Rows-2);
205 AlterRows (EMP_TABLE_DATA, Rows-2);
207 NdbSleep_SecSleep(1);
208 DBA_ReadRows (Bind, EMP_TABLE_DATA_READ2, Rows-2, readCallback);
209 NdbSleep_SecSleep(1);
210 CompareRows(EMP_TABLE_DATA, Rows-2, EMP_TABLE_DATA_READ);
211 CompareRows(ADD_TABLE_DATA, Rows-2, ADD_TABLE_DATA_READ);
214 AlterRows (ADD_TABLE_DATA, Rows);
215 AlterRows (EMP_TABLE_DATA, Rows);
217 NdbSleep_SecSleep(1);
218 DBA_ReadRows (Bind, EMP_TABLE_DATA_READ2, Rows, readCallback);
219 NdbSleep_SecSleep(1);
220 CompareRows(EMP_TABLE_DATA, Rows, EMP_TABLE_DATA_READ);
221 CompareRows(ADD_TABLE_DATA, Rows, ADD_TABLE_DATA_READ);
225 NdbSleep_SecSleep(1);
229 NDB_COMMAND(newton_pb,
"newton_pb",
230 "newton_pb",
"newton_pb", 65535){
247 callbackStatusCheck(
DBA_Error_t status,
const char* operation) {
248 ndbout_c(
"%s: %d", operation, status);
252 callbackStatusCheck(s,
"insert");
255 callbackStatusCheck(s,
"delete");
258 callbackStatusCheck(s,
"update");
261 callbackStatusCheck(s,
"read");
264 callbackStatusCheck(s,
"write");