Created
November 2, 2010 13:13
-
-
Save TheAnonymous/659582 to your computer and use it in GitHub Desktop.
How to read a SQLite Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sqlite3.h> | |
#include <stdio.h> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main(void) | |
{ | |
int zeile; | |
int spalte; | |
const char * datenbankname = "test.db"; | |
char **results = NULL; | |
string results2; | |
char *errmsg = NULL; | |
sqlite3 *db; | |
if(sqlite3_open(datenbankname, &db) != SQLITE_OK) | |
cout << "Error: could not open database: " << datenbankname << endl; | |
cout << "sdgsg" << endl; | |
sqlite3_get_table(db, "select * from testtable", &results, &zeile, &spalte, &errmsg); | |
cout << results[6]<< " " << results[7] <<endl ; | |
sqlite3_close(db); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlite3 test.db | |
> create table testtable(spalte 1,spalte2); | |
> insert into testtable values(value1,value2,value3,...); | |
contrl+D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment