c++ - How to read string from sqlite using sqlite3_prepare_v2()? -
i have sqlite3 database , need query on using visual c++ 2013? using sqlite3.h creating connection manipulate database;
i using code retraive data :
sqlite3_stmt *stmt; sqlite3_prepare_v2(db, "select * response list_id =?", -1, &stmt, null); sqlite3_bind_int(stmt, 1, *2*); tree<sensorstate>::iterator itr = sensortree.begin(); (;;) { int rc = sqlite3_step(stmt); if (rc == sqlite_done){ break; } else if (rc != sqlite_row){ cout << "error in reading sensore error no: " << rc; break; } const char* name = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 2)); int value = sqlite3_column_int(stmt, 3); cout << name<< "->" << value <<endl; }
now in terminal getting outbut:
but must show output:
s1->5 s2->2 s4->2
how can rea string correctly sqlite3 using c++?
Comments
Post a Comment