Code Duplication    Length = 11-14 lines in 2 locations

class/adodb.php 1 location

@@ 1041-1051 (lines=11) @@
1038
1039
		$mode = strtoupper($mode);
1040
		// Consider mode if user not assigned
1041
		if ('A' == $mode) {
1042
			$s_where = ' WHERE ';
1043
			foreach ($pk as $key)
1044
				$s_where .= " $key = " . $this->QuoteValue($tbl, $key, $data[0][$key])
1045
					. ' AND ';
1046
			$s_where = substr($s_where, 0, strlen($s_where) - 5);
1047
			if (0 < $this->GetRowCount($tbl, $s_where))
1048
				$mode = 'U';
1049
			else
1050
				$mode = 'I';
1051
		}
1052
1053
		// Do batch update or insert, prepare stmt first
1054
		$sql = '';

src/Fwlib/Bridge/Adodb.php 1 location

@@ 1467-1480 (lines=14) @@
1464
        $sqlCfg = [];
1465
1466
        // Auto determine mode
1467
        if ('A' == $mode) {
1468
            $where = ' WHERE ';
1469
            foreach ($arPk as $key) {
1470
                $where .= " $key = "
1471
                    . $this->quoteValue($table, $key, $data[0][$key])
1472
                    . ' AND ';
1473
            }
1474
            $where = substr($where, 0, strlen($where) - 5);
1475
            if (0 < $this->getRowCount($table, $where)) {
1476
                $mode = 'U';
1477
            } else {
1478
                $mode = 'I';
1479
            }
1480
        }
1481
1482
        // Prepare sql
1483
        if ('U' == $mode) {