What flavor and version of database are you using?

The reason I ask is a question came up on this list a short while back
that involved sorting and the DBI plugin. 

Just going off memory, I seem to recall that for MySQL (at least some
versions) the field in the order by clause also had to be selected
in the query.

Just from inspection, it would be hard for the DBI plugin to be guilty of
this type of bug, as plugin is just a thin wrapper around the DBI interface
and doesn't seem to get into the business of actually writing the SQL.

Just a thought.

Quoting Craig Barratt ([EMAIL PROTECTED]):
> > i don't want to start talking to myself, but i think i am narrowing in on the
> >  problem :-)
> > i now have:
> > 
> > [% sort = params.sort %]
> > [% statement = DBI.prepare('SELECT * FROM people  LEFT JOIN bios USING (idn) 
> > ORDER BY ?') %]
> > [% FOREACH person = statement.execute("${sort}") %]
> >                                        ^
> >                                        leaving out these quotes breaks the te
> > mplate.
> > 
> > so it looks like the problem is somwhere admist all the reference magic perfo
> > rmed by TT.
> > i would leave it here, but since i'm grabbing the binding variable
> > from the query string i would like to do:
> > 
> > [% sort = DBI.quote(params.sort) %]
> > 
> > but this breaks the template again.
> >                                        
> > i'll go research dereferencing.
> 
> This doesn't sound like a TT issue.
> 
> You should use DBI.quote to quote something that you are
> putting into the prepare() or query() string, not for bind
> or placeholder values.
> 
> >From perldoc DBI:
> 
>          Using placeholders and "@bind_values" with the "do"
>          method can be useful because it avoids the need to
>          correctly quote any variables in the "$statement".
> 
> and:
> 
>          There is no need to quote values being used with the
>          Placeholders and Bind Values entry elsewhere in this
>          document.
> 
> So just use params.sort in your argument to statement.execute.
> 
> Craig
> 
> _______________________________________________
> templates mailing list
> [EMAIL PROTECTED]
> http://www.template-toolkit.org/mailman/listinfo/templates


Reply via email to