node-sql-parser
Advanced tools
Comparing version 4.5.1 to 4.6.0
@@ -10,3 +10,3 @@ | ||
export type cmd_stmt = drop_stmt | create_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt; | ||
export type cmd_stmt = drop_stmt | create_stmt | truncate_stmt | rename_stmt | call_stmt | use_stmt | alter_stmt | set_stmt | lock_stmt | show_stmt | deallocate_stmt; | ||
@@ -31,2 +31,4 @@ export type create_stmt = create_table_stmt | create_constraint_trigger | create_extension_stmt | create_index_stmt | create_sequence | create_db_stmt; | ||
export type if_not_exists_stmt = 'IF NOT EXISTS'; | ||
export type nameOrLiteral = literal_string | { type: 'same', value: string; }; | ||
@@ -460,2 +462,10 @@ | ||
export interface deallocate_stmt_node { | ||
type: 'deallocate'; | ||
keyword: 'PREPARE' | undefined; | ||
expr: { type: 'default', value: string } | ||
} | ||
export type deallocate_stmt = AstStatement<deallocate_stmt_node>; | ||
export interface select_stmt_node extends select_stmt_nake { | ||
@@ -501,3 +511,3 @@ parentheses_symbol: true; | ||
export type expr_item = expr & { array_index: array_index }; | ||
export type expr_item = (expr || binary_expr) & { array_index: array_index }; | ||
@@ -735,2 +745,4 @@ export type column_list_item = { expr: expr; as: null; } | { type: 'cast'; expr: expr; symbol: '::'; target: data_type; as?: null; } | { type: 'star_ref'; expr: column_ref; as: null; } | { type: 'expr'; expr: expr; as?: alias_clause; }; | ||
export type binary_column_expr = binary_expr; | ||
export type or_and_where_expr = binary_expr | { type: 'expr_list'; value: expr[] }; | ||
@@ -855,4 +867,6 @@ | ||
export type aggr_func = aggr_fun_count | aggr_fun_smma | aggr_array_agg; | ||
export type aggr_filter = { keyword: 'filter'; parentheses: true, where: where_clause }; | ||
export type aggr_func = { type: 'aggr_func'; name: string; args: { expr: additive_expr } | count_arg; over: over_partition; filter?: aggr_filter; }; | ||
export type window_func = window_fun_rank | window_fun_laglead | window_fun_firstlast; | ||
@@ -904,3 +918,3 @@ | ||
export type extract_filed = "CENTURY" | "DAY" | "DATE" | "DECADE" | "DOW" | "DOY" | "EPOCH" | "HOUR" | "ISODOW" | "ISOYEAR" | "MICROSECONDS" | "MILLENNIUM" | "MILLISECONDS" | "MINUTE" | "MONTH" | "QUARTER" | "SECOND" | "TIMEZONE" | "TIMEZONE_HOUR" | "TIMEZONE_MINUTE" | "WEEK" | 'string'; | ||
export type extract_filed = 'string'; | ||
@@ -1003,4 +1017,2 @@ export type extract_func = { type: 'extract'; args: { field: extract_filed; cast_type: 'TIMESTAMP' | 'INTERVAL' | 'TIME'; source: expr; }}; | ||
type KW_IF_NOT_EXISTS = never; | ||
type KW_DELETE = never; | ||
@@ -1046,2 +1058,4 @@ | ||
type KW_DEALLOCATE = never; | ||
type KW_ON = never; | ||
@@ -1412,4 +1426,8 @@ | ||
export type binary_type = data_type; | ||
export type character_string_type = data_type; | ||
@@ -1416,0 +1434,0 @@ |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -25,2 +25,3 @@ (function (global, factory) { | ||
args, | ||
filter, | ||
over, | ||
@@ -50,4 +51,5 @@ orderby, | ||
const withinGroup = within_group_orderby ? `WITHIN GROUP (${(0, _expr.orderOrPartitionByToSQL)(within_group_orderby, 'order by')})` : ''; | ||
return [`${fnName}(${str})`, withinGroup, overStr].filter(_util.hasVal).join(' '); | ||
const filterStr = filter ? `FILTER (WHERE ${(0, _expr.exprToSQL)(filter.where)})` : ''; | ||
return [`${fnName}(${str})`, withinGroup, overStr, filterStr].filter(_util.hasVal).join(' '); | ||
} | ||
}); |
@@ -21,2 +21,3 @@ (function (global, factory) { | ||
_exports.commonCmdToSQL = commonCmdToSQL; | ||
_exports.deallocateToSQL = deallocateToSQL; | ||
_exports.declareToSQL = declareToSQL; | ||
@@ -157,2 +158,11 @@ _exports.descToSQL = descToSQL; | ||
function deallocateToSQL(stmt) { | ||
const { | ||
type, | ||
keyword, | ||
expr | ||
} = stmt; | ||
return [(0, _util.toUpper)(type), (0, _util.toUpper)(keyword), (0, _expr.exprToSQL)(expr)].filter(_util.hasVal).join(' '); | ||
} | ||
function declareToSQL(stmt) { | ||
@@ -159,0 +169,0 @@ const { |
@@ -20,3 +20,3 @@ (function (global, factory) { | ||
_exports.default = astToSQL; | ||
const surportedTypes = ['analyze', 'attach', 'select', 'delete', 'exec', 'update', 'insert', 'drop', 'rename', 'truncate', 'call', 'desc', 'use', 'alter', 'set', 'create', 'lock', 'unlock', 'bigquery', 'declare', 'show', 'replace']; | ||
const surportedTypes = ['analyze', 'attach', 'select', 'deallocate', 'delete', 'exec', 'update', 'insert', 'drop', 'rename', 'truncate', 'call', 'desc', 'use', 'alter', 'set', 'create', 'lock', 'unlock', 'bigquery', 'declare', 'show', 'replace']; | ||
@@ -23,0 +23,0 @@ function checkSupported(expr) { |
@@ -28,2 +28,3 @@ (function (global, factory) { | ||
select: _select.selectToSQL, | ||
deallocate: _command.deallocateToSQL, | ||
delete: _delete.deleteToSQL, | ||
@@ -30,0 +31,0 @@ exec: _exec.execToSQL, |
{ | ||
"name": "node-sql-parser", | ||
"version": "4.5.1", | ||
"version": "4.6.0", | ||
"description": "simple node sql parser", | ||
@@ -85,3 +85,3 @@ "main": "index.js", | ||
"source-map-support": "^0.5.19", | ||
"tinyify": "^3.0.0", | ||
"tinyify": "^4.0.0", | ||
"vscode-mocha-hmr": "^1.0.0", | ||
@@ -88,0 +88,0 @@ "webpack": "^4.43.0", |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
@@ -1,1 +0,1 @@ | ||
export * from './types'; | ||
export * from '../types'; |
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 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
43643622
25451