connect(); if ( $errNo == 0) { $result = $this->query($sql); $this->disconnect(); return $result; } else { $this->disconnect(); throw new DbConnectException('Cannot establish connection to database.', $errNo); } } }