Comparing version 1.4.1 to 1.4.2
@@ -216,3 +216,3 @@ 'use strict'; | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'COMMIT TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'COMMIT TRAN', true); | ||
} catch (e) { console.log('[error in sqlLogCallback]'); console.log(e); } | ||
@@ -239,3 +239,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK TRAN', true); | ||
} catch (e) { console.log('[error in sqlLogCallback]'); console.log(e); } | ||
@@ -264,3 +264,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK TRAN', true); | ||
} catch (e) { console.log('[error in sqlLogCallback]'); console.log(e); } | ||
@@ -674,4 +674,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'SET TRANSACTION ISOLATION LEVEL '+sqlLevelSql); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'BEGIN TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'SET TRANSACTION ISOLATION LEVEL '+sqlLevelSql + ' BEGIN TRAN', true); | ||
} catch (e) { console.log('[error in sqlLogCallback]'); console.log(e); } | ||
@@ -685,3 +684,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(null, 'ROLLBACK TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(null, 'ROLLBACK TRAN', true); | ||
} catch (err) { console.log('[error in sqlLogCallback]'); console.log(err); } | ||
@@ -715,4 +714,3 @@ db.__rolledBack = true; | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'SET TRANSACTION ISOLATION LEVEL '+sqlLevelSql); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'BEGIN TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'SET TRANSACTION ISOLATION LEVEL '+sqlLevelSql + ' BEGIN TRAN', true); | ||
} catch (e) { console.log('[error in sqlLogCallback]'); console.log(e); } | ||
@@ -726,3 +724,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(null, 'ROLLBACK TRAN'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(null, 'ROLLBACK TRAN', true); | ||
} catch (err) { console.log('[error in sqlLogCallback]'); console.log(err); } | ||
@@ -729,0 +727,0 @@ db.__rolledBack = true; |
@@ -341,3 +341,3 @@ 'use strict'; | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'COMMIT'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'COMMIT', true); | ||
} catch (e) { reject(handle_err('sqlLogCallback', e, __filename, __line)); return; } | ||
@@ -365,3 +365,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK', true); | ||
} catch (e) { reject(handle_err('sqlLogCallback', e, __filename, __line)); return; } | ||
@@ -389,3 +389,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'ROLLBACK', true); | ||
} catch (e) { reject(handle_err('sqlLogCallback', e, __filename, __line)); return; } | ||
@@ -452,3 +452,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, sqlLevel); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, sqlLevel, true); | ||
} catch (e) { reject(handle_err('sqlLogCallback', e, __filename, __line)); return; } | ||
@@ -465,3 +465,3 @@ | ||
try { | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'START TRANSACTION'); | ||
if (db.sqlLogCallback) db.sqlLogCallback(err, 'START TRANSACTION', true); | ||
} catch (e) { reject(handle_err('sqlLogCallback', e, __filename, __line)); return; } | ||
@@ -468,0 +468,0 @@ |
@@ -9,3 +9,3 @@ { | ||
"debug": "^3.1.0", | ||
"febs": "^0.8.50", | ||
"febs": "^0.8.54", | ||
"mssql": "^4.0.4", | ||
@@ -55,3 +55,3 @@ "mysql": "^2.13.0" | ||
}, | ||
"version": "1.4.1" | ||
"version": "1.4.2" | ||
} |
@@ -587,3 +587,3 @@ febs db库用于连接数据库 | ||
// 开启sql日志. global.dbagent 是预先存储的全局数据库对象 | ||
global.dbagent.sqlLogCallback = function(err, sql) { | ||
global.dbagent.sqlLogCallback = function(err, sql, isTransactionBeginOrEnd) { | ||
console.log( | ||
@@ -795,3 +795,4 @@ ` | ||
* @desc: 设置执行sql的log回调. 每次执行数据库查询都将调用此方法. | ||
* @param cb: function(err, sql) {} | ||
* @param cb: function(err, sql, isTransactionBeginOrEnd) {} | ||
* - isTransactionBeginOrEnd: 是否是 事务 begin/commit/rollback. | ||
*/ | ||
@@ -798,0 +799,0 @@ set sqlLogCallback(cb) |
@@ -17,3 +17,3 @@ 'use strict'; | ||
// set sql log callback. | ||
db.sqlLogCallback = function(err, sql) { | ||
db.sqlLogCallback = function(err, sql, isTransactionBeginOrEnd) { | ||
// console.log(` | ||
@@ -20,0 +20,0 @@ // ${febs.utils.getTimeString(Date.now(), '[yyyy-MM-dd hh:mm:ss]')} |
@@ -234,5 +234,6 @@ // Type definitions for febs | ||
* @desc: 设置执行sql的log回调. 每次执行数据库查询都将调用此方法. | ||
* @param cb: function(err, sql) {} | ||
* @param cb: function(err, sql, isTransactionBeginOrEnd) {} | ||
* - isTransactionBeginOrEnd: 是否是 事务 begin/commit/rollback. | ||
*/ | ||
sqlLogCallback: (err: any, sql: string) => void; | ||
sqlLogCallback: (err: any, sql: string, isTransactionBeginOrEnd?:boolean) => void; | ||
@@ -239,0 +240,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
266958
1450
4775
Updatedfebs@^0.8.54