Comparing version 1.5.19 to 1.5.20
@@ -104,3 +104,3 @@ function json2sql() {} | ||
case 'string': | ||
return `'${node.value}'`; | ||
return `${node.value}`; | ||
case 'operator': | ||
@@ -107,0 +107,0 @@ return `${parseNodeWhere(node.left)} ${node.value} ${parseNodeWhere(node.right)}`; |
const lexer = require('sql-parser').lexer; | ||
const postgisFunctions = /^(Shape.STLength|ST_SummaryStatsAgg|ST_value|st_transform|ST_Intersects|st_buffer|ST_AsGeoJson|ST_SetSRID|ST_GeomFromGeoJSON|ST_METADATA|ST_SUMMARYSTATS|ST_HISTOGRAM|TO_NUMBER|TO_CHAR|ST_GeoHash|first|last|ST_BANDMETADATA|st_centroid|round|trunc|abs|ceil|exp|floor|power|sqrt|acos|asin|atan|atan2|cos|cot|sin|tan|ST_X|ST_Y|CF_[a-zA-Z0-9_-])$/gi; | ||
const postgisFunctions = /^(ST_SummaryStatsAgg|ST_value|st_transform|ST_Intersects|st_buffer|ST_AsGeoJson|ST_SetSRID|ST_GeomFromGeoJSON|ST_METADATA|ST_SUMMARYSTATS|ST_HISTOGRAM|TO_NUMBER|TO_CHAR|ST_GeoHash|first|last|ST_BANDMETADATA|st_centroid|round|trunc|abs|ceil|exp|floor|power|sqrt|acos|asin|atan|atan2|cos|cot|sin|tan|ST_X|ST_Y|CF_[a-zA-Z0-9_-])$/gi; | ||
const between = /^between$/gi; | ||
@@ -84,3 +84,3 @@ const sqlStatements = /^delete$/gi; | ||
stack.push({ | ||
value: token[1], | ||
value: `'${token[1]}'`, | ||
type: 'string' | ||
@@ -152,2 +152,7 @@ }); | ||
break; | ||
case 'LEFT_PAREN': | ||
case 'RIGHT_PAREN': | ||
this.parsed.select[this.parsed.select.length - 1].value = this.parsed.select[this.parsed.select.length - 1].value + token[1]; | ||
break; | ||
case 'LITERAL': | ||
@@ -154,0 +159,0 @@ case 'BOOLEAN': |
{ | ||
"name": "sql2json", | ||
"version": "1.5.19", | ||
"version": "1.5.20", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -176,6 +176,5 @@ const assert = require('assert'); | ||
select: [{ | ||
value: 'Shape.STLength', | ||
value: 'Shape.STLength()', | ||
alias: null, | ||
type: 'function', | ||
arguments: [] | ||
type: 'literal' | ||
}, { | ||
@@ -824,3 +823,3 @@ value: 'x', | ||
}, { | ||
value: '{}', | ||
value: '\'{}\'', | ||
type: 'string' | ||
@@ -855,3 +854,3 @@ }] | ||
arguments: [{ | ||
value: '{}', | ||
value: '\'{}\'', | ||
type: 'string' | ||
@@ -1029,6 +1028,6 @@ }] | ||
arguments: [{ | ||
value: 'a', | ||
value: '\'a\'', | ||
type: 'string' | ||
}, { | ||
value: 'b', | ||
value: '\'b\'', | ||
type: 'string' | ||
@@ -1084,3 +1083,3 @@ }] | ||
right: { | ||
value: 'BRA', | ||
value: '\'BRA\'', | ||
type: 'string' | ||
@@ -1111,3 +1110,3 @@ } | ||
right: { | ||
value: 'BRA', | ||
value: '\'BRA\'', | ||
type: 'string' | ||
@@ -1114,0 +1113,0 @@ } |
@@ -187,6 +187,5 @@ const assert = require('assert'); | ||
select: [{ | ||
value: 'Shape.STLength', | ||
value: 'Shape.STLength()', | ||
alias: null, | ||
type: 'function', | ||
arguments: [] | ||
type: 'literal' | ||
}, { | ||
@@ -680,3 +679,3 @@ value: 'x', | ||
}, { | ||
value: '{}', | ||
value: '\'{}\'', | ||
type: 'string' | ||
@@ -713,3 +712,3 @@ }] | ||
arguments: [{ | ||
value: '{}', | ||
value: '\'{}\'', | ||
type: 'string' | ||
@@ -1619,3 +1618,3 @@ }] | ||
arguments: [{ | ||
value: '{"type":"Point","coordinates":[-60.25001,-9.33794]}', | ||
value: '\'{"type":"Point","coordinates":[-60.25001,-9.33794]}\'', | ||
type: 'string' | ||
@@ -1622,0 +1621,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
126262
3562