Michael Surette
2015-09-23 16:03:09 UTC
I am using soci 3.2.3 on Windows compiled with TDM-GCC.. It works
well except when I try to write NULL values.
I have the following statement instatiation which will not compile
statement statusInsert= (pgDB.prepare << sqlStatusInsert,
use(status.equip), use(status.serial), use(status.customer),
use(status.city), use(status.prov), use(status.country),
use(status.status),
use(date2tm(status.rma_issued), status.rma_issued ? i_ok : i_null),
use(date2tm(status.rcvd), status.rcvd ? i_ok : i_null),
use(date2tm(status.rfqc), status.rfqc ? i_ok : i_null),
use(date2tm(status.done), status.done ? i_ok : i_null),
use(date2tm(status.ship), status.ship ? i_ok : i_null),
use(status.workdays),
use(status.rma_number), use(status.rma_sequence),
use(status.special), use(status.estimate), use(status.tech),
use(status.notes)
);
It gives me compile errors like this
C:\Users\MSurette\Documents\SpiderOak
Hive\code\DOERS\statusSync\statusSync.cpp:293: error: no matching
function for call to 'use(tm, soci::indicator)'
use(date2tm(status.rma_issued), status.rma_issued ? i_ok : i_null),
^
sqlStatusInsert is a const char * to the sql INSERT statement.
date2tm takes a Date which is really a long, and converts it to a
std::struct tm.
If I use the single argument version of use() it works fine.
Any advice on how I could set these NULL values conditionally?
well except when I try to write NULL values.
I have the following statement instatiation which will not compile
statement statusInsert= (pgDB.prepare << sqlStatusInsert,
use(status.equip), use(status.serial), use(status.customer),
use(status.city), use(status.prov), use(status.country),
use(status.status),
use(date2tm(status.rma_issued), status.rma_issued ? i_ok : i_null),
use(date2tm(status.rcvd), status.rcvd ? i_ok : i_null),
use(date2tm(status.rfqc), status.rfqc ? i_ok : i_null),
use(date2tm(status.done), status.done ? i_ok : i_null),
use(date2tm(status.ship), status.ship ? i_ok : i_null),
use(status.workdays),
use(status.rma_number), use(status.rma_sequence),
use(status.special), use(status.estimate), use(status.tech),
use(status.notes)
);
It gives me compile errors like this
C:\Users\MSurette\Documents\SpiderOak
Hive\code\DOERS\statusSync\statusSync.cpp:293: error: no matching
function for call to 'use(tm, soci::indicator)'
use(date2tm(status.rma_issued), status.rma_issued ? i_ok : i_null),
^
sqlStatusInsert is a const char * to the sql INSERT statement.
date2tm takes a Date which is really a long, and converts it to a
std::struct tm.
If I use the single argument version of use() it works fine.
Any advice on how I could set these NULL values conditionally?
--
Mike
Mike