Skip to content

Instantly share code, notes, and snippets.

@wengxt
Last active August 29, 2015 14:01
Show Gist options
  • Save wengxt/166d679abc49418b4bd4 to your computer and use it in GitHub Desktop.
Save wengxt/166d679abc49418b4bd4 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "sqlite3.h"
using namespace std;
int main(int argc, char* argv[])
{
sqlite3 *DataBase;
char *ErrMsg=NULL;
char **Return;
int Row,Col;
if(sqlite3_open("myblog.db",&DataBase))
{
cout<<"Error:Can't open the database:\"myblog.db\""<<endl;
return -1;
}
cout<<"Loading the database : \"myblog.db\"..."<<endl;
sqlite3_get_table(DataBase,"SELECT * FROM blog",&Return,&Row,&Col,&ErrMsg);
for(int j = 0; j < (Row + 1) * Col; j++)
{
cout<<"0"<<Return[j]<<"0"<<"\n"<<endl;
cout<<j<<"\n"<<endl;
}
sqlite3_free_table(Return);
sqlite3_close(DataBase);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment