Replace clear global response string, and disable stderr print in callback - v3
This commit is contained in:
parent
f6c8443c5d
commit
745df5d48b
Binary file not shown.
@ -43,6 +43,7 @@ bool sql3::run(const string sql_command) {
|
||||
}
|
||||
else {
|
||||
Answer = responseDatabase;
|
||||
responseDatabase.clear();
|
||||
}
|
||||
|
||||
if (!keepOpen) {
|
||||
@ -115,13 +116,11 @@ sql3::~sql3() {
|
||||
|
||||
static int callback(void* data, int argc, char** argv, char** azColName) {
|
||||
int i;
|
||||
fprintf(stderr, "%s: ", (const char*)data);
|
||||
// fprintf(stderr, "%s: ", (const char*)data); // ovo je ispisivalo čudne stringove toplo se nadam da nam ne treba
|
||||
char res[1000];
|
||||
responseDatabase.clear();
|
||||
for (i = 0; i < argc; i++) {
|
||||
sprintf(res, "%s = %s", azColName[i], argv[i] ? argv[i] : "NULL");
|
||||
responseDatabase += res;
|
||||
responseDatabase += '\n';
|
||||
responseDatabase += string(res) + string("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,12 +8,18 @@ int main() {
|
||||
|
||||
sql3 mydb("../example/example.db", false);
|
||||
|
||||
//cout << mydb.ask("Select * from Tab1");
|
||||
// cout << mydb.ask("Select * from Tab1");
|
||||
// cout << mydb.ask("INSERT INTO Tab1 VALUES(3,'Pakora', 'marijanab@bitelex.ml');");
|
||||
|
||||
auto res = mydb.query("Select * from Tab1");
|
||||
// auto res = mydb.query("Select * from Tab1");
|
||||
auto res = mydb.query("INSERT INTO Tab1 VALUES(4,'Mare', 'marijanab@bitelex.co');");
|
||||
|
||||
cout << endl << res["NAME"][0];
|
||||
// for (auto i : res)
|
||||
// for (auto j: i.second)
|
||||
// cout << i.first << " : " << j << endl;
|
||||
|
||||
|
||||
// cout << endl << res["NAME"][1];
|
||||
|
||||
return 0;
|
||||
}
|
BIN
test/test.o
BIN
test/test.o
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user