3 ms·
This is one of those types of things that shouldn’t happen anymore, but does. I’m pretty sure that WordPress now has their own low-level version of PDO Prepare
by ChrisMarshallNY 5y ago
This is one of those types of things that shouldn’t happen anymore, but does.
I’m pretty sure that WordPress now has their own low-level version of PDO Prepared Statements. Also, they have a lot of even higher-level DB abstractions. I can’t think of any reason to directly access the DB from a plugin or theme.
- madsohm 5y ago> I can’t think of any reason to directly access the DB from a plugin or theme. Because it's PHP and it's easy.
- ChrisMarshallNY 5y agoToo true. It’s not PHP’s fault, though. The same type of argument is applied to C++. We keep developing “nerf-world” languages, designed to protect ourselves from ourselves, and most fall down before they get a chance to even get going; mostly because they constrain, without empowering. I remember moving to Pascal, after using Assembly and Machine Code. It was very frustrating for me. Pascal was one of the earliest “safe” languages. The problem is that we can’t build houses, using PlaySkool “Li’l Builder” toolsets. Also, the WP Codex is really disorganized. It’s difficult to find anything in it, and that is deadly. Geeks like to design clever architectures, but we hate to document them.
- tyingq 5y ago>I’m pretty sure that WordPress now has their own low-level version of PDO Prepared Statements. I imagine it's well tested, but it's a bunch of PHP escaping and regexes inside of wp-db.php. It is not at all real placeholders and prepared statements, though the functions are named that way. I suppose because there's too much tech debt to use normal placeholders.
- ChrisMarshallNY 5y agoAh ... well, it's better than nothing. For me, I always use PDO, and prepared statements and transactions. I get a lot of power, for free. I'm not a particularly good DB programmer, so I need all the help I can get.