Re: [Sqlrelay-discussion] php, bind variables and postgresql
Brought to you by:
mused
|
From: Chris <dm...@gm...> - 2008-11-10 23:49:46
|
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.. -- Postgresql & php tutorials http://www.designmagick.com/ |