insert null value error
stan1334 opened this issue · 1 comments
sqlite3
win10
64
//创建数据表sql
#define CREATE_HE_DATA_TABLE_SQL ("create table HE_DATA ("
"SOURCENODE varchar(256),"\
struct TestData{
std::string PARENTNODE;
int another;
XXX
}
static void to_base(const TestData& p, values& v, indicator& ind)
{
v.set("PARENTNODE", p.parentNode, p.parentNode.empty() ? i_null : i_ok);
}
when i insert struct a field is null,soci err info::
what:Null value not allowed for this type while executing "insert into
soci::transaction tr(*sql);
T insertData;
soci::statement st = (sql->prepare << strSql, SQL_USE(insertData));
for (auto& data : datas) {
insertData = data;
st.execute(true);
errroIndex++;
}
tr.commit();
soci err info::
what:Null value not allowed for this type while executing "
insert into HE_DATA (EVENTID,SOUR XXX PARENTNODE=NULL,
create field default can write null
"SOURCENODE varchar(256),"\
or
"SOURCENODE varchar(256) not null,"
always have same err
Please help guide
@vadz
Both get and set need to determine i_null