Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Cfscript queries? #7

Open
clint317 opened this issue Jan 3, 2013 · 1 comment
Open

Cfscript queries? #7

clint317 opened this issue Jan 3, 2013 · 1 comment

Comments

@clint317
Copy link

clint317 commented Jan 3, 2013

Any chance of including scans for scripted queries?:

q = new Query(datasource=mydatasource);
q.setSQL(
"select col1, col2, #col3#
from #schema#.tblname
where fee = :qpFa
and foo = :qpLa
and fum = '#so#'"
);
q.addParam(name="qpFa", value="#val1#", cfsqltype="cf_sql_varchar");
q.addParam(name="qpLa", value="#val2#", cfsqltype="cf_sql_varchar");

@boughtonp
Copy link
Owner

Not a big one - this isn't a simple thing to add.

The current scanner relies on two things that script queries can't guarantee:

  • Only needs to look for hashes to identify potential user-supplied variables.
  • Queries are clearly terminated; it just needs to look for </cfquery> to find the end.

Neither of these are the case with the script syntax, and even a rudimentary implementation would require a significant amount of work.

Since I don't work with scripted queries myself, there's no incentive for me to spend that amount of time on something I wouldn't use.

Of course, if anyone wants to have a go and send in a pull request that'd be fine, or if anyone wanted to sponsor the development, that's also an option, but both of those would need to come with a big disclaimer that the functionality would be limited, and probably wouldn't cope with, for example:

sql = "select stuff ...";
if (something) sql &= "...";
...
q.setSQL( sql );

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants