MediaWiki  1.34.0
DBQueryError.php
Go to the documentation of this file.
1 <?php
22 namespace Wikimedia\Rdbms;
23 
29  public $error;
31  public $errno;
33  public $sql;
35  public $fname;
36 
45  public function __construct( IDatabase $db, $error, $errno, $sql, $fname, $message = null ) {
46  if ( $message === null ) {
47  if ( $db instanceof Database && $db->wasConnectionError( $errno ) ) {
48  $message = "A connection error occurred during a query. \n" .
49  "Query: $sql\n" .
50  "Function: $fname\n" .
51  "Error: $errno $error\n";
52  } else {
53  $message = "A database query error has occurred. Did you forget to run " .
54  "your application's database schema updater after upgrading? \n" .
55  "Query: $sql\n" .
56  "Function: $fname\n" .
57  "Error: $errno $error\n";
58  }
59  }
60 
61  parent::__construct( $db, $message );
62 
63  $this->error = $error;
64  $this->errno = $errno;
65  $this->sql = $sql;
66  $this->fname = $fname;
67  }
68 }
69 
73 class_alias( DBQueryError::class, 'DBQueryError' );
Wikimedia\Rdbms\DBError\$db
IDatabase null $db
Definition: DBError.php:32
Wikimedia\Rdbms\Database
Relational database abstraction object.
Definition: Database.php:49
Wikimedia\Rdbms\DBQueryError\$errno
int $errno
Definition: DBQueryError.php:31
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
Wikimedia\Rdbms\DBQueryError\$fname
string $fname
Definition: DBQueryError.php:35
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
Wikimedia\Rdbms\DBQueryError
Definition: DBQueryError.php:27
Wikimedia\Rdbms\DBQueryError\$sql
string $sql
Definition: DBQueryError.php:33
Wikimedia\Rdbms\DBQueryError\__construct
__construct(IDatabase $db, $error, $errno, $sql, $fname, $message=null)
Definition: DBQueryError.php:45
Wikimedia\Rdbms\DBExpectedError
Base class for the more common types of database errors.
Definition: DBExpectedError.php:32
Wikimedia\Rdbms\DBQueryError\$error
string $error
Definition: DBQueryError.php:29