adodb、pdo 或其他,我想要自动执行
我曾经使用 PEAR MDB2,我喜欢的东西之一是 autoExecute()
它确实减少了代码量。
但在某些托管服务器上启用 MDB2 是一件很痛苦的事情。我想使用 PDO 或仅包含一些类文件。
看起来adodb也有autoExecute http://phplens.com/lens/adodb/docs-adodb.htm# autoexecute
是否有任何包装器可以让我使用 PDO 或 mysqli 来执行此操作? (因为我所有的东西都是 mysql 特定的)
$table = 'user';
$data = array (
'userid' => '3344',
'name' => 'john blogg',
'age' => '24',
'sex' => 'male'
);
$result = $adodb->AutoExecute($table, $data, 'INSERT');
I used to use PEAR MDB2 and one of the things I loved was the autoExecute()
It really cut down on code.
But's it's a pain having to get MDB2 enabled on some hosted servers. I'd like to use either PDO or just include some class file.
It looks like adodb has autoExecute too
http://phplens.com/lens/adodb/docs-adodb.htm#autoexecute
Is there any wrapper out there that would let me do it with PDO or mysqli even? (because all my stuff is mysql specific anyway)
$table = 'user';
$data = array (
'userid' => '3344',
'name' => 'john blogg',
'age' => '24',
'sex' => 'male'
);
$result = $adodb->AutoExecute($table, $data, 'INSERT');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PEAR 的优点是您可以自己下载所有文件,并将它们放入您自己的项目树中。无论如何,如果没有可用的“共享”PEAR 位置,请提供您自己的位置。
将其构建到您自己的 PDO 类中将非常简单,请查看 http://phpxref.com/xref/pear/MDB2/Extended.php.source.html,它们非常基本,您应该能够在 30 行以内获得一些等效的代码。
The beaty of PEAR is you can download all the files yourself, and put them in your own project tree. By all means, if there is no 'shared' PEAR location available, just provide your own.
Building it into your own PDO class would be quite trivial, look at the functions at http://phpxref.com/xref/pear/MDB2/Extended.php.source.html, they're pretty basic, you should be able to get some equivalent code in under 30 lines.