void DBOperationHelper_VO(Handle<Object> spec, KeyOperation & op) { DEBUG_MARKER(UDEB_DETAIL); Local<Value> v; Local<Object> o; Local<Object> valueObj; v = spec->Get(HELPER_VALUE_OBJECT); valueObj = v->ToObject(); NdbRecordObject * nro = unwrapPointer<NdbRecordObject *>(valueObj); /* Set the key record and key buffer from the helper spec */ setKeysInOp(spec, op); /* Set the row record, row buffer, and mask from the VO */ op.row_record = nro->getRecord(); op.row_buffer = nro->getBuffer(); /* A persist operation must write all columns. A save operation must write all columns only if the PK has changed. Other operations only write columns that have changed since being read. */ if(op.opcode == 2) op.setRowMask(op.row_record->getAllColumnMask()); else if(op.opcode == 8 && (nro->getMaskValue() & op.row_record->getPkColumnMask())) op.setRowMask(op.row_record->getAllColumnMask()); else op.setRowMask(nro->getMaskValue()); op.nblobs = nro->createBlobWriteHandles(op); DEBUG_PRINT(" VO %s -- mask: %u lobs: %d", op.getOperationName(), op.u.maskvalue, op.nblobs); nro->resetMask(); }
void DBOperationHelper_NonVO(Handle<Object> spec, KeyOperation & op) { HandleScope scope; Local<Value> v; Local<Object> o; setKeysInOp(spec, op); v = spec->Get(HELPER_ROW_BUFFER); if(! v->IsNull()) { o = v->ToObject(); op.row_buffer = V8BINDER_UNWRAP_BUFFER(o); } v = spec->Get(HELPER_ROW_RECORD); if(! v->IsNull()) { o = v->ToObject(); const Record * record = unwrapPointer<const Record *>(o); op.row_record = record; v = spec->Get(HELPER_BLOBS); if(v->IsObject()) { if(op.opcode == 1) { op.nblobs = op.createBlobReadHandles(record); } else { op.nblobs = op.createBlobWriteHandles(v->ToObject(), record); } } } v = spec->Get(HELPER_LOCK_MODE); if(! v->IsNull()) { int intLockMode = v->Int32Value(); op.lmode = static_cast<NdbOperation::LockMode>(intLockMode); } v = spec->Get(HELPER_COLUMN_MASK); if(! v->IsNull()) { Array *maskArray = Array::Cast(*v); for(unsigned int m = 0 ; m < maskArray->Length() ; m++) { Local<Value> colId = maskArray->Get(m); op.useColumn(colId->Int32Value()); } } DEBUG_PRINT("Non-VO %s -- mask: %u lobs: %d", op.getOperationName(), op.u.maskvalue, op.nblobs); }