Comparing version 1.3.2 to 1.3.3
@@ -95,6 +95,12 @@ 'use strict'; | ||
* @desc: 转换查询结果中的数据,按类型转换. | ||
* 一次查询结果只能进行一次数据转换, 转换多次会出现结果错误. | ||
* @return: | ||
*/ | ||
database.prototype.ret_data_cvt = function(rows, table) { | ||
return this.adapter.ret_data_cvt(rows, table); | ||
database.prototype.ret_data_cvt = function(rows, ...table) { | ||
let ret; | ||
let mapObj = {}; | ||
for (let i = 0; i < table.length; i++) { | ||
ret = this.adapter.ret_data_cvt(rows, table[i], mapObj); | ||
} | ||
return ret; | ||
} | ||
@@ -101,0 +107,0 @@ |
@@ -85,5 +85,6 @@ 'use strict'; | ||
* @desc: 转换查询结果中的数据,按类型转换. | ||
* @param alreadyCvt: 用于防止重复转换. | ||
* @return: | ||
*/ | ||
function ret_data_cvt(rows, table) { | ||
function ret_data_cvt(rows, table, alreadyCvt = null) { | ||
for (let i = 0; i < rows.length; i++) { | ||
@@ -97,2 +98,11 @@ delete rows['RowNumber']; | ||
if (kk) { | ||
if (alreadyCvt) { | ||
// 转换过不再处理. | ||
if (alreadyCvt[kk]) | ||
continue; | ||
alreadyCvt[kk] = true; | ||
} | ||
let t = dataType.getType(kk.type); | ||
@@ -99,0 +109,0 @@ // fix bigint col. |
@@ -81,5 +81,6 @@ 'use strict'; | ||
* @desc: 转换查询结果中的数据,按类型转换. | ||
* @param alreadyCvt: 用于防止重复转换. | ||
* @return: | ||
*/ | ||
function ret_data_cvt(rows, table) { | ||
function ret_data_cvt(rows, table, alreadyCvt = null) { | ||
for (let i = 0; i < rows.length; i++) { | ||
@@ -92,2 +93,11 @@ for (let k in rows[i]) { | ||
if (kk) { | ||
if (alreadyCvt) { | ||
// 转换过不再处理. | ||
if (alreadyCvt[kk]) | ||
continue; | ||
alreadyCvt[kk] = true; | ||
} | ||
let t = dataType.getType(kk.type); | ||
@@ -94,0 +104,0 @@ // fix bigint col. |
@@ -54,3 +54,3 @@ { | ||
}, | ||
"version": "1.3.2" | ||
"version": "1.3.3" | ||
} |
@@ -817,3 +817,3 @@ febs db库用于连接数据库 | ||
*/ | ||
ret_data_cvt(rows, table) | ||
ret_data_cvt(rows, ...table) | ||
``` | ||
@@ -820,0 +820,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
263972
4693