I add another useful detail, in the db cache reloaded fix's faq you can find an useful answer:
Q: I am a plugin developer. How can I make my plugin compatible with DB Cache Reloaded?
A: DB Cache Reloaded uses default WordPress mechanism to load custom version of wpdb class - it creates custom wp-content/db.php file. WordPress checks if this file exists, and loads it instead of wp-includes/wp-db.php.
When your plugin includes this class using custom code added to wp-config.php (or any other file), please use require_wp_db() to do this, or use similar code to this function body.
When you need to modify wpdb class (e.g. by adding or replacing methods), consider deriving your class from the default one (using the extends keyword). Another option is to use aggregation - save value of $wpdb variable, create object of your class and assign to $wpdb. Your class should call methods and access member variables of this saved object, in order to keeps its functionality. Your class should also implement magic methods __get, __set, __isset, __unset and __call.