Re: DBD::Sybase placeholder support
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Dan Wierenga wrote: > > If you send me a TDSDUMP log, I hope I'd be able to tell you how it > > works. > > Script and log attached. Another surprise: that's a TDS 4.2 log. Does it also work with TDS 7.0? As to why it works, all I can say is that ct_dynamic was added in 2005 and reworked somewhat in 2006. Placeholder support is entirely client-side in 4.2; the query is sent interpolated to the server: net.c:673:Sending packet 0000 01 01 00 2f 00 00 00 00-53 45 4c 45 43 54 20 62 |.../.... SELECT b| 0010 61 72 20 46 52 4f 4d 20-64 61 6e 6f 20 57 48 45 |ar FROM dano WHE| 0020 52 45 20 66 6f 6f 20 3d-20 27 6f 69 6e 6b 27 |RE foo = 'oink'| The client isn't getting any server-side benefit; the server isn't preparing and caching a query plan. Any benefit is limited to programming style. With TDS 7.0, we use Microsoft's secret stored procedures e.g. sp_executesql. That's what I think doesn't work with ct-lib. But I'm happy to be proved wrong! Frediano, do we have any documentation -- ours or Microsoft's -- on sp_prepare, sp_executesql, etc.? We should add it to tds.html. --jkl