This is a rephrasing of my question from yesterday, since the subject line was
a bit confusing.
I've got a table:
CREATE TABLE dataset (chromosome VARCHAR(2), rsid INTEGER, pos REAL, pvalue
DOUBLE, gene_id INTEGER)
Which is giving me troubles when trying to extract the data from pvalue:
rowset<row> rs = (sociDB.prepare << "SELECT * FROM dataset WHERE
chromosome=:id", use(std::string("1")));
for (rowset<row>::const_iterator itr = rs.begin(); itr != rs.end(); ++itr) {
row const& row = *itr;
uint rsid = row.get<int>(1);
uint pos = row.get<int>(2);
string pvs = row.get<string>(3);
cerr<<pvs<<"\n";
double pvalue = row.get<double>(3);
When I run this code, I get the following output:
0.749703890389458
terminate called after throwing an instance of 'std::bad_cast'
what(): std::bad_cast
The abort occurs on the row get<double>(3)
As you can see, the pvalue is a numerical value, and the field is defined as a
REAL, which is SQLite3's datatype for decimal numbers. I've tried extracting it
as a float, and string is the only way. Is there something that I'm doing
wrong? I added the get<string> just so I could see what was being converted, to
make sure that the data wasn't misaligned.
Version information:
libsoci_core-gcc-3_0.3.0.0.dylib
sqlite3 v 3.6.12
OSX 10.6.2
eric
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/196390710/direct/01/------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users