}
}
+ /**
+ * Checks whether the cause of the error is detected to be a timeout.
+ *
+ * It returns false by default, and not all engines support detecting this yet.
+ * If this returns false, it will be treated as a generic query error.
+ *
+ * @param string $error Error text
+ * @param int $errno Error number
+ */
+ protected function wasQueryTimeout( $error, $errno ) {
+ return false;
+ }
+
public function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
if ( $this->ignoreErrors() || $tempIgnore ) {
$this->queryLogger->debug( "SQL ERROR (ignored): $error\n" );
] )
);
$this->queryLogger->debug( "SQL ERROR: " . $error . "\n" );
- throw new DBQueryError( $this, $error, $errno, $sql, $fname );
+ $wasQueryTimeout = $this->wasQueryTimeout( $error, $errno );
+ if ( $wasQueryTimeout ) {
+ throw new DBQueryTimeoutError( $this, $error, $errno, $sql, $fname );
+ } else {
+ throw new DBQueryError( $this, $error, $errno, $sql, $fname );
+ }
}
}
);
}
+ return $this->nonNativeInsertSelect(
+ $destTable,
+ $srcTable,
+ $varMap,
+ $conds,
+ $fname,
+ $insertOptions,
+ $selectOptions,
+ $selectJoinConds
+ );
+ }
+
+ /**
+ * Implementation of insertSelect() based on select() and insert()
+ *
+ * @see IDatabase::insertSelect()
+ * @since 1.30
+ * @param string $destTable
+ * @param string|array $srcTable
+ * @param array $varMap
+ * @param array $conds
+ * @param string $fname
+ * @param array $insertOptions
+ * @param array $selectOptions
+ * @param array $selectJoinConds
+ * @return bool
+ */
+ protected function nonNativeInsertSelect( $destTable, $srcTable, $varMap, $conds,
+ $fname = __METHOD__,
+ $insertOptions = [], $selectOptions = [], $selectJoinConds = []
+ ) {
// For web requests, do a locking SELECT and then INSERT. This puts the SELECT burden
// on only the master (without needing row-based-replication). It also makes it easy to
// know how big the INSERT is going to be.