Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@soinlabs/db

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soinlabs/db - npm Package Compare versions

Comparing version 1.2.0-alpha.9 to 1.2.0-alpha.10

@@ -154,3 +154,5 @@ // const Sybase = require('sybase')

} catch (err) {
console.error('Error executing query', err)
if (this._logging) {
console.error('Error executing query', err)
}
throw err

@@ -243,14 +245,15 @@ }

try {
const currentSQL = 'ROLLBACK TRANSACTION'
this.logQuery(connection, currentSQL)
await connection.connection.queryAsync(
currentSQL,
transactionId,
true
)
} catch (err2) {
console.error(
`Error doing internal rollback transaction ${transactionId} -> `,
err2
)
// NO need to rollback, Sybase JAR does it automatically
// const currentSQL = 'ROLLBACK TRANSACTION'
// this.logQuery(connection, currentSQL)
// await connection.connection.queryAsync(
// currentSQL,
// transactionId,
// true
// )
} catch (_err2) {
// console.error(
// `Error doing internal rollback transaction ${transactionId} -> `,
// _err2
// )
}

@@ -257,0 +260,0 @@ throw err

@@ -9,2 +9,3 @@ const AbstractInnerTransaction = require('../common/abstract/AbstractInnerTransaction')

this._isReleased = false
this._hasError = false
}

@@ -22,8 +23,12 @@

try {
await this._transaction.queryAsync(sql, this._transaction.getId(), true)
} catch (err) {
console.error(
`Error doing internal rollback inside transaction ${this._transaction.getId()} -> `,
err
)
if (!this._hasError) {
await this._transaction.queryAsync(sql, this._transaction.getId(), true)
} else {
// No need to rollback, Sybase JAR does it automatically on errors
}
} catch (_err) {
// console.error(
// `Error doing internal rollback inside transaction ${this._transaction.getId()} -> `,
// _err
// )
}

@@ -57,3 +62,8 @@ this._finished = 'rollback'

this._transaction.logQuery(sql)
await this._transaction.queryAsync(sql, this._transaction.getId())
try {
await this._transaction.queryAsync(sql, this._transaction.getId())
} catch (_err) {
this._hasError = true
throw _err
}

@@ -63,11 +73,21 @@ // Get last inserted id

this._transaction.logQuery(currentSQL)
result = await this._transaction.queryAsync(
currentSQL,
this._transaction.getId()
)
try {
result = await this._transaction.queryAsync(
currentSQL,
this._transaction.getId()
)
} catch (_err) {
this._hasError = true
throw _err
}
} else {
result = await this._transaction.queryAsync(
sql,
this._transaction.getId()
)
try {
result = await this._transaction.queryAsync(
sql,
this._transaction.getId()
)
} catch (_err) {
this._hasError = true
throw _err
}
}

@@ -74,0 +94,0 @@

{
"name": "@soinlabs/db",
"version": "1.2.0-alpha.9",
"version": "1.2.0-alpha.10",
"main": "index.js",

@@ -26,3 +26,3 @@ "repository": "",

"@soinlabs/sequelize": "^2.0.1",
"@soinlabs/sybase": "^1.1.1",
"@soinlabs/sybase": "^1.1.2",
"compare-versions": "^6.1.0",

@@ -29,0 +29,0 @@ "inflection": "^3.0.0",