List:NDB Connectors« Previous MessageNext Message »
From:Frazer Clement Date:March 1 2009 9:22pm
Subject:Re: what's the reason for problem "Tuple did not exist"?
View as plain text  
Hi Tarbin,
  On closer inspection, I think that you *can* store and retrieve BLOB 
data using NDB/Bindings by using the NdbBlob::readData() and 
NdbBlob::writeData() APIs rather than the NdbBlob::getValue() and 
NdbBlob::setValue() APIs.
  The readData() and writeData() APIs can only be used when the Blob is 
'Active'.  That is, they can only be used after the original operation 
has been execute(NoCommit)ed and before the containing transaction is 
execute(Commit)ed.
  If you can deal with this limitation then you can read and write 
Blob/Text data via NDB/Bindings.
Sorry for the confusion,
Frazer
 

tarbin jiang wrote:
> Farzer,
>    can we work around this bug now? If this problem can not be 
> resolved, it means we can not use NDB-Binding in TEXT/BLOB type 
> database. right?
> thanks from tarbin
>
> > Date: Tue, 3 Feb 2009 09:42:24 +0000
> > From: Frazer.Clement@stripped
> > Subject: Re: what's the reason for problem "Tuple did not exist"?
> > To: tarbin@stripped
> > CC: ndb-connectors@stripped
> >
> > Hi Tarbin,
> > Thanks for sending more details.
> > I looked at the NDB/Bindings implementation of Blob handling yesterday
> > and believe it has some bugs which may mean that :
> > 1) Blob/Text data written in via NDB/Bindings may not be correctly
> > copied from the supplied buffer
> > 2) Blob/Text data read back via NDB/Bindings may not be correctly
> > copied to the user's supplied buffer.
> > This needs to be fixed in the NDB/Bindings code before you can
> > succesfully use BLOB and TEXT column types.
> > I'm afraid that I don't know right now when that will happen.
> > Frazer
> >
> > tarbin jiang wrote:
> > > Frazer,
> > > thanks for you! r response.
> > > I did use BLOB type to handle TEXT type column.
> > > pop error code:
> > > / String columnName = "column2";//column2 type is "TEXT"/
> > > / String paraValue = "";/
> > > / String tableName = "MyTable";/
> > > / NdbTransaction trans = ndb.startTransaction();/
> > > / NdbOperation op = trans.getInsertOperation(tableName);/
> > > / ....../
> > > / //get content from a xml file and set to paraValue/
> > > / ......./
> > > / NdbBlob text;
> > > text = op.getBlobHandle(columnName);
> > > text.setValue(paraValue.getBytes());/
> > > / .... /
> > > / //set other column values/
> > > / ...../
> > > / ret = trans.execute(ExecType.Commit,
> > > AbortOption.AbortOnError,true);/
> > > / trans.close();/
> > >
> > > no error code:
> > > / String columnName = "column2";//column2 type is "TEXT"/
> > > / String p! araValue = "";/
> > > / String tableName = "MyTable";/
> > > / NdbTransaction trans = ndb.startTransaction();/
> > > / NdbOperation op = trans.getInsertOperation(tableName);/
> > > / ....../
> > > / //set a normal string such as "abcdefg" to paraValue/
> > > / ......./
> > > / NdbBlob text;
> > > text = op.getBlobHandle(columnName);
> > > text.setValue(paraValue.getBytes());/
> > > / .... /
> > > / //set other column values/
> > > / ...../
> > > / ret = trans.execute(ExecType.Commit,
> > > AbortOption.AbortOnError,true);/
> > > / trans.close();/
> > > //
> > > Thanks.
> > > tarbin
> > >
> > > > Date: Mon, 2 Feb 2009 11:18:24 +0000
> > > > From: Frazer.Clement@stripped
> > > > Subject: Re: what's the reason for problem "Tuple did not exist"?
> > > > To: tarbin@stripped
> > > > CC: ndb-connectors@stripped
> > > >
> > > > Hi Tarbin,
> >! ; > > Can you explain a bit further what you are doing?
> > > > FYI : TEXT *is* a BLOB with a character set. So you must use the 
> BLOB
> > > > API to read/write TEXT columns. You *must not* use the normal
> > > > setValue/getValue API for TEXT columns.
> > > > Perhaps you could describe what does and does not work in terms of
> > > > schemas, your code and the content and length of the data you 
> are using.
> > > > Frazer
> > > >
> > > > tarbin jiang wrote:
> > > > > all,
> > > > > when I insert a record which including a TEXT type column, it
> > > returns error:
> > > > > com.mysql.cluster.ndbj.NdbApiPermanentException: Tuple did not 
> exist.
> > > > > I found that if I set the TEXT type column as a formal string,
> it
> > > works without error.
> > > > > but if I set the Text type column as a xml file, the error po!
> ps.
> > > > > The procedure of reading xml file is no pro blem. And I used
> > > NDBBlob type to handle text type.
> > > > >
> > > > > insertOperation.setValue(xmlFile.bytes())
> > > > >
> > > > > can anybody help me?
> > > > > thanks from tarbin
> > > > >
> > > > >
> _________________________________________________________________
> > > > > News, entertainment and everything you care about at Live.com. 
> Get
> > > it now!
> > > > > http://www.live.com/getstarted.aspx
> > > > >
> > > > >
> > > >
> > > > --
> > > > Frazer Clement, Software Engineer, MySQL Cluster
> > > > Sun Microsystems - www.mysql.com
> > > > Office: Reading, UK
> > > >
> > > > Are you MySQL certified? www.mysql.com/certification
> > > >
> > > >
> > > > --
> > > > MySQL NDB Connectors Mailing List
> &g! t; > > For list archives: http://lists.mysql.com/ndb-connectors
> > > > To unsubscribe:
> > > http://lists.mysql.com/ndb-connectors?unsub=1
> > > >
> > >
> > >
> > > 
> ------------------------------------------------------------------------
> > > What can you do with the new Windows Live? Find out
> > > <http://www.microsoft.com/windows/windowslive/default.aspx>
> >
> > --
> > Frazer Clement, Software Engineer, MySQL Cluster
> > Sun Microsystems - www.mysql.com
> > Office: Reading, UK
> >
> > Are you MySQL certified? www.mysql.com/certification
> >
>
>
> ------------------------------------------------------------------------
> See all the ways you can stay connected to friends and family 
> <http://www.microsoft.com/windows/windowslive/default.aspx>

-- 
Frazer Clement, Software Engineer, MySQL Cluster 
Sun Microsystems - www.mysql.com
Office: Reading, UK

Are you MySQL certified?  www.mysql.com/certification

Thread
what's the reason for problem "Tuple did not exist"?tarbin jiang2 Feb
  • Re: what's the reason for problem "Tuple did not exist"?Frazer Clement2 Feb
    • RE: what's the reason for problem "Tuple did not exist"?tarbin jiang3 Feb
      • Re: what's the reason for problem "Tuple did not exist"?Frazer Clement3 Feb
        • RE: what's the reason for problem "Tuple did not exist"?tarbin jiang4 Feb
          • Re: what's the reason for problem "Tuple did not exist"?Frazer Clement4 Feb
          • Re: what's the reason for problem "Tuple did not exist"?Frazer Clement1 Mar