Highlighted

ColdFusion 2018 handling of cfsqltype

Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

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

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)

Views

621

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

ColdFusion 2018 handling of cfsqltype

Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

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

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)

Views

622

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 30, 2019 0
Adobe Community Professional ,
Apr 30, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 30, 2019 1
Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 30, 2019 0
Participant ,
Apr 30, 2019

Copy link to clipboard

Copied

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)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 30, 2019 3
Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

Thank you Bardnet

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 30, 2019 0
Engaged ,
May 01, 2019

Copy link to clipboard

Copied

I use VSCode too, but when performing searches like this, I like to export/save the results and sometimes search across multiple hosts/drives (so I'm not restricted to a single configured project.)  I use FileLocator Pro (Windows) to perform the same regex search as recommended by Bardnet​. You can configure FileLocator Pro to open scripts in and editor of your choosing.  There's also a free "Lite" version of the program available.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 01, 2019 1
Bardnet LATEST
Participant ,
May 01, 2019

Copy link to clipboard

Copied

I use FileLocator, too. It's a great tool to search over a whole drive and even over network shares. They recently united the Free version and the paid version. The Pro Version is free for private use. Works great.

VSCode, as I recommended yesterday, needs a setting to use the complex regexp that I wrote.

{

    "search.usePCRE2": true

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 01, 2019 1