protected void ins(TableConst table, int from, int to,
boolean setAttrs, boolean batch) {
beginTransaction();
for (int i = from; i <= to; i++) {
// get an insert operation for the table
NdbOperation op = tx.getNdbOperation(table);
if (op == null)
throw new RuntimeException(toStr(tx.getNdbError()));
if (op.insertTuple() != 0)
throw new RuntimeException(toStr(tx.getNdbError()));
// set values; key attribute needs to be set first
if (op.equal(model.attr_id, i) != 0)
throw new RuntimeException(toStr(tx.getNdbError()));
if (setAttrs) {
if (op.setValue(model.attr_cint, -i) != 0)
throw new RuntimeException(toStr(tx.getNdbError()));
if (op.setValue(model.attr_clong, (long)-i) != 0)
throw new RuntimeException(toStr(tx.getNdbError()));
if (op.setValue(model.attr_cfloat, (float)-i) != 0)
throw new RuntimeException(toStr(tx.getNdbError()));
if (op.setValue(model.attr_cdouble, (double)-i) != 0)
throw new RuntimeException(toStr(tx.getNdbError()));
}
// execute the operation now if in non-batching mode
if (!batch)