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

@@ 405-420 (lines=16) @@
402
	 * @param array $options
403
	 * @return int
404
	 */
405
	public function estimateRowCount( $table, $vars = '*', $conds = '',
406
		$fname = __METHOD__, $options = []
407
	) {
408
		$options['EXPLAIN'] = true;
409
		$res = $this->select( $table, $vars, $conds, $fname, $options );
410
		$rows = -1;
411
		if ( $res ) {
412
			$row = $this->fetchRow( $res );
413
			$count = [];
414
			if ( preg_match( '/rows=(\d+)/', $row[0], $count ) ) {
415
				$rows = (int)$count[1];
416
			}
417
		}
418
419
		return $rows;
420
	}
421
422
	public function indexInfo( $table, $index, $fname = __METHOD__ ) {
423
		$sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'";