public function lockTable($base, $name)
    {
        $query = 'LOCK TABLES '.$this->quoteName($this->getTableNeedle().$base).' WRITE';

        if ($base != $name) {
            $query .= ', '.$this->quoteName($this->getTableNeedle().$name).' READ';
        }

        // Create commandchain context.
        $context = $this->getCommandContext();
        $context->table = $base;
        $context->query = $query;

        if ($this->getCommandChain()->run('before.locktable', $context) !== false) {
            $context->result = $this->execute($context->query, AnDatabase::RESULT_USE);
            $this->getCommandChain()->run('after.locktable', $context);
        }

        return $context->result;
    }