joereynolds / SQHell.vim

An SQL wrapper for vim
MIT License
131 stars 9 forks source link

comments in file break SQHExecute file on current buffer #38

Closed joereynolds closed 6 years ago

joereynolds commented 6 years ago

Given this file

-- A small set of manual tests to run.

-- Run :SQHExecute over this line without a visual selection. It should run the correct query
SELECT * FROM symfony.gig LIMIT 5;

-- Run :SQHExecute over this but with a visual selection. It should run the correct query
-- (badly formatted on purpose)
SELECT
*
FROM
symfony.gig WHERE
YEAR(date) > 2017;

-- Run the following commands
-- SQHExecute! SELECT * FROM symfony.gig
-- SQHShowDatabases

-- Run this entire file with
-- SQHExecuteFile

-- Run it as an argument with
-- :SQHExecuteFile /home/joe/.config/nvim/plugged/SQHell.vim/test/manual_tests/tests.sql

It won't run because the first few lines are comments. What we need to do is pass it through a function that strips out MySQL comments.

Steps to take

joereynolds commented 6 years ago

Easier than it seemed

https://github.com/joereynolds/SQHell.vim/commit/08376498a0a3661f1567ac28259d282f67cf51d6