If you've got the following error message when upgrading WordPress to the version 3.1:
Fatal error: Call to a member function query() on a non-object in /home/<...>/wp-content/db.php on line 4
then nothing serious has happened. Likely you're very long time user of WordPress and had upgraded numerous its versions already.
To fix this problem, it's enough to delete (OK, simple to move into an archive directory) the file db.php from the directory wp-content, and add the following line into your wp-config.php file:
define('DB_CHARSET', 'utf8');
NB: place the charset of your blog database instead of utf8 if applicaple.