Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: DBI prepare_cached and DBD::Sybase

by mpeppler (Vicar)
on May 20, 2002 at 20:39 UTC ( [id://167954]=note: print w/replies, xml ) Need Help??


in reply to Re: DBI prepare_cached and DBD::Sybase
in thread DBI prepare_cached and DBD::Sybase

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:

... WHERE (product_code = ? OR (? IS NULL AND product_code IS NULL))
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://167954]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-25 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found