I am trying some sample application to access the tables and entries from sqlite db. This Db is related to Firefox that stores the details of history visited.I am trying this on Windows 7 OS. Below is my code:
void main()
{
sqlite3 *db;
sqlite3_stmt *res;
int rec_count = 0;
const char *errMSG;
const char *tail;
HINSTANCE hinstLib = LoadLibraryA("E:\\sample_test\\Typed_Adrress_deletion\\Typed_Address_Deletion\\Typed_Address_Deletion\\sqlite3.dll");
int error = sqlite3_open("C:\\Users\\bkumar\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\2indcm0e.default\\places.sqlite", &db);
sqlite3_stmt *statement;
char *query = "select * from places.sqlite.moz_historyvisits";
int a = sqlite3_prepare(db, query, -1, &statement, 0 );
if ( a == SQLITE_OK )
{
int ctotal = sqlite3_column_count(statement);
int res = 0;
while ( 1 )
{
res = sqlite3_step(statement);
if ( res == SQLITE_ROW )
{
for ( int i = 0; i < ctotal; i++ )
{
string s = (char*)sqlite3_column_text(statement, i);
cout << s << " " ;
}
cout << endl;
}
if ( res == SQLITE_DONE )
{
cout << "done " << endl;
break;
}
}
}
getch();
}
The value returned by the sqlite3_prepare is 26 and it means file opened that is not a database file. How can we access this details from that table. Thanks in advance
Aucun commentaire:
Enregistrer un commentaire