List:Cluster« Previous MessageNext Message »
From:George Neill Date:January 19 2012 11:16pm
Subject:Re: Blob and NdbRecord
View as plain text  

On Thu, Jan 19, 2012 at 3:59 PM, Craig L Russell

> Hi George,
> On Jan 19, 2012, at 1:41 PM, George Neill wrote:
>  Hi Folks,
>> I am trying to understand the NDB blob API.  When using
>> transaction->readTuple(), the address of the blob pointer is written to
>> the
>> ndb record.  After looking at the ndb code, this does NOT appear to happen
>> with insertTuple()/updateTuple() calls.  I am just starting to dig in to
>> the NDB code base and I am trying to understand why a blob pointer is not
>> written/allocated in to the blob stream in these situations.  Or maybe the
>> question is better asked as, Why is the blob pointer written only when
>> using readTuple() ...   Is there someone on the list who might have
>> background on this subject and wouldn't mind explaining it to me!?
> The way I understand it, with insertTuple you allocate space in the buffer
> for the blob header pointer before you call insertTuple. After that, you
> can call getBlobHandle on the NdbOperation that is returned, you get a
> brand new blob handle, and you can write to the blob. What you are doing is
> defining one operation with insertTuple and other (set of) operations when
> you operate on the blob handle.

I have allocated a buffer the size of the record (plus it's null bytes at
the end) and handed this to the insertTuple() function.  My understanding
thus far ... at a minimum, the "key" parts have to be written to the record
prior to calling insertTuple().   After insertTuple() is called, I can then
call operation->getBlobHandle().  I have done this and it DOES work.

Here are the steps I am taking right now.

build specification



build the column insert mask

copy data to the record  (must include key columns, but not blob)

operation = transaction->insertTuple()

call blob = operation->getBlobHandle(col)
call blob -> setValue()



I just don't know  enough about the API yet to know all of my options
here.  Still learning!  I'd like to be able to merge the blob operations
and the "copy data to the record" and execute them after the insertTuple()
...  so any insight would be helpful.


Blob and NdbRecordGeorge Neill19 Jan
  • Re: Blob and NdbRecordCraig L Russell19 Jan
    • Re: Blob and NdbRecordGeorge Neill19 Jan
      • Re: Blob and NdbRecordCraig L Russell20 Jan