Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
timeTable/InsertandDelete.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
41 lines (32 sloc)
910 Bytes
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 <iostream> | |
#include <sqlite3.h> | |
#include <string> | |
#include <stdio.h> | |
using namespace std; | |
static int callback(void *data, int argc, char **argv, char **azColName){ | |
int i; | |
fprintf(stderr, "%s: ", (const char*)data); | |
for(i = 0; i<argc; i++){ | |
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); | |
} | |
printf("\n"); | |
return 0; | |
} | |
int main(int argc, char** argv) | |
{ | |
sqlite3* DB; | |
const char* data = "Callback function called"; | |
char *zErrMsg = 0; | |
// char* messaggeError; | |
int exit = sqlite3_open("mydb.db", &DB); | |
string writing = "SELECT * FROM PERSON;"; | |
int hayylah = sqlite3_exec(DB, writing.c_str(), callback, | |
(void*)data, &zErrMsg); | |
cout << hayylah; | |
if(hayylah!=1){ | |
cout << "Sqlite error"; | |
} else { | |
} | |
sqlite3_close(DB); | |
return (0); | |
} |