node-sql-parser
Advanced tools
Comparing version 1.4.1-beta to 1.4.1
@@ -375,4 +375,4 @@ 'use strict' | ||
function dropAndTruncateToSQL(stmt) { | ||
const clauses = [`${stmt.type && stmt.type.toUpperCase()} TABLE`] | ||
function dropToSQL(stmt) { | ||
const clauses = ['DROP TABLE'] | ||
let str = '' | ||
@@ -385,2 +385,12 @@ if (has(stmt, 'table')) str = tablesToSQL(stmt.table) | ||
function truncateToSQL(stmt) { | ||
const clauses = ['TRUNCATE'] | ||
if (stmt.keyword) clauses.push(stmt.keyword) | ||
let str = '' | ||
if (has(stmt, 'table')) str = tablesToSQL(stmt.table) | ||
if (has(stmt, 'db') && stmt.db !== null) str = `${identifierToSql(stmt.db)}.${str}` | ||
clauses.push(str) | ||
return `${clauses.join(' ')}` | ||
} | ||
function renameToSQL(stmt) { | ||
@@ -474,4 +484,4 @@ const type = `${stmt.type && stmt.type.toUpperCase()} TABLE ` | ||
insert : insertToSQL, | ||
drop : dropAndTruncateToSQL, | ||
truncate : dropAndTruncateToSQL, | ||
drop : dropToSQL, | ||
truncate : truncateToSQL, | ||
use : useToSQL, | ||
@@ -478,0 +488,0 @@ rename : renameToSQL, |
{ | ||
"name": "node-sql-parser", | ||
"version": "1.4.1-beta", | ||
"version": "1.4.1", | ||
"description": "simple node sql parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
402915
13884
0