I am trying to get a c++ ndbapitst.cpp program to completely
display enumerated text fields, and to format FLOATS and DOUBLES
with the originally intended precision.
I have been unable to locate any NDB_ objects to accomplish this.
The Scale and Precision are only valid for DECIMAL types,
so they are of no value for the FLOAT or DOUBLE types:
Calls used are as follows:
// GET COLUMN information ( error handling has been removed )
lclColumnPtr = p_TablePtr->getColumn(li_i);
lccp_colname = lclColumnPtr->getName();
li_type = (int)lclColumnPtr->getType();
li_art = (int)lclColumnPtr->getArrayType();
li_len = (int)lclColumnPtr->getLength();
li_scl = (int)lclColumnPtr->getScale();
li_prc = (int)lclColumnPtr->getPrecision();
lcp = lclRecAttrPtr[li_i]->aRef();
NOTE: mysql ( client ) calls display as intended:
eg) world.City sql example:
CREATE TABLE `Country` (
`Code` char(3) NOT NULL default '',
`Name` char(52) NOT NULL default '',
`Continent` enum('Asia','Europe','NorthAmerica','Africa','Oceania','Antarctica','South America')
NOT NULL default 'Asia'
`Region` char(26) NOT NULL default '',
`SurfaceArea` float(10,2) NOT NULL default '0.00',
`IndepYear` smallint(6) default NULL,
`Population` int(11) NOT NULL default '0',
`LifeExpectancy` float(3,1) default NULL,
`GNP` float(10,2) default NULL,
`GNPOld` float(10,2) default NULL,
`LocalName` char(45) NOT NULL default '',
`GovernmentForm` char(45) NOT NULL default '',
`HeadOfState` char(60) default NULL,
`Capital` int(11) default NULL,
`Code2` char(2) NOT NULL default '',
PRIMARY KEY (`Code`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1;
ndbapitst.cpp displays the columns as follows:
( Note the control_A (^A)) for the text enumeration field,
and the
default 6 decimal place precision for floats assigned as 10.2 and 3.1
MAC, Macao, ^A, Eastern Asia, 18.000000, 00000, 00000473000, 81.599998, 5749.000000, 5940.000000, Macau/Aomen, Special Administrativ
e Region of China, Jiang Zemin, 00000002454,MO
//--
MYSQL display the fields OK
mysql> select * from world.Country where Code = "MAC";
+----------------------------------------+-------------+---------+-------+
| Code | Name | Continent | Region | SurfaceArea | IndepYear | Population | LifeExpectancy | GNP | GNPOld | LocalName
| GovernmentForm | HeadOfState | Capital | Code2 |
+----------------------------------------+-------------+---------+-------+
| MAC | Macao | Asia | Eastern Asia | 18.00 | NULL | 473000 | 81.6 | 5749.00 | 5940.00 | Macau/Aomen
| Special Administrative Region of China | Jiang Zemin | 2454 | MO |
1 row in set (0.00 sec)
NOTE that scale and precision are only VALID in DECIMAL type fields.
Any help would be appreciated.
dfedak@cyberlog.net
Edited 3 time(s). Last edit at 11/28/2006 05:10PM by Dennis Fedak.