And here I am again, asking for what you find so easy and I. well, just
cannot understand.
I am trying to write to a database table previously created by another
process like this:
void someClass::create_tblName() {
sql_param_tblName = "CREATE TABLE name(n_id INTEGER PRIMARY KEY, title
TEXT, fname TEXT, mname TEXT, lname TEXT)";
try {db->createTable(sql_param_tblName); } catch(someException& e) {...}
}
void mySQLite3Class::createTable(const Glib::ustring& s) throw
(someException) {
rc = sqlite3_prepare_v2( db, s.c_str(), -1, , NULL);
if(rc != SQLITE_OK ) { throw someException }
rc = sqlite3_step(stmt);
if(rc != SQLITE_DONE) { throw someException }
}
}
The actual writing to the table looks like this:
void someClass::write2tblName() {
stmtName = "INSERT INTO name (n_id, title, fname, mname, lname) VALUES
(?, ?, ?, ?, ?)";
int data1 = 10;
int pos = 1;
try{db->write(stmtName,pos, data1);}catch(someException){.}
}
void mySQLite3Class::write(const Glib::ustring& sql_stmt, int pos, int data
)throw(someException) {
rc = sqlite3_prepare_v2(db, sql_stmt.c_str(), -1, , NULL);
if(rc != SQLITE_OK) { throw(someException)}
rc = sqlite3_bind_int(stmt, pos, data);
if(rc != SQLITE_OK) { throw(someException) }
}
but this does not store anything in the database table. I have used an
sqlite browser to determine if, in fact, some data was stored, but no,
nothing has been stored.
What am I doing wrong?
Leonardo da Vinci:
"I have offended God and mankind because my work did not reach the quality
it should have"
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users