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/select.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (34 sloc)
1.06 KB
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 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); | |
} |