Skip to content
Snippets Groups Projects

Merge new updates into master

2 files
+ 18
11
Compare changes
  • Side-by-side
  • Inline

Files

@@ -12,6 +12,11 @@ const nullFields = [
]
function parseWhereValue(type, value, relation) {
if (value == null)
return null;
if (value.toString().toLowerCase() == "null")
return null;
if(type === 'integer') return parseInt(value, 10);
if(type === 'double') return parseFloat(value);
if(type === 'string' && relation === 'LIKE') return '%'+value+'%';
@@ -21,12 +26,8 @@ function parseWhereValue(type, value, relation) {
return value;
}
if(typeof value === 'string') {
if(value.toLowerCase() === 'true' || value.toLowerCase() === '1') {
if(value.toLowerCase() === 'true' || value.toLowerCase() === '1')
return true;
}
if(value.toLowerCase() === 'null') {
return null;
}
}
return false;
}
@@ -42,9 +43,12 @@ function getConvertName(whereField){ // TODO: mudar para regex
}
function isNull(curFilter, value){
if (value == null)
return true;
let convertName = getConvertName(curFilter)
if (id2str[convertName] !== undefined)
if (id2str[convertName] !== undefined){
return nullFields.indexOf(id2str[convertName](value)) > -1
}
return false;
}
@@ -328,7 +332,7 @@ class ReqQueryFields {
for(let i = 0; i < whereValue.length; ++i) {
let curRelation = value.where.relation;
let curValue = parseWhereValue(value.where.type, whereValue[i],value.where.relation)
if (isNull(k, curValue) ) {
if (isNull(k, curValue)) {
curValue = null;
curRelation = "is";
}
Loading