Merge "database: Fix various scalar and null types"
This commit is contained in:
commit
8d2e09d2bf
3 changed files with 14 additions and 14 deletions
|
|
@ -105,7 +105,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
protected $flags;
|
||||
/** @var array Current LoadBalancer tracking information */
|
||||
protected $lbInfo = [];
|
||||
/** @var string Current SQL query delimiter */
|
||||
/** @var string|false Current SQL query delimiter */
|
||||
protected $delimiter = ';';
|
||||
/** @var array[] Current map of (table => (dbname, schema, prefix) map) */
|
||||
protected $tableAliases = [];
|
||||
|
|
@ -2456,7 +2456,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
$indexInfo = $this->indexInfo( $table, $index, $fname );
|
||||
|
||||
if ( !$indexInfo ) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return !$indexInfo[0]->Non_unique;
|
||||
|
|
@ -2830,7 +2830,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
) {
|
||||
$fld = "GROUP_CONCAT($field SEPARATOR " . $this->addQuotes( $delim ) . ')';
|
||||
|
||||
return '(' . $this->selectSQLText( $table, $fld, $conds, null, [], $join_conds ) . ')';
|
||||
return '(' . $this->selectSQLText( $table, $fld, $conds, __METHOD__, [], $join_conds ) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -3036,7 +3036,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
}
|
||||
|
||||
public function getServerName() {
|
||||
return $this->serverName ?? $this->getServer();
|
||||
return $this->serverName ?? $this->getServer() ?? 'unknown';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -5105,7 +5105,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
}
|
||||
|
||||
try {
|
||||
$error = $this->sourceStream(
|
||||
return $this->sourceStream(
|
||||
$fp,
|
||||
$lineCallback,
|
||||
$resultCallback,
|
||||
|
|
@ -5115,8 +5115,6 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
|
|||
} finally {
|
||||
fclose( $fp );
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
public function setSchemaVars( $vars ) {
|
||||
|
|
|
|||
|
|
@ -265,10 +265,12 @@ class DatabasePostgres extends Database {
|
|||
|
||||
public function lastErrno() {
|
||||
if ( $this->lastResultHandle ) {
|
||||
return pg_result_error_field( $this->lastResultHandle, PGSQL_DIAG_SQLSTATE );
|
||||
} else {
|
||||
return false;
|
||||
$lastErrno = pg_result_error_field( $this->lastResultHandle, PGSQL_DIAG_SQLSTATE );
|
||||
if ( $lastErrno !== false ) {
|
||||
return (int)$lastErrno;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected function fetchAffectedRowCount() {
|
||||
|
|
@ -407,7 +409,7 @@ __INDEXATTR__;
|
|||
")'";
|
||||
$res = $this->query( $sql, $fname, $flags );
|
||||
if ( !$res ) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return $res->numRows() > 0;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ interface IDatabase {
|
|||
* Keys matching the IDatabase::LB_* constants are also used internally by subclasses
|
||||
*
|
||||
* @param array|string $nameOrArray The new array or the name of a key to set
|
||||
* @param array|null $value If $nameOrArray is a string, the new key value (null to unset)
|
||||
* @param array|mixed|null $value If $nameOrArray is a string, the new key value (null to unset)
|
||||
*/
|
||||
public function setLBInfo( $nameOrArray, $value = null );
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ interface IDatabase {
|
|||
/**
|
||||
* Get the last time the connection may have been used for a write query
|
||||
*
|
||||
* @return int|float UNIX timestamp or false
|
||||
* @return int|float|false UNIX timestamp or false
|
||||
* @since 1.24
|
||||
*/
|
||||
public function lastDoneWrites();
|
||||
|
|
@ -2206,7 +2206,7 @@ interface IDatabase {
|
|||
* @param string $method Name of the calling method
|
||||
* @param int $timeout Acquisition timeout in seconds (0 means non-blocking)
|
||||
* @param int $flags Bit field of IDatabase::LOCK_* constants
|
||||
* @return bool Success
|
||||
* @return bool|float Success
|
||||
* @throws DBError If an error occurs, {@see query}
|
||||
*/
|
||||
public function lock( $lockName, $method, $timeout = 5, $flags = 0 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue