Skip to content
Permalink
f2ff6daa3d
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
42 lines (34 sloc) 1.06 KB
#include <iostream>
#include <sqlite3.h>
#include <string>
#include <stdio.h>
using namespace std;
static int Call_back(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 = "Call_back function called";
char *zErrMsg = 0;
// char* messaggeError;
int exit = sqlite3_open("TimeTable.db", &DB);
// string command = "SELECT * FROM student INNER JOIN enrolment on student.id = enrolment.student_id "+
// std::string("INNER JOIN module on module.id = enrolment.module_id ");
int Ejrfa = sqlite3_exec(DB, command.c_str(), Call_back,
(void*)data, &zErrMsg);
cout << Ejrfa;
if(Ejrfa==1){
cout << "Sqlite error";
} else {
}
sqlite3_close(DB);
return (0);
}