snapperben / gulp-mysql-command-file-processor

This a gulp npm module that allows DDL sql files to be run into a MySql server as part of a controlled release
8 stars 4 forks source link

Comments are not supported #6

Closed iseus closed 8 years ago

iseus commented 8 years ago

Hi,

I'd like to test deployable .sql schema which contains comments also. It would be a great extension to your module if you add the 3 basic comment type:

From a # or -- to the end of the line, and comment blocks between /* and */.

Thanks

snapperben commented 8 years ago

Hi,

As I submit all lines to MySql as they appear in the file all comments should be supported.

If you're having a problem with comments it could be that one contains the command delimiter ';'. I have just checked the code and any character (including ';') can be escaped with '\' such that it will be ignored. I had exactly that problem and I escaped or removed al my semi colons

If that doesn't solve the problem then please come back to me

Cheers

Ben

On Sat, Apr 2, 2016 at 2:04 PM, iseus notifications@github.com wrote:

Hi,

I'd like to test deployable .sql schema which contains comments also. It would be a great extension to your module if you add the 3 basic comment type:

From a # or -- to the end of the line, and comment blocks between /* and */.

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/snapperben/gulp-mysql-command-file-processor/issues/6

iseus commented 8 years ago

If you're having a problem with comments it could be that one contains the command delimiter ';'.

Yes it contains because I commented out actually valid queries.

You are right btw (it was my mistake by syntax) in case when you comment only single lines, with for example -- DROP TABLE [...]; or # DROP TABLE [...];. I forgot the space between # and the statement.

In the other hand, on multi line comments you should ignore the ; inside the command blocks, in that case it would work perfectly without breaking your queries.

snapperben commented 8 years ago

I'm afraid that at the moment it doesn't have knowledge of comments....it only looks at the actual characters by themselves. I might look at doing that but at the moment I'm really focused on other development and can't do anything.

I will get back to you in the next few weeks

Thanks for using it...I'm really stoke that others have found this useful!

Cheers

Ben

On Sat, Apr 2, 2016 at 3:14 PM, iseus notifications@github.com wrote:

If you're having a problem with comments it could be that one contains the command delimiter ';'.

Yes it contains because I commented out actually valid queries.

You are right btw (it was my mistake by syntax) in case when you comment only single lines, with for example -- DROP TABLE [...]; or # DROP TABLE [...];. I forgot the space between # and the statement.

In the other hand, on multi line comments you should ignore the ; inside the command blocks, in that case it would work perfectly without breaking your queries.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/snapperben/gulp-mysql-command-file-processor/issues/6#issuecomment-204723785

iseus commented 8 years ago

I use it because good enough not to write my own, and the only solution available on npm. I'll make an addition for the comment blocks and make a pull request this weekend.