Comparing version 1.5.17 to 1.5.18
const lexer = require('sql-parser').lexer; | ||
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 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 between = /^between$/gi; | ||
@@ -5,0 +5,0 @@ const sqlStatements = /^delete$/gi; |
{ | ||
"name": "sql2json", | ||
"version": "1.5.17", | ||
"version": "1.5.18", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -173,2 +173,21 @@ const assert = require('assert'); | ||
it('SQL with function shape', () => { | ||
const data = { | ||
select: [{ | ||
value: 'Shape.STLength', | ||
alias: null, | ||
type: 'function', | ||
arguments: [] | ||
}, { | ||
value: 'x', | ||
alias: null, | ||
type: 'literal' | ||
}], | ||
from: 'tablename' | ||
}; | ||
const response = 'SELECT Shape.STLength(), x FROM tablename'; | ||
Json2sql.toSQL(data).should.deepEqual(response); | ||
}); | ||
it('SQL with static columns', () => { | ||
@@ -175,0 +194,0 @@ const data = { |
@@ -168,3 +168,3 @@ const assert = require('assert'); | ||
it('SQL with wildcard', () => { | ||
it('SQL with values as name column', () => { | ||
const response = { | ||
@@ -184,2 +184,23 @@ select: [{ | ||
it('SQL with function shape', () => { | ||
const response = { | ||
select: [{ | ||
value: 'Shape.STLength', | ||
alias: null, | ||
type: 'function', | ||
arguments: [] | ||
}, { | ||
value: 'x', | ||
alias: null, | ||
type: 'literal' | ||
}], | ||
from: 'tablename' | ||
}; | ||
const obj = new Sql2json('SELECT Shape.STLength(), x from tablename'); | ||
const json = obj.toJSON(); | ||
json.should.deepEqual(response); | ||
}); | ||
it('SQL with static columns', () => { | ||
@@ -186,0 +207,0 @@ const response = { |
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
124539
3515