c++使用map储存sqlite查询结果问题
std::map<constchar*,constunsignedchar*>mapRowValue;mapRowValue.insert(std::pair<const...
std::map<const char *, const unsigned char *> mapRowValue;
mapRowValue.insert(std::pair<const char *, const unsigned char *>( sqlite3_column_name(stmt,0) , sqlite3_column_text(stmt,0) ));
printf( "name:%s\n",sqlite3_column_name(stmt,0));//输出mkey
printf( "value:%s\n" , mapRowValue["mkey"] );//输出为null
printf( "value:%s\n" , mapRowValue[sqlite3_column_name(stmt,0)] );//输出mkey字段的值;
sqlite3_column_name(stmt,0)明明等于"mkey";用mapRowValue["mkey"]输出确实null;
用mapRowValue[sqlite3_column_name(stmt,0)]输出就正常是什么原因? 展开
mapRowValue.insert(std::pair<const char *, const unsigned char *>( sqlite3_column_name(stmt,0) , sqlite3_column_text(stmt,0) ));
printf( "name:%s\n",sqlite3_column_name(stmt,0));//输出mkey
printf( "value:%s\n" , mapRowValue["mkey"] );//输出为null
printf( "value:%s\n" , mapRowValue[sqlite3_column_name(stmt,0)] );//输出mkey字段的值;
sqlite3_column_name(stmt,0)明明等于"mkey";用mapRowValue["mkey"]输出确实null;
用mapRowValue[sqlite3_column_name(stmt,0)]输出就正常是什么原因? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询