Sqlite Toolkit - @octave_sqlite/rollback


: rollback (db)

Rollback changes to a database

Rollback pending transactions of sqlite connection that has AutoCommit = off set.

Inputs

db

Previously created octave_sqlite object

Outputs

None

Examples

Create a database table and insert a row, then roll back the insert

 
 # create sql connection
 db = sqlite("mytest.db");
 # create table
 execute(db, 'CREATE TABLE Test (Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT)');
 # turn off auto commit
 db.AutoCommit = "off";
 execute(db, 'INSERT INTO Test (Name) VALUES ("Line1")');
 # roll back the insert
 rollback(db);
 
 

See also: sqlite, commit.