protected function lazyConnect($func)
    {
        // do not reconnect
        if ($this->link) {
            return;
        }

        // connect only for functions that need a link
        if (! isset($this->link_arg[$func])) {
            return;
        }

        // connect and retain the identifier
        $this->link = mysql_connect(
            $this->server,
            $this->username,
            $this->password,
            $this->new_link,
            $this->client_flags
        );

        // throw exception on error
        if (! $this->link) {
            throw new RuntimeException(
                mysql_error(),
                mysql_errno()
            );
        }
    }