Skip to main content
jeffh65754959
Inspiring
Apr 30, 2019 2:33 PM UTC
Answered

ColdFusion 2018 handling of cfsqltype

We are upgrading several mature sites to CF 2018.  One thing that is biting us quite a bit is the way CF 2018 handles cfsqltype compared to earlier versions.  Typos or incorrect cfsqltypes used to be skipped and treated as varchars.  On CF 2018, they error out.  This is fine however, being mature sites, there is a lot of code and cfqueryparams to be tested for typos. 

I know it's probably a long shot but would anyone know of an existing piece of code that parses cf code for cfsqltypes in a cfqueryparam?

Thanks,

Jeff

    This topic is closed to new replies. Start a new post to keep the conversation going.
    BardnetCorrect answer
    Inspiring
    Apr 30, 2019 10:18 PM UTC

    Hi,

    you can search through your code using regular expression if you use a good editor. VSCode and eclipse allow to search throught he project at once. The following looks for the cfsqltype-attribute that does not contain a correct value:

    cfsqltype="cf_sql_(?!integer|numeric|varchar|float|timestamp|date|longvarchar|blob|bigint|tinyint|char|decimal|time|bit|smallint|clob)

    6 replies

    BardnetCorrect answer
    Inspiring
    Apr 30, 2019 10:18 PM UTC

    Hi,

    you can search through your code using regular expression if you use a good editor. VSCode and eclipse allow to search throught he project at once. The following looks for the cfsqltype-attribute that does not contain a correct value:

    cfsqltype="cf_sql_(?!integer|numeric|varchar|float|timestamp|date|longvarchar|blob|bigint|tinyint|char|decimal|time|bit|smallint|clob)

    Translate
    jeffh65754959
    Inspiring
    May 1, 2019 2:29 AM UTC

    Thank you Bardnet

    Translate
    BKBK
    Community Expert
    Community Expert
    Apr 30, 2019 7:55 PM UTC

    You could use ColdFusion's built-in tool, Code Analyzer. It is in the ColdFusion Administrator, on the Debugging & Logging page.

    Browse to the directory whose ColdFusion code you wish to analyze. Then click on Run Analyzer.

    Translate
    jeffh65754959
    Inspiring
    Apr 30, 2019 9:50 PM UTC

    Thank you for that suggestion.  We tried that this morning but unfortunately cfqueryparam is not included in the tags that can be analyzed.  Since it results in an error with CF 2018, rather than the default value of varchar in earlier releases, I had hoped it would be included.

    Translate