Zend Db Library:如何删除具有不同约束的多行?
Zend Db Library: How to delete multiple rows with different contraints?
是否可以在不进行黑客攻击的情况下生成 SQL?
DELETE FROM product WHERE (type=1 AND deleted=1) OR (type=2 AND category=10);
使用这个示例:
$db->delete(array('(type=1 AND deleted=1) OR (type=2 AND category=10)'));
或者如果每个 table 都有一个模型 class,那么:
$model = new Product();
$model->delete(array('(type=1 AND deleted=1) OR (type=2 AND category=10)'));
是否可以在不进行黑客攻击的情况下生成 SQL?
DELETE FROM product WHERE (type=1 AND deleted=1) OR (type=2 AND category=10);
使用这个示例:
$db->delete(array('(type=1 AND deleted=1) OR (type=2 AND category=10)'));
或者如果每个 table 都有一个模型 class,那么:
$model = new Product();
$model->delete(array('(type=1 AND deleted=1) OR (type=2 AND category=10)'));