Differential D25106 Diff 449 src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | protected function connect() { | ||||
} | } | ||||
// See T13403. If the parameters to "real_connect()" are wrong, it may | // See T13403. If the parameters to "real_connect()" are wrong, it may | ||||
// fail without setting an error code. In this case, raise a generic | // fail without setting an error code. In this case, raise a generic | ||||
// exception. (One way to reproduce this is to pass a string to the | // exception. (One way to reproduce this is to pass a string to the | ||||
// "port" parameter.) | // "port" parameter.) | ||||
if (!$ok) { | if (!$ok) { | ||||
if (strlen($call_error)) { | if (phutil_nonempty_string($call_error)) { | ||||
$message = pht( | $message = pht( | ||||
'mysqli->real_connect() failed: %s', | 'mysqli->real_connect() failed: %s', | ||||
$call_error); | $call_error); | ||||
} else { | } else { | ||||
$message = pht( | $message = pht( | ||||
'mysqli->real_connect() failed, but did not set an error code '. | 'mysqli->real_connect() failed, but did not set an error code '. | ||||
'or emit a message.'); | 'or emit a message.'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | protected function rawQuery($raw_query) { | ||||
// disabled. | // disabled. | ||||
// If we have no result and no error code, raise a synthetic query error | // If we have no result and no error code, raise a synthetic query error | ||||
// with whatever error message was raised as a local PHP warning. | // with whatever error message was raised as a local PHP warning. | ||||
if (!$result) { | if (!$result) { | ||||
$error_code = $this->getErrorCode($conn); | $error_code = $this->getErrorCode($conn); | ||||
if (!$error_code) { | if (!$error_code) { | ||||
if (strlen($err)) { | if (phutil_nonempty_string($err)) { | ||||
$message = $err; | $message = $err; | ||||
} else { | } else { | ||||
$message = pht( | $message = pht( | ||||
'Call to "mysqli->query()" failed, but did not set an error '. | 'Call to "mysqli->query()" failed, but did not set an error '. | ||||
'code or emit an error message.'); | 'code or emit an error message.'); | ||||
} | } | ||||
$this->throwQueryCodeException(self::CALLERROR_QUERY, $message); | $this->throwQueryCodeException(self::CALLERROR_QUERY, $message); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0