MediaWiki REL1_34
DBQueryError.php
Go to the documentation of this file.
1<?php
22namespace 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
73class_alias( DBQueryError::class, 'DBQueryError' );
IDatabase null $db
Definition DBError.php:32
Base class for the more common types of database errors.
__construct(IDatabase $db, $error, $errno, $sql, $fname, $message=null)
Relational database abstraction object.
Definition Database.php:49
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38