Re: [Sqlrelay-discussion] php, bind variables and postgresql
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2008-11-11 15:40:28
|
Yep, looks right to me. On Tue, 2008-11-11 at 10:49 +1100, Chris wrote: > David Muse wrote: > > There are 2 solutions; use postgresql native bind format or add > > fakebinds=yes to the string attribute of the connection tag in your > > sqlrelay.conf file. > > > > Prior to version 8.0, postgres did not support bind variables so > > sqlrelay faked them by rewriting the query. These days, sqlrelay > > attempts to use postgres's native binds, but you can override that and > > fall back to the old behavior using fakebinds=yes. > > > > If you want to use native postgresql binds, you'll need to rewrite your > > queries, replacing :assetid with a ? and then in the inputBind call, > > you'll need to refer to each bind variable by number rather than name. > > > > For example: > > > > sqlrcur_prepareQuery($cur,"select * from sq_ast where assetid=? and > > otherid=?"); > > sqlrcur_inputBind($cur,"1","43"); > > sqlrcur_inputBind($cur,"2","100"); > > Ahh. That works. > > I tried using fakebinds (since it's more "pdo" style which is what the > app is using) but I must have it wrong. > > <connection connectionid="pgsql" > string="user=user;password=pass;db=dbname;host=127.0.0.1;port=5432;fakebinds=yes;" > metric="1" behindloadbalancer="no" /> > > Does that look right? > > Of course I restarted sqlrelay after adding the fakebinds param in.. > _____________________________________________________________ Veteran's Day Domain Sales: Hosting + Domain = US$5.95/year Offer Ends: Nov 12, 2008. http://www.doteasy.com |