Asf_Db_AbstractAdapter::delete

数据行删除

默认在SQL语句末尾增加 limit 1, 当参数$limit被设置成0时, 代表关闭delete保险杠


Description

public bool delete(array $condition [, int $limit = 1])

Parameters

condition

需要一个关联数组 key => value 键值对

limit

默认值1, 简称保险杠; 设置0关闭; SQLite数据库不生效

Return Values

true 代表成功, false 代表失败

Examples

Example #1 Connect MySQL Database

<?php
$configs = array(
    'dsn' => array('host' => '127.0.0.1', 'dbname' => 'test', 'port' => 6666),
    'username' => 'test',
    'password' => 'AbcdefRDvgedf',
);

$mysql = new Asf_Db_Adapter_Mysql($configs);
$mysql->setTableName('test1');

// DELETE FROM `test1` WHERE `status` = ?
// bindValue: 2
$del = array('status' => 2);
var_dump($mysql->delete($del));