UNPKG

@segment/mysql-query-validator

Version:

This is just a simple wrapper over [this Golang executable](https://github.com/xwb1989/sqlparser) to validate SQL queries.

18 lines 759 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const child_process_1 = require("child_process"); const shell_escape_1 = __importDefault(require("shell-escape")); const path_1 = __importDefault(require("path")); const BINARY = path_1.default.join(__dirname, '../dist/sqlvalidator'); function execute(command, query) { const args = [`${BINARY}-${process.platform}`, '--query', query, command]; const output = child_process_1.execSync(shell_escape_1.default(args)) .toString() .trim(); return output; } exports.default = execute; //# sourceMappingURL=execute.js.map