Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-sql-parser

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-sql-parser - npm Package Compare versions

Comparing version 4.11.0 to 4.12.0

6

ast/postgresql.ts

@@ -21,3 +21,3 @@

export type multiple_stmt = AstStatement<crud_stmt[]>;
export type multiple_stmt = AstStatement<curd_stmt | crud_stmt[]>;

@@ -837,3 +837,3 @@ export type set_op = 'union' | 'union all' | 'union distinct';

export type where_clause = binary_expr;
export type where_clause = or_and_where_expr;

@@ -1120,4 +1120,6 @@

export type column_without_kw = column_name | quoted_ident;
export type column = string | quoted_ident;

@@ -1124,0 +1126,0 @@

@@ -43,2 +43,3 @@ (function (global, factory) {

column,
db,
isDual,

@@ -54,4 +55,4 @@ schema,

let str = column === '*' ? '*' : columnOffsetToSQL(column, isDual);
if (table) str = `${(0, _util.identifierToSql)(table)}.${str}`;
if (schema) str = `${(0, _util.identifierToSql)(schema)}.${str}`;
const prefix = [schema, db, table].filter(_util.hasVal).map(val => `${(0, _util.identifierToSql)(val)}`).join('.');
if (prefix) str = `${prefix}.${str}`;
if (array_index) {

@@ -58,0 +59,0 @@ str = `${str}[${(0, _util.literalToSQL)(array_index.index)}]`;

@@ -51,5 +51,6 @@ (function (global, factory) {

ignore_replace: ignoreReplace,
or_replace: orReplace,
query_expr: queryExpr
} = stmt;
const sql = [(0, _util.toUpper)(type), (0, _util.toUpper)(temporary), (0, _util.toUpper)(keyword), (0, _util.toUpper)(ifNotExists), (0, _tables.tablesToSQL)(table)];
const sql = [(0, _util.toUpper)(type), (0, _util.toUpper)(orReplace), (0, _util.toUpper)(temporary), (0, _util.toUpper)(keyword), (0, _util.toUpper)(ifNotExists), (0, _tables.tablesToSQL)(table)];
if (like) {

@@ -56,0 +57,0 @@ const {

@@ -34,5 +34,5 @@ (function (global, factory) {

} = stmt;
const result = [(0, _util.toUpper)(keyword), (0, _tables.tableToSQL)(module), parameters.map(execVariablesToSQL).filter(_util.hasVal).join(', ')];
const result = [(0, _util.toUpper)(keyword), (0, _tables.tableToSQL)(module), (parameters || []).map(execVariablesToSQL).filter(_util.hasVal).join(', ')];
return result.filter(_util.hasVal).join(' ');
}
});

@@ -24,3 +24,3 @@ (function (global, factory) {

_exports.varToSQL = varToSQL;
const exprToSQLConvertFn = {
const exprToSQLConvertFn = _exports.exprToSQLConvertFn = {
alter: _alter.alterExprToSQL,

@@ -49,3 +49,2 @@ aggr_func: _aggregation.aggrToSQL,

};
_exports.exprToSQLConvertFn = exprToSQLConvertFn;
function varToSQL(expr) {

@@ -89,3 +88,3 @@ const {

} = unarExpr;
const space = operator === '-' || operator === '+' ? '' : ' ';
const space = operator === '-' || operator === '+' || operator === '~' || operator === '!' ? '' : ' ';
const str = `${operator}${space}${exprToSQL(expr)}`;

@@ -92,0 +91,0 @@ return parentheses ? `(${str})` : str;

@@ -20,3 +20,3 @@ (function (global, factory) {

_exports.default = void 0;
var _default = {
var _default = _exports.default = {
bigquery: _bigquery.parse,

@@ -33,3 +33,2 @@ db2: _db.parse,

};
_exports.default = _default;
});

@@ -81,4 +81,3 @@ (function (global, factory) {

}
var _default = Parser;
_exports.default = _default;
var _default = _exports.default = Parser;
});

@@ -20,6 +20,5 @@ (function (global, factory) {

_exports.default = void 0;
var _default = {
var _default = _exports.default = {
[PARSER_NAME]: _mysql.parse
};
_exports.default = _default;
});

@@ -195,5 +195,18 @@ (function (global, factory) {

if (symbol) sql.push(symbol);
sql.push(value);
let val = value;
switch (keyword) {
case 'partition by':
case 'default collate':
val = (0, _expr.exprToSQL)(value);
break;
case 'options':
val = `(${value.map(tableOptionItem => [tableOptionItem.keyword, tableOptionItem.symbol, (0, _expr.exprToSQL)(tableOptionItem.value)].join(' ')).join(', ')})`;
break;
case 'cluster by':
val = value.map(_expr.exprToSQL).join(', ');
break;
}
sql.push(val);
return sql.join(' ');
}
});

@@ -55,7 +55,7 @@ (function (global, factory) {

// }
const DEFAULT_OPT = {
const DEFAULT_OPT = _exports.DEFAULT_OPT = {
database: PARSER_NAME || 'mysql',
type: 'table'
};
_exports.DEFAULT_OPT = DEFAULT_OPT;
let parserOpt = DEFAULT_OPT;

@@ -161,3 +161,2 @@ function commonOptionConnector(keyword, action, opt) {

}
function getParserOpt() {

@@ -189,2 +188,3 @@ return parserOpt;

case 'db2':
case 'snowflake':
return `"${ident}"`;

@@ -255,3 +255,3 @@ case 'transactsql':

} = literal;
let str = value;
let str = typeof literal === 'string' ? literal : value;
switch (type) {

@@ -258,0 +258,0 @@ case 'backticks_quote_string':

{
"name": "node-sql-parser",
"version": "4.11.0",
"version": "4.12.0",
"description": "simple node sql parser",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -71,2 +71,18 @@ // Type definitions for node-sql-parser 1.0

type Param = { type: 'param'; value: string };
export type Expr =
| {
type: 'binary_expr';
operator: 'AND' | 'OR';
left: Expr;
right: Expr;
}
| {
type: 'binary_expr';
operator: string;
left: ColumnRef | Param;
right: ColumnRef | Param;
};
export interface Select {

@@ -77,5 +93,5 @@ with: With | null;

distinct: "DISTINCT" | null;
columns: any[] | Column[] | "*";
columns: any[] | Column[];
from: Array<From | Dual | any> | null;
where: any;
where: Expr;
groupby: ColumnRef[] | null;

@@ -102,3 +118,3 @@ having: any[] | null;

set: SetList[];
where: any;
where: Expr;
}

@@ -109,3 +125,3 @@ export interface Delete {

from: Array<From | Dual>;
where: any;
where: Expr;
}

@@ -112,0 +128,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc