Skip to content

It is not working with any-db-transaction #1

@juanluispaz

Description

@juanluispaz

If I try to begin a transaction using the any-db-transaction package it never call the callback function.

Code:

/*
 * npm install any-db
 * npm install any-db-mssql
 * docker run --name ts-sql-query-sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -e 'MSSQL_PID=Express' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu
 */

var anyDB = require('any-db');
var begin = require('any-db-transaction');

var pool = anyDB.createPool('mssql://sa:yourStrong(!)Password@localhost/master', { min: 5, max: 15 });

pool.acquire((acquireError, conn) => {
    console.log('acquire executed');
    if (acquireError) {
        console.log('acquireError', acquireError);
        return;
    }

    begin(conn, function (err, transaction) {
        console.log('begin executed');
        if (err) {
            console.error('err', err);
            return;
        }

        transaction.query('select getdate()', function (error, result) {
            console.log('error', error);
            console.log('result', result);
        });
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions