function _connect()
 {
     global $_DB_DATAOBJECT;
     $sum = $this->_getDbDsnMD5();
     if (!empty($_DB_DATAOBJECT['CONNECTIONS'][$sum]) && !PEAR::isError($_DB_DATAOBJECT['CONNECTIONS'][$sum])) {
         $exists = true;
     } else {
         $exists = false;
     }
     // @fixme horrible evil hack!
     //
     // In multisite configuration we don't want to keep around a separate
     // connection for every database; we could end up with thousands of
     // connections open per thread. In an ideal world we might keep
     // a connection per server and select different databases, but that'd
     // be reliant on having the same db username/pass as well.
     //
     // MySQL connections are cheap enough we're going to try just
     // closing out the old connection and reopening when we encounter
     // a new DSN.
     //
     // WARNING WARNING if we end up actually using multiple DBs at a time
     // we'll need some fancier logic here.
     if (!$exists && !empty($_DB_DATAOBJECT['CONNECTIONS']) && php_sapi_name() == 'cli') {
         foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $index => $conn) {
             if (!empty($conn)) {
                 $conn->disconnect();
             }
             unset($_DB_DATAOBJECT['CONNECTIONS'][$index]);
         }
     }
     $result = parent::_connect();
     if ($result && !$exists) {
         $DB =& $_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
         if (common_config('db', 'type') == 'mysql' && common_config('db', 'utf8')) {
             $conn = $DB->connection;
             if (!empty($conn)) {
                 if ($DB instanceof DB_mysqli) {
                     mysqli_set_charset($conn, 'utf8');
                 } else {
                     if ($DB instanceof DB_mysql) {
                         mysql_set_charset('utf8', $conn);
                     }
                 }
             }
         }
         // Needed to make timestamp values usefully comparable.
         if (common_config('db', 'type') == 'mysql') {
             parent::_query("set time_zone='+0:00'");
         }
     }
     return $result;
 }
 function delete()
 {
     $this->decache();
     # while we still have the values!
     return parent::delete();
 }
 function delete($useWhere = false)
 {
     $this->decache();
     return parent::delete($useWhere);
 }
 function delete()
 {
     $ret = parent::delete();
     $this->decache();
     return $ret;
 }
 function delete($useWhere = false)
 {
     $this->decache();
     # while we still have the values!
     return parent::delete($useWhere);
 }