How can I execute an SQLite statement in C++
I have开发者_如何转开发 the following command which works fine on Linux Console. But to get the result to a cpp file I have to store it to file and then read it. But is there a way I can directly execute this command in C++.
/usr/bin/sqlite3 /etc/myDB/db/share.db "select path from folder_info where ftp='YES'"
As far as i understand your question you can use the SQLite3 c++ api which is described here
How can I execute an SQLite statement in C++
using stringstream
An Introduction To The SQLite C/C++ Interface
sqlite3 *db;
sqlite3_open("dbfile.db", &db);
sqlite3_stmt *companydetails;
std::stringstream companystr;
companystr << "select companyname,companydetails from company";
sqlite3_prepare(db, companystr.str().c_str(), companystr.str().size(),&companydetails, NULL);
sqlite3_step(companydetails);
精彩评论