4

I am writing a query in CFScript for Informix database that looks something like this:

myQuery = new Query();
myQuery.setSQL("select something from someDatabase:someTable");

In Informix someDatabase:someTable syntax means accessing table from external database but In ColdFusion :parameter is what you write to later pass parameters. So CF throws an error

Parameter 'someTable' not found in the list of parameters specified

How do I escape that : symbol?


I tried `\` - it did not work.

Edit: I tried with backticks like so:

myQuery.setSQL("select something from `someDatabase:someTable`");

and now error message says

Parameter 'someTable`' not found in the list of parameters specified

Notice there is backtick after someTable, so it treats backtick as part of variable name.

  • Did you try ` `someDatabase:someTable` ` – rrk Aug 06 '20 at 16:04
  • @RRK pardon me, not sure what you mean. Surround by backticks? Edit: I tried surrounding by backticks but it didn't work. Same error. – Vanity Slug - codidact.com Aug 06 '20 at 16:07
  • On my keyboard, the key to the left of the number 1 key is a backtick, `, when lower case and a cedilla, ~, when upper case. I presume you understood "surround". – Dan Bracuk Aug 06 '20 at 16:11
  • 3
    What update version? This bug report says it was fixed in cf2016 update 11. There is also a clunky workaround involving includes https://tracker.adobe.com/#/view/CF-4204093 – SOS Aug 06 '20 at 16:33
  • @SOS I am not sure how to find out which update I have. We use CFBuilder 2016, it says it is version 3.1.3, build 300344. (Not sure if "version" equates to "update"). – Vanity Slug - codidact.com Aug 06 '20 at 16:42
  • 2
    Correction, it was supposedly fixed, but it is not clear which update contains the fix – SOS Aug 06 '20 at 16:43
  • That sounds like the ide version, not the CF server version.. Create a cfm script that does a writedump of the #server# scope. Somewhere in that output is the full coldfusion version. Sorry, can't remember the full key name right now ;-) Think it is under server.coldfusion.xxxsomethingxxx – SOS Aug 06 '20 at 16:44
  • 1
    @SOS I found in that dump `coldfusion.productversion` value is `2016,0,0,297996 `. Not sure what those numbers stand for exactly and [this page](https://helpx.adobe.com/coldfusion/developing-applications/developing-cfml-applications/using-persistent-data-and-locking/using-server-variables.html) does not appear to be of much use. But I am beginning to think it's very likely I am working with a buggy version of CF. – Vanity Slug - codidact.com Aug 06 '20 at 16:53
  • 1
    Yes. You'll need to install updates I guess. – rrk Aug 06 '20 at 16:58
  • 1
    If I am reading it right, it looks like there are no updates installed "2016,0,0", so you have some patching to do :-) Be sure to check the prereqisites first. Most of the update pages tell you the new build number. " After applying this update, the ColdFusion build number should be 2016,0,X,YYYYYYY.". Example update 16 https://helpx.adobe.com/coldfusion/kb/coldfusion-2016-update-16.html – SOS Aug 06 '20 at 17:12

0 Answers0