Arbol One <[email protected]> wrote:
> In my GUI application the user enters a information that will go in a SQLite
> database table, so statements like:
> 
> string dbdata = "INSERT INTO friend (name, address, age) VALUES ('Caramba',
> '490 New Bridge', '49')";
> 
> 
> 
> are not very useful in a real life C++ GUI  application. I would assume that
> SQLite has functions to submit information in the form of string object  to
> a table

sqlite_stmt* stmt;
sqlite3_prepare_v2(db, "insert into friend(name, address, age) values (?, ?, 
?);", -1, &stmt, NULL);

string name = "Caramba";
string address = "490 New Bridge";
int age = 49;

sqlite3_bind_text(stmt, 1, name.c_str(), name.length(), SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, address.c_str(), address.length(), SQLITE_STATIC);
sqlite3_bind_int(stmt, 3, age);

sqlite3_step(stmt);
sqlite3_finalize(stmt);

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to