mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
26 lines
564 B
TypeScript
26 lines
564 B
TypeScript
"use strict";
|
|
|
|
import anyDB = require("any-db");
|
|
import begin = require("any-db-transaction");
|
|
|
|
var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb");
|
|
|
|
|
|
var transaction = begin(conn);
|
|
var transaction2 = begin(transaction);
|
|
|
|
begin(conn, { autoRollback: true });
|
|
begin(conn, (error: Error, result: begin.Transaction): void => {
|
|
});
|
|
|
|
transaction.query("SELECT * FROM MyTable");
|
|
|
|
transaction.commit();
|
|
transaction.commit((error: Error): void => {
|
|
});
|
|
|
|
transaction.rollback();
|
|
transaction.rollback((error: Error): void => {
|
|
});
|
|
|