#define DSN_CONFIG "DSN=SQL-DBG;UID=user;PWD=password"
session sql("odbc", DSN_CONFIG);
rowset<row> rs = (sql.prepare << "SELECT id_i\
,id_a \
,id_b \
FROM dbg.dbo.dbg_lst \
WHERE id_da = :idda", use(a,"idda"));
for(rowset<row>::const_iterator it = rs.begin(); it != rs.end(); ++it)
{
printf("%s\n", sql.get_last_query().c_str());
for(int u : {0,1,2})
{
printf("%s\n", it->get_properties(u).get_name().c_str());
fflush(stdout);
}
printf("%lld ",it->get<long long>(0));
printf("%lld ",it->get<long long>(1));
printf("%lld\n",it->get<long long>(2));
}
void get_gedcom(long long int a)
{
session sql("odbc", DSN_CONFIG);
rowset<boost::tuple<long long, boost::optional<long long>, boost::optional<long long>>> rs = (sql.prepare << "SELECT id_i\
,id_a \
,id_b \
FROM dbg.dbo.dbg_lst \
WHERE id_da = :idda", use(a,"idda"));
for(rowset<boost::tuple<long long, boost::optional<long long>, boost::optional<long long>>>::const_iterator it = rs.begin(); it != rs.end(); ++it)
{
printf("%lld",it->get<0>());
printf(" %lld",it->get<1>().is_initialized() ? it->get<1>().get());
printf(" %lld\n",it->get<2>().is_initialized() ? it->get<2>().get());
out->push_back(fg);
}
}
I am trying for hours to get this work, I tested both but I get a lot of compile errors with boost at compile time (due to something about an incomplete type) and with soci::row
a problem with the assert on the number of columns (GDB confirmed rows returned where empty).
Database is full and SQL Management confirm there are values.
Aucun commentaire:
Enregistrer un commentaire