MCPcopy Create free account
hub / github.com/Shannon-Data/ShannonBase / ndbapiInsert

Method ndbapiInsert

storage/ndb/test/crund/src/cpp/NdbapiTwsDriver.cpp:329–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void NdbapiTwsDriver::ndbapiInsert(int c0) {
330 // get an insert operation for the table
331 NdbOperation *op = tx->getNdbOperation(model->table_t0);
332 if (op == NULL) ABORT_NDB_ERROR(tx->getNdbError());
333 if (op->insertTuple() != 0) ABORT_NDB_ERROR(tx->getNdbError());
334
335 // values
336 Uint32 i = c0;
337 const int maxlen = 256;
338 char str[maxlen];
339 snprintf(str, maxlen, "%d", i);
340
341 // set values; key attribute needs to be set first
342 ndbapiToBuffer1blp(bb_pos, str, model->width_c0);
343 if (op->equal(model->attr_c0, bb_pos) != 0) // key
344 ABORT_NDB_ERROR(tx->getNdbError());
345 bb_pos += model->width_c0;
346
347 ndbapiToBuffer1blp(bb_pos, str, model->width_c1);
348 if (op->setValue(model->attr_c1, bb_pos) != 0)
349 ABORT_NDB_ERROR(tx->getNdbError());
350 bb_pos += model->width_c1;
351
352 if (op->setValue(model->attr_c2, i) != 0) ABORT_NDB_ERROR(tx->getNdbError());
353 bb_pos += model->width_c2;
354
355 if (op->setValue(model->attr_c3, i) != 0) ABORT_NDB_ERROR(tx->getNdbError());
356 bb_pos += model->width_c3;
357
358 if (op->setValue(model->attr_c4, (char *)NULL) != 0)
359 ABORT_NDB_ERROR(tx->getNdbError());
360 bb_pos += model->width_c4;
361
362 ndbapiToBuffer1blp(bb_pos, str, model->width_c5);
363 if (op->setValue(model->attr_c5, bb_pos) != 0)
364 ABORT_NDB_ERROR(tx->getNdbError());
365 bb_pos += model->width_c5;
366
367 ndbapiToBuffer1blp(bb_pos, str, model->width_c6);
368 if (op->setValue(model->attr_c6, bb_pos) != 0)
369 ABORT_NDB_ERROR(tx->getNdbError());
370 bb_pos += model->width_c6;
371
372 ndbapiToBuffer1blp(bb_pos, str, model->width_c7);
373 if (op->setValue(model->attr_c7, bb_pos) != 0)
374 ABORT_NDB_ERROR(tx->getNdbError());
375 bb_pos += model->width_c7;
376
377 ndbapiToBuffer1blp(bb_pos, str, model->width_c8);
378 if (op->setValue(model->attr_c8, bb_pos) != 0)
379 ABORT_NDB_ERROR(tx->getNdbError());
380 bb_pos += model->width_c8;
381
382 if (op->setValue(model->attr_c9, (char *)NULL) != 0)
383 ABORT_NDB_ERROR(tx->getNdbError());
384 bb_pos += model->width_c9;
385
386 if (op->setValue(model->attr_c10, (char *)NULL) != 0)

Callers

nothing calls this directly

Calls 6

snprintfFunction · 0.85
getNdbOperationMethod · 0.65
getNdbErrorMethod · 0.65
equalMethod · 0.65
setValueMethod · 0.65
insertTupleMethod · 0.45

Tested by

no test coverage detected