There's more than one way to do things | |
PerlMonks |
Re: Re: DBI prepare_cached and DBD::Sybaseby mpeppler (Vicar) |
on May 20, 2002 at 20:39 UTC ( [id://167954]=note: print w/replies, xml ) | Need Help?? |
The CTlib API supports placeholders (and I've even added that support to Sybase::CTlib). But the support is in the server - this means that some code examples given in the DBI man page fail miserably. In particular, perldoc DBI mentions that to include NULL values from placeholders in a WHERE clause you need to do something like this: This will fail miserably with Sybase, because Sybase will attempt to find the datatype of each placeholder by matching it with a column. The ? is null doesn't map to any column name, so Sybase returns an error. Whether this is a behavior that is valid or not is maybe debatable, but the great advantage is that Sybase knows the datatype of each placeholder when you execute a prepared statement - no need to bind them with a specific datatype (and in fact using bind_param() with a datatype will ignore the hint). Cross-platform APIs are non-trivial, and cross-platform programming with databases is even more so because various forms of SQL syntax can have a huge impact on performance. Michael
In Section
Meditations
|
|