Link to home
Start Free TrialLog in
Avatar of paragonfoods
paragonfoods

asked on

Remove TAB character from SQL statement in ColdFusion 11 JDBC

In my coldfusion code, I have a standard cfquery statement with properly formatted SQL.  This segment of code is tabbed (indented) in my page to make the code more readable.  It seems that coldfusion is passing those TAB characters along in the SQL statement.  This is not a problem via ODBC, but it causes a problem with the same database's JDBC driver.  Is there a way to prevent  or filter out the TAB charaters prior to passing the SQL to the database?
SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of paragonfoods
paragonfoods

ASKER

I find that tabs are the issue given that, when removed, the query works fine.  I was hoping to use some sort of wrapper/filter to remove the tabs when the query is passed so I can keep the page indentations/formatting easily readable.  I may just need to replace the tab character with the equivalent # of spaces, as these do not cause a problem.
AFAIK, there's no extra "filtering" options for cfquery. CF simply evaluates whatever text is within the tags and sends it to the db. The best you could do is use a regex find/replace on the source, assuming your IDE offers that option.

Out of curiosity, what db are you using? I'm curious because I've always used tabs and it's never caused problems with sql server+jdbc.
It's an older non-transactional database called DB/C FS.  The ODBC driver works fine with my code as-is, but the JDBC driver is not liking the tabs.  I think a JDBC wrapper that can reformat the SQL between CF and the DB is my next direction...
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial