node-sql-parser
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -26,2 +26,12 @@ (function (global, factory) { | ||
function columnOffsetToSQL(column, isDual) { | ||
if (typeof column === 'string') return (0, _util.identifierToSql)(column, isDual); | ||
const { | ||
expr, | ||
offset, | ||
suffix | ||
} = column; | ||
return [(0, _expr.exprToSQL)(expr), offset, suffix].filter(_util.hasVal).join(''); | ||
} | ||
function columnRefToSQL(expr) { | ||
@@ -38,3 +48,3 @@ const { | ||
} = expr; | ||
let str = column === '*' ? '*' : (0, _util.identifierToSql)(column, isDual); | ||
let str = column === '*' ? '*' : columnOffsetToSQL(column, isDual); | ||
if (table) str = `${(0, _util.identifierToSql)(table)}.${str}`; | ||
@@ -149,3 +159,3 @@ const result = [str, (0, _util.commonOptionConnector)('AS', _expr.exprToSQL, as), (0, _util.commonOptionConnector)(arrow, _util.literalToSQL, property)]; | ||
str = `${str} AS `; | ||
if (column.as.match(/^[a-z_][0-9a-z_]*$/i)) str = `${str}${(0, _util.identifierToSql)(column.as)}`;else str = `${str}${(0, _util.columnIdentifierToSql)(column.as)}`; | ||
if (/^(`?)[a-z_][0-9a-z_]*(`?)$/i.test(column.as)) str = `${str}${(0, _util.identifierToSql)(column.as)}`;else str = `${str}${(0, _util.columnIdentifierToSql)(column.as)}`; | ||
} | ||
@@ -152,0 +162,0 @@ |
{ | ||
"name": "node-sql-parser", | ||
"version": "3.7.0", | ||
"version": "3.7.1", | ||
"description": "simple node sql parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
38268118
22318
95