public function delete($table, $where)
    {
        $context = $this->getCommandContext();
        $context->table    = $table;
        $context->data    = null;
        $context->where    = $where;
        $context->operation    = AnDatabase::OPERATION_DELETE;

        //Excute the delete operation
        if ($this->getCommandChain()->run('before.delete', $context) !== false) {
            //Create query statement
            $context->query = 'DELETE FROM '.$this->quoteName($this->getTableNeedle().$context->table)
                  .' '.$context->where
            ;

            //Execute the query
            $context->result = $this->execute($context->query);

            $context->affected = $this->_affected_rows;
            $this->getCommandChain()->run('after.delete', $context);
        }

        return $context->affected;
    }