> This may not be possible but...
> Doesn anyone know of a way to get this or something
> similar to work?
> <cfset strSQL = "select ColumnName from TableName where
> ColumnName=<cfqueryparam cfsqltype=""CF_SQL_VARCHAR""
> value=""#Variable#"">">
> <cfquery>
> #preserveSingleQuotes(strSQL)#
> </cfquery>
No, unfortunately there's no way to store a queryparam in a string --
I'm sure largely because a query that uses cfqueryparam actually
places the queryparam information as two separate strings in different
locations in the sql syntax...
imo uses of preservesinglequotes are also usually a bad idea...
The ontap framework has a fairly involved API for generating most
common query syntax and allows you to build joins and where clauses
prior to executing the qeury, but the query itself is executed in a
handful of custom tags which manage the cfquery tag for you. This or
something like it would allow you to pre-build the sql syntax, and at
the same time continue to use cfqueryparam as the tags which call the
cfquery tag ensure its use.
Some examples of my own code:
// create a local pointer to the sql library
sql = request.tapi.sql;
// get all columns from a single record in a table
rsUser = sql.select("*","usertable",
"",sql.filter("userid",variables.userid));
// get two columns from all records in a table
rsOptions = sql.select("optlabel,optvalue","optiontable");
// delete a single record from a table
sql.delete("fromtable",
sql.filter("tableid",variables.filterid));
// update the user table with data from the form scope
sql.update("usertable",form);
s. isaac dealey 954.927.5117
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
[Donations and Support]
- CFQUERYPARAM in CFSET djones
- RE: CFQUERYPARAM in CFSET S . Isaac Dealey
- RE: CFQUERYPARAM in CFSET Dave Watts