Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Setting SQL_MODE for Mysql database only (Pentaho stripping comments)

$
0
0
Hi There

I'm working with some jobs at the moment that have to run on both Mysql and MS SQL. All is fine and the lovely feature of Mysql called SQL_MODE allows me to use

Code:

SET sql_mode = 'MSSQL';
I can even write

Code:

/*! SET sql_mode = 'MSSQL'*/;
in a comment hint so that it is only executed in Mysql and when the same SQL is run on MS SQL it is safely ignored.

My problem comes to running this in Pentaho (either in the Advanced section of Database Connection dialog or in SQL job itself). It works fine if I just put SET sql_mode = 'MSSQL' - but if I use it in the second form in the comment hint then Pentaho thinks it's a comments and strips the comment out.

I've found the code that does this in SqlScriptParser.java - sure I could patch it, but I am wondering if there is a better way to do this that anyone can think of?

Originally I was going to make this pre-run-SQL a variable (so I could not have it for when we run on MSSQL) but the Database Connection method does not support variable substitution.

Any ideas much appreciated!

Steve

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>