const PING_TTL = 1.0;
const PING_QUERY = 'SELECT 1 AS ping';
- const TINY_WRITE_SEC = .010;
- const SLOW_WRITE_SEC = .500;
+ const TINY_WRITE_SEC = 0.010;
+ const SLOW_WRITE_SEC = 0.500;
const SMALL_WRITE_ROWS = 100;
/** @var string SQL query */
}
}
+ /**
+ * 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
+ * @return bool
+ */
+ 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 );
+ }
}
}
/**
* @param string $s
+ * @param string $escapeChar
* @return string
*/
protected function escapeLikeInternal( $s, $escapeChar = '`' ) {
* we don't want to select everything into memory
*
* @see IDatabase::insertSelect()
+ * @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 nativeInsertSelect( $destTable, $srcTable, $varMap, $conds,
$fname = __METHOD__,