The commented out lines work.
I'm wondering...
a) is it possible to do what's not commented out
b) what's the syntax re the "sql =..." and "sql +=..." lines
Any help much appreciated!
[code]
//sql = "create table episodes (id integer primary key, season int, name
text);";
////rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, &tail);
////replaced by
//rc = sqlite3_prepare(db, sql.c_str(), strlen( sql.c_str() ), &stmt,
&tail);
//rc = sqlite3_step(stmt);
//
//sql = "insert into episodes(id, season, name) Values(1,2,'bill');";
////rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, &tail);
////replaced by
//rc = sqlite3_prepare(db, sql.c_str(), strlen( sql.c_str() ), &stmt,
&tail);
//rc = sqlite3_step(stmt);
//
//sql = "insert into episodes(id, season, name) Values(2,3,'bob')";
////rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, &tail);
////replaced by
//rc = sqlite3_prepare(db, sql.c_str(), strlen( sql.c_str() ), &stmt,
&tail);
//rc = sqlite3_step(stmt);

sql = "BEGIN";   //you need to add newline here
sql += "create table episodes (id integer primary key, season int, name
text)";
sql += "insert into episodes(id, season, name) Values(1,2,'bill')";
sql += "insert into episodes(id, season, name) Values(2,3,'bob')";
sql += "COMMIT";
rc = sqlite3_prepare(db, sql.c_str(), strlen( sql.c_str() ), &stmt, &tail);
rc = sqlite3_step(stmt);
[code]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to