Nevermind, you can totally hack cfquery! Woot. Thanks for all the help. On Thu, Apr 16, 2009 at 1:59 PM, David McGuigan <davidmcgui...@gmail.com>wrote:
> Ah, thanks guys! What I didn't realize is that you can use unnamed / > unstored prepared statements through the driver. That makes so much more > sense now. So ColdFusion uses dynamically "prepared statements" which are > implemented in the JDBC driver, which is a totally different ballgame from > using the pure SQL interface, which requires you to register them by name > and then reuse or overwrite them per call. > So if I can hunt down the driver syntax for calling that stuff directly can > I just use the Java commands from within my dynamic SQL in a cfquery tag? > > It looks like CF probably uses java.sql.PreparedStatement with syntax like > this: > > PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES SET > SALARY = ? WHERE ID = ?"); > > pstmt.setBigDecimal(1, 153833.00); > pstmt.setInt(2, 110592); > > Does anyone know how I'd just pop that Java into a CFQuery tag? Or can I > probably not because cfquery itself is what handles all of that and will > already be either a Statement or PreparedStatement object depending on > whether it detected any cfqueryparams? > > If so, does that mean my only option is writing a custom tag to simulate > cfquery and having it handle all of that stuff the same way cfquery does? ( > Retrieve the datasource info from the adminapi, create and manage the > connection, call all of these execution methods and then translate their > results to a CFML query object, etc. > > What a hassle. This is worse than the fact that you can't use cfform > controls outside of a cfform tag in CFC cffunctions. > > Thanks again. > > > On Thu, Apr 16, 2009 at 1:33 PM, Dave Watts <dwa...@figleaf.com> wrote: > >> >> > So if cfqueryparam is using prepared statements (which my guess would be >> > that it's not), cfqueryparamming all of your variable values would >> improve >> > performance because the statement itself isn't being re-sent to the RDMS >> on >> > each subsequent query, only the values. But if it's not, it could >> actually >> > slightly DIMINISH performance ( because the SQL generated is more >> verbose >> > because of the variable declarations and binding syntax ). >> >> Your guess is incorrect. CFQUERYPARAM builds a JDBC prepared >> statement. Using CFQUERYPARAM may improve or degrade performance, >> depending on additional factors. The SQL being more verbose is not one >> of those factors. >> >> Dave Watts, CTO, Fig Leaf Software >> http://www.figleaf.com/ >> >> Fig Leaf Software provides the highest caliber vendor-authorized >> instruction at our training centers in Washington DC, Atlanta, >> Chicago, Baltimore, Northern Virginia, or on-site at your location. >> Visit http://training.figleaf.com/ for more information! >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321705 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4