Transactions

vsql supports transactions through the START TRANSACTION, COMMIT and ROLLBACK statements.

Internally, transactions use MVCC that allow multiple connections to both read and write to the database at the same time. This is different from SQLite which serializes all transactions by having a write transaction have an exclusive write lock on the file until it is comitted or rolled back.

Examples

-- From connection 1:
START TRANSACTION;

INSERT INTO products (name, price)
VALUES ('Coffee Machine', 150);

-- From connection 2:
SELECT * FROM products;
-- empty

-- From connection 1:
COMMIT;

-- From connection 2:
SELECT * FROM products;
-- NAME: Coffee Machine PRICE: 150

See Also