Code Duplication    Length = 16-19 lines in 2 locations

includes/db/DatabaseMssql.php 1 location

@@ 492-510 (lines=19) @@
489
	 * @param array $options
490
	 * @return int
491
	 */
492
	public function estimateRowCount( $table, $vars = '*', $conds = '',
493
		$fname = __METHOD__, $options = []
494
	) {
495
		// http://msdn2.microsoft.com/en-us/library/aa259203.aspx
496
		$options['EXPLAIN'] = true;
497
		$options['FOR COUNT'] = true;
498
		$res = $this->select( $table, $vars, $conds, $fname, $options );
499
500
		$rows = -1;
501
		if ( $res ) {
502
			$row = $this->fetchRow( $res );
503
504
			if ( isset( $row['EstimateRows'] ) ) {
505
				$rows = (int)$row['EstimateRows'];
506
			}
507
		}
508
509
		return $rows;
510
	}
511
512
	/**
513
	 * Returns information about an index

includes/libs/rdbms/database/DatabasePostgres.php 1 location

@@ 412-427 (lines=16) @@
409
	 * @param array $options
410
	 * @return int
411
	 */
412
	function estimateRowCount( $table, $vars = '*', $conds = '',
413
		$fname = __METHOD__, $options = []
414
	) {
415
		$options['EXPLAIN'] = true;
416
		$res = $this->select( $table, $vars, $conds, $fname, $options );
417
		$rows = -1;
418
		if ( $res ) {
419
			$row = $this->fetchRow( $res );
420
			$count = [];
421
			if ( preg_match( '/rows=(\d+)/', $row[0], $count ) ) {
422
				$rows = (int)$count[1];
423
			}
424
		}
425
426
		return $rows;
427
	}
428
429
	/**
430
	 * Returns information about an index