On Mon, Oct 27, 2003 at 07:37:18AM -0800, Dean Arnold wrote: > > > > Google for my previous posts about a preparse() method for my > > thinking on handling client-side parsing for placeholders and > > SQL translations. (This work hasn't got very far and if it doesn't > > soon I'll be asking for volunteers with Parse::RecDescent experience > > to step forward.) > > Is the purpose of this solely for placeholders, or is this an attempt > at a universal SQL syntax (ala ODBC's conformance levels) ?
Somewhere in between. > I assume that using existing platform-specific SQL will still be > permitted (wo/ lots of ANSI escape clauses) ? Of course. > (I'd hate to see DBI turn into a LCD-only lib) Likewise. > > For the binding I really don't want to add new methods, so the > > driver would need to be changed to recognise a bind_param to a named > > placeholder and get the corresponding set of placeholder index > > values to use. > > > > Now a question to all: which database servers, other than Oracle, > > support named placeholders and what syntax do they use? > > Teradata supports named placeholders. The syntax is > :NAME, ie, SELECT * FROM TABLE WHERE COL1 = :col1; So it matches Oracle syntax. Does DBD::Teradata allow $sth->bind_param(":col1", $foo); like DBD::Oracle? If not, could it? > BTW: I don't see anything in DBI 1.38 that checks for > numeric parameter ID in bind_param() (tho bind_param_array() does), > so is it safe to assume individual drivers *could* just implement such > (non-portable) support on their own Yes. DBD::Oracle always has. > (excluding array-binding support, and the "default" > binding via execute()/execute_array()). Which also raises the issue of how > the default bindings would map to named PHs (perhaps a simple arrayref > of the names supplied as an attribute ?) No. The only thing I'd be happy with is what DBD::Oracle does. Use implicit placeholder names for the value so $sth->execute($foo, $bar); is the same as $sth->bind_param(":p1", $foo) $sth->bind_param(":p2", $bar) $sth->execute(); Interestingly, the way it does that is to translate 'normal' placeholders into :p1, :p2 etc when the SQL is prepared. Then bind_param(1, ...) is treated as bind_param(":p1",...) which then means the Driver.xst for execute() "just works". Tim.