NdbApi setValue does not support decimal type?
Hi all,
I set the a colummn type as 'decimal(18,4)' in a table structure. When I use Ndb Api NdbOperation::setValue(const char* anAttrName, double aPar) to insert a value(for example: 3.14 or any value) to database, but the value showed from database is 0.
I tried to alter the column type to double, it worked correct. So I doubt setvalue does not support decimal type ??
Please help me if you know something, thanks.
Code:
NdbOperation *operation;
...
NdbTransaction *myTransaction= ndb->startTransaction();
if (myTransaction == NULL) APIERROR(ndb->getNdbError());
operation = myTransaction->getNdbOperation(table);
if (operation == NULL) APIERROR(myTransaction->getNdbError());
operation->insertTuple();
//Primary Key
Int64 customerid = 2001;
operation->equal("CUSTOMERID", customerid);
//Indeed TAX is as "decimal(18,4)" in data table structure.
//Why the tax value to database is 0 ??
double tax = 11.1234;
operation->setValue("TAX", tax);
if (myTransaction->execute( NdbTransaction::Commit ) == -1)
APIERROR(myTransaction->getNdbError());
ndb->closeTransaction(myTransaction);
Edited 2 time(s). Last edit at 06/08/2012 03:13AM by Jacky Huang.
Subject
Views
Written By
Posted
NdbApi setValue does not support decimal type?
2032
June 08, 2012 02:13AM
1233
June 08, 2012 03:09AM
982
June 08, 2012 03:57AM
1653
June 10, 2012 08:28PM
1024
June 11, 2012 07:33AM
1185
June 12, 2012 08:34PM
1226
June 18, 2012 01:09AM
906
June 15, 2012 12:16AM
1167
June 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.