2 ms·
The only case I can make for not using them is that in PHP the MySQL prepared statements API is very cumbersome. At my job, we use an ORM PHP abstraction model
by IgorPartola 17y ago
The only case I can make for not using them is that in PHP the MySQL prepared statements API is very cumbersome. At my job, we use an ORM PHP abstraction model that could really benefit from prepared statements, but because of the difficulty of getting a simple associate array of data out of an executed prepared statement, it is nearly impossible for us to convert it to use them. But yes, the benefits clearly outweigh the drawbacks: you get security and performance.
- moron4hire 17y agoNot really an excuse. Layers of abstraction are all about hiding difficulties with using APIs. If PHPs API for accessing prepared statements is cumbersome, then write a wrapper around it that solves the problem once. Hell, I even did it for ADO.NET. ADO.NET is not that hard to use, but a surprising number of developers get a lot of the details wrong, such as when to open and close a connection (i.e. NOT once for every query) and when to dispose objects (at least at some point in the object's lifetime, please!). So, I wrote an ADO.NET wrapper that handles all of that stuff, providing an incredibly thin, simplistic interface. It's been very useful to me, and hopefully other people can find it useful, http://sqlsiphon.codeplex.com http://sqlsiphon.codeplex.com