OCCI Datatypes [message #178834] |
Fri, 23 June 2006 01:14 |
achintk
Messages: 2 Registered: June 2006
|
Junior Member |
|
|
Hi all
I am new to C++ and OCCI. I have a database table field that is defined as NUMBER(7,2). Which primitive datatype should I use in C++ inorder to retrieve the value so that I don't loose the precision.
Thanks in advance.
Achint
|
|
|
|
Re: OCCI Datatypes [message #187673 is a reply to message #178834] |
Mon, 14 August 2006 20:39 |
yifanernei
Messages: 4 Registered: August 2006 Location: china
|
Junior Member |
|
|
int np = md.at(j).getInt(MetaData::ATTR_PRECISION);
int ns = md.at(j).getInt(MetaData::ATTR_SCALE);
Number num = rs->getNumber(j+1);
string fmt;
for (int n=0; n<np; n++)
fmt += '9';
if (ns > 0)
{
fmt += '.';
for (n=0; n<ns; n++)
fmt += '9';
}
string coldata = num.toText(env, fmt);
Here is my code by occi,but maybe it's too complex to build the fmt.
[Updated on: Mon, 14 August 2006 20:41] Report message to a moderator
|
|
|