MediaWiki  master
QueryStatus.php
Go to the documentation of this file.
1 <?php
20 namespace Wikimedia\Rdbms;
21 
26 class QueryStatus {
28  public $res;
30  public $rowsReturned;
32  public $rowsAffected;
34  public $message;
36  public $code;
38  public $flags;
39 
48  public function __construct( $res, int $affected, string $error, $errno ) {
49  if ( !( $res instanceof IResultWrapper ) && !is_bool( $res ) && $res !== null ) {
50  throw new DBUnexpectedError(
51  null,
52  'Got ' . gettype( $res ) . ' instead of IResultWrapper|bool'
53  );
54  }
55 
56  $this->res = $res;
57  $this->rowsReturned = ( $res instanceof IResultWrapper ) ? $res->numRows() : 0;
58  $this->rowsAffected = $affected;
59  $this->message = $error;
60  $this->code = $errno;
61  $this->flags = 0;
62  }
63 }
int $flags
Error flag bit field of Database::ERR_* constants.
Definition: QueryStatus.php:38
ResultWrapper bool null $res
Result set.
Definition: QueryStatus.php:28
int $rowsReturned
Returned row count.
Definition: QueryStatus.php:30
int $rowsAffected
Affected row count.
Definition: QueryStatus.php:32
int string $code
Error code or zero.
Definition: QueryStatus.php:36
string $message
Error message or empty string.
Definition: QueryStatus.php:34
__construct( $res, int $affected, string $error, $errno)
Definition: QueryStatus.php:48
numRows()
Get the number of rows in a result object.
Result wrapper for grabbing data queried from an IDatabase object.