As many of you know, I am trying to learn SQL using C++.
Below is an error I get when I try using the C++ example below it.
Error Code: 1
Error Message: near "VALUES": syntax error
--------------------------------------------
Glib::ustring apstr;
Glib::ustring sName;
int apint;
mySQLite3* db;
try {
db = new mySQLite3(db_name.c_str());
} catch(somexception& e) {
//do something
}
// SQL statement
apstr = "SELECT fname FROM ";
apstr += this->db_table_name;
apstr += " WHERE title = ";
apstr += token;
apstr += " (n_id, title, fname, mname, lname) VALUES (?, ?, ?, ?, ?)";
// here is where the problem is see the method below
apint = 1;
db->setStmt(apstr);
sName = db->read_str(apint);
--------------------------------------------
const Glib::ustring& mySQLite3::read_str(const int pos)
throw(jme::Exception) {
rc = sqlite3_prepare_v2(db, this->SQLStatement.c_str(), -1, &mystmt,
NULL);
if(rc != SQLITE_OK) {
// do something
}
rc = sqlite3_step(mystmt);
if(rc == SQLITE_ROW ) {
apstr = (const char*)sqlite3_column_text(mystmt,pos);
}
try {
this->finalize();
} catch(somexception& e) {
throw e;
}
return apstr;
}
What am I doing wrong?
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users