> > How does Coldfusion manufacturer the queryparams? It must inspect the > database to determine field types... I wonder if that's a performance > hit... >
I don't know the deep technical details, but I do know that many people argue that using query params actually gives you a performance benefit over plain SQL (although a lot of people disagree). Regardless of the debate over which method is faster, the way it works is if you query param ALL of your variables (including values in the SQL that don't come from CF), ColdFusion will create what is called a prepared statement (sometimes called a parameterized statement, or bind parameter). From what I understand, the way this works is that ColdFusion "compiles" your query down to machine code that the DB just executes. If you don't query param every value, the DB has to compile the statement, which includes syntax checking and all that jazz. That said, this does not work if you don't use cfqueryparams for everything. For example, this query would NOT be a prepared statement (from what I understand): <cfquery name="bday" datasource="#myDSN#"> select birthDate from familyGroups where child = <cfqueryparam value="#form.children#" cfsqltype="cf_sql_varchar"> and stillMinor = 1 </cfquery> The reason that it would not be a prepared statement is because of the "stillMinor = 1" part. Even though that is a static value that never changes, you still want to cfqueryparam that if you want your sql to be compiled to a prepared statement. Otherwise the DB server will still have to do the work when it receives the SQL query from ColdFusion. At least, that is how I understand things. If anybody sees a flaw in my explanation, feel free to jump in and correct me. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337408 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm