node-sql-parser
Advanced tools
Comparing version 1.6.16 to 1.6.17
@@ -46,3 +46,4 @@ "use strict"; | ||
where, | ||
partition | ||
partition, | ||
returning | ||
} = stmt; | ||
@@ -53,3 +54,4 @@ const clauses = ['INSERT', (0, _util.toUpper)(prefix), (0, _tables.tablesToSQL)(table), partitionToSQL(partition)]; | ||
clauses.push((0, _util.commonOptionConnector)('WHERE', _expr.exprToSQL, where)); | ||
clauses.push((0, _util.returningToSQL)(returning)); | ||
return clauses.filter(_util.hasVal).join(' '); | ||
} |
@@ -37,6 +37,7 @@ "use strict"; | ||
set, | ||
where | ||
where, | ||
returning | ||
} = stmt; | ||
const clauses = ['UPDATE', (0, _tables.tablesToSQL)(table), (0, _util.commonOptionConnector)('SET', setToSQL, set), (0, _util.commonOptionConnector)('WHERE', _expr.exprToSQL, where)]; | ||
const clauses = ['UPDATE', (0, _tables.tablesToSQL)(table), (0, _util.commonOptionConnector)('SET', setToSQL, set), (0, _util.commonOptionConnector)('WHERE', _expr.exprToSQL, where), (0, _util.returningToSQL)(returning)]; | ||
return clauses.filter(_util.hasVal).join(' '); | ||
} |
@@ -17,2 +17,3 @@ "use strict"; | ||
exports.replaceParams = replaceParams; | ||
exports.returningToSQL = returningToSQL; | ||
exports.hasVal = hasVal; | ||
@@ -284,2 +285,10 @@ exports.setParserOpt = setParserOpt; | ||
return result.join(' '); | ||
} | ||
function returningToSQL(returning) { | ||
if (!returning) return ''; | ||
const { | ||
columns | ||
} = returning; | ||
return ['RETURNING', columns.map(columnRefToSQL).filter(hasVal).join(', ')].join(' '); | ||
} |
{ | ||
"name": "node-sql-parser", | ||
"version": "1.6.16", | ||
"version": "1.6.17", | ||
"description": "simple node sql parser", | ||
@@ -60,3 +60,3 @@ "main": "index.js", | ||
"mocha": "^6.0.0", | ||
"nyc": "14.1.1", | ||
"nyc": "15.0.0", | ||
"pegjs": "^0.10.0", | ||
@@ -63,0 +63,0 @@ "pre-commit": "^1.2.2" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2008894
71477