CMSPAD的数据库支持SQL预编译和批量执行特性了。
CMSPAD1.2版开始,系统在支持数据库集群和主从数据库基础上,开始支持SQL预编译和批量执行特性了,下面看看如何执行吧:
<?php require_once './kernel/global.php'; $db = cmspad_database(); // 执行一条SQL语句 $db->query('SELECT * FROM hello'); // 批量执行SQL语句 $db->addBatch('UPDATE hello SET world = 1 WHERE id = 7'); $db->addBatch('UPDATE hello SET world = 2 WHERE id = 8'); $db->addBatch('UPDATE hello SET world = 3 WHERE id = 9'); $db->executeBatch(); // 预编译SQL语句 $stmt = $db->prepare('SELECT * FROM hello WHERE id = ?'); $stmt->setInteger(0, 7); $resultSet = $stmt->execute(); $stmt->close(); ?>
相关推荐
技术驱动人生 2020-04-24
mryangjx 2019-11-11
zmjzhangmj 2019-09-17
我是一棵树 2019-04-24
LadyZhong 2019-07-01
沉着前进 2019-06-30
晶莹的代码 2019-06-30
dangzhangjing 2019-06-30
Stephenmu 2012-05-24
helloxiaoliang 2019-06-27
gigipop 2019-06-27
yaodilu 2019-06-27
impress 2019-06-27
MarkArch 2019-06-27
huangzhe0 2011-02-11
陈浩 2019-06-21
步行者 2010-03-20