public function grant()
    {
        if (!$this->name) {
            throw new UnexpectedValueException(
                'Cannot grant privileges to a user with no name'
            );
        }
        if (!$this->grants) {
            throw new UnexpectedValueException(
                'Cannot grant privileges without being told what privileges to grant'
            );
        }
        if (!$this->grantLevel) {
            throw new UnexpectedValueException(
                'Cannot grant privileges without being told on what to grant them'
            );
        }

        $params = array();
        $parts = array(
            sprintf(
                'GRANT %s ON %s',
                strtolower($this->grants) == 'all'
                    ? 'ALL PRIVILEGES'
                    : $this->grants,
                $this->grantLevel
            )
        );

        $parts[] = 'TO :user';
        $params[':user'] = $this->name;

        if ($this->host) {
            $parts[] = '@:host';
            $params[':host'] = strtolower($this->host) == 'any' ? '%' : $this->host;
        }

        if ($this->grantGrant) {
            $parts[] = 'WITH GRANT OPTION';
        }
        
        // Wrap in 'FLUSH PRIVILEGES' commands to update in-memory state
        $this->client->execute('FLUSH PRIVILEGES');
        $this->client->execute(implode(' ', $parts), $params);
        $this->client->execute('FLUSH PRIVILEGES');
    }