sqlite3_column_text返回NULL

 

1 GoodsRecord goodsRecord;
2 goodsRecord.m_strCusName = reinterpret_cast<const char*>(sqlite3_column_text(pSqliteStmt, 1));
3 goodsRecord.m_strInsertTime = reinterpret_cast<const char*>(sqlite3_column_text(pSqliteStmt, 2));
4 goodsRecord.m_strPrintTime = reinterpret_cast<const char*>(sqlite3_column_text(pSqliteStmt, 3));

如果表中第三列printTime值为空,也就是插入的时候没有给这一列赋值,那么sqlite3_column_text返回NULL,将NULL赋值给string会异常,这里还是先给第三列附上值吧,以后再更新这列的值...暂且这样,sqlite3_column_text为啥不返回一个空字符串呢?(⊙o⊙)…,写着写着明白了,事先在第三列插入空字符串就行了,什么都没插入当然返回NULL了,好吧。

posted on 2013-12-22 23:23  翟小祥  阅读(2464)  评论(0编辑  收藏  举报

导航