Skip navigation links

MySQL Forums :: Cluster :: NdbApi setValue does not support decimal type?


Advanced Search

Re: NdbApi setValue does not support decimal type?
Posted by: Jacky Huang ()
Date: June 12, 2012 08:34PM

Hi Bernhard Ocklin,

My question is how to use NDB API to insert a value into an attribute of decimal data type in database, this case likes follow.

1,create a table with decimal data type, please note TAX attribute.
create table IN_CUSTOMER
(
CUSTOMERID bigint not null,
TAX decimal(18,4) null,
primary key (CUSTOMERID)
)
ENGINE=NDB
;

2, use NDB Api to insert a tuple to above table.
...
const NdbDictionary::Table *myTable= myDict->getTable("IN_CUSTOMER");
NdbTransaction *myTransaction= myNdb->startTransaction();
NdbOperation *myOperation= myTransaction->getNdbOperation(myTable);
myOperation->insertTuple();
myOperation->equal("CUSTOMERID", 10000);
myOperation->setValue("TAX", 1.1234);
if (myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError());
myNdb->closeTransaction(myTransaction);
...

3, there is a strange thing happened in database, the value of attribute "TAX" is "0" whatever I inserted with NDB API, it should be 1.1234 in this case.

I have read what you reminded me in DataTypeHandler.cc & decimal_utils.hpp, but I don't know how to implement; and I have not use something in memcache code yet.

Options: ReplyQuote


Subject Views Written By Posted
NdbApi setValue does not support decimal type? 981 Jacky Huang 06/08/2012 02:13AM
Re: NdbApi setValue does not support decimal type? 542 Bernhard Ocklin 06/08/2012 03:09AM
Re: NdbApi setValue does not support decimal type? 456 Jacky Huang 06/08/2012 03:57AM
Re: NdbApi setValue does not support decimal type? 412 Jacky Huang 06/10/2012 08:28PM
Re: NdbApi setValue does not support decimal type? 468 Bernhard Ocklin 06/11/2012 07:33AM
Re: NdbApi setValue does not support decimal type? 492 Jacky Huang 06/12/2012 08:34PM
Re: NdbApi setValue does not support decimal type? 499 Jacky Huang 06/18/2012 01:09AM
Re: NdbApi setValue does not support decimal type? 429 Jacky Huang 06/15/2012 12:16AM
Re: NdbApi setValue does not support decimal type? 534 Bernhard Ocklin 06/15/2012 01:38AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.