node-sql-parser
Advanced tools
Comparing version 4.15.0 to 4.16.0
@@ -34,3 +34,4 @@ (function (global, factory) { | ||
} = column; | ||
return [(0, _expr.exprToSQL)(expr), offset, suffix].filter(_util.hasVal).join(''); | ||
const offsetExpr = offset && offset.map(offsetItem => ['[', offsetItem.name, `${offsetItem.name ? '(' : ''}`, (0, _util.literalToSQL)(offsetItem.value), `${offsetItem.name ? ')' : ''}`, ']'].filter(_util.hasVal).join('')).join(''); | ||
return [(0, _expr.exprToSQL)(expr), offsetExpr, suffix].filter(_util.hasVal).join(''); | ||
} | ||
@@ -37,0 +38,0 @@ function columnRefToSQL(expr) { |
(function (global, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define(["exports", "./util", "./alter", "./aggregation", "./assign", "./binary", "./case", "./column", "./func", "./interval", "./select", "./show", "./array-struct", "./tables", "./union", "./window"], factory); | ||
define(["exports", "./util", "./alter", "./aggregation", "./assign", "./binary", "./case", "./column", "./func", "./interval", "./json", "./select", "./show", "./array-struct", "./tables", "./union", "./window"], factory); | ||
} else if (typeof exports !== "undefined") { | ||
factory(exports, require("./util"), require("./alter"), require("./aggregation"), require("./assign"), require("./binary"), require("./case"), require("./column"), require("./func"), require("./interval"), require("./select"), require("./show"), require("./array-struct"), require("./tables"), require("./union"), require("./window")); | ||
factory(exports, require("./util"), require("./alter"), require("./aggregation"), require("./assign"), require("./binary"), require("./case"), require("./column"), require("./func"), require("./interval"), require("./json"), require("./select"), require("./show"), require("./array-struct"), require("./tables"), require("./union"), require("./window")); | ||
} else { | ||
@@ -10,6 +10,6 @@ var mod = { | ||
}; | ||
factory(mod.exports, global.util, global.alter, global.aggregation, global.assign, global.binary, global._case, global.column, global.func, global.interval, global.select, global.show, global.arrayStruct, global.tables, global.union, global.window); | ||
factory(mod.exports, global.util, global.alter, global.aggregation, global.assign, global.binary, global._case, global.column, global.func, global.interval, global.json, global.select, global.show, global.arrayStruct, global.tables, global.union, global.window); | ||
global.expr = mod.exports; | ||
} | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _util, _alter, _aggregation, _assign, _binary, _case, _column, _func, _interval, _select, _show, _arrayStruct, _tables, _union, _window) { | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _util, _alter, _aggregation, _assign, _binary, _case, _column, _func, _interval, _json, _select, _show, _arrayStruct, _tables, _union, _window) { | ||
"use strict"; | ||
@@ -44,2 +44,3 @@ | ||
interval: _interval.intervalToSQL, | ||
json: _json.jsonExprToSQL, | ||
show: _show.showToSQL, | ||
@@ -46,0 +47,0 @@ struct: _arrayStruct.arrayStructExprToSQL, |
{ | ||
"name": "node-sql-parser", | ||
"version": "4.15.0", | ||
"version": "4.16.0", | ||
"description": "simple node sql parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -67,5 +67,5 @@ // Type definitions for node-sql-parser 1.0 | ||
export interface Function { | ||
type: 'function'; | ||
type: "function"; | ||
name: string; | ||
args: expr_list; | ||
args: ExprList; | ||
suffix?: any; | ||
@@ -75,11 +75,14 @@ } | ||
expr: ColumnRef | AggrFunc | Function; | ||
as: string; | ||
as: string | null; | ||
type?: string; | ||
} | ||
type Param = { type: 'param'; value: string }; | ||
type Param = { type: "param"; value: string }; | ||
type Value = { type: string; value: any }; | ||
export type Expr = | ||
| { | ||
type: 'binary_expr'; | ||
operator: 'AND' | 'OR'; | ||
type: "binary_expr"; | ||
operator: "AND" | "OR"; | ||
left: Expr; | ||
@@ -89,12 +92,12 @@ right: Expr; | ||
| { | ||
type: 'binary_expr'; | ||
type: "binary_expr"; | ||
operator: string; | ||
left: ColumnRef | Param; | ||
right: ColumnRef | Param; | ||
left: ColumnRef | Param | Value; | ||
right: ColumnRef | Param | Value; | ||
}; | ||
export type expr_list = { | ||
type: 'expr_list'; | ||
export type ExprList = { | ||
type: "expr_list"; | ||
value: Expr[]; | ||
} | ||
}; | ||
export interface Select { | ||
@@ -107,3 +110,3 @@ with: With | null; | ||
from: Array<From | Dual | any> | null; | ||
where: Expr; | ||
where: Expr | Function | null; | ||
groupby: ColumnRef[] | null; | ||
@@ -130,3 +133,3 @@ having: any[] | null; | ||
set: SetList[]; | ||
where: Expr; | ||
where: Expr | Function | null; | ||
} | ||
@@ -137,3 +140,3 @@ export interface Delete { | ||
from: Array<From | Dual>; | ||
where: Expr; | ||
where: Expr | Function | null; | ||
} | ||
@@ -143,3 +146,3 @@ | ||
type: "alter"; | ||
table: From; | ||
table: From[]; | ||
expr: any; | ||
@@ -195,2 +198,8 @@ } | ||
export interface Drop { | ||
type: "drop"; | ||
keyword: string; | ||
name: any[]; | ||
} | ||
export type AST = | ||
@@ -203,3 +212,4 @@ | Use | ||
| Alter | ||
| Create; | ||
| Create | ||
| Drop; | ||
@@ -206,0 +216,0 @@ export class Parser { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
57205812
105
33819