Code Duplication    Length = 11-14 lines in 2 locations

class/adodb.php 1 location

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

src/Fwlib/Bridge/Adodb.php 1 location

@@ 1367-1380 (lines=14) @@
1364
        $sqlCfg = [];
1365
1366
        // Auto determine mode
1367
        if ('A' == $mode) {
1368
            $where = ' WHERE ';
1369
            foreach ($arPk as $key) {
1370
                $where .= " $key = "
1371
                    . $this->quoteValue($table, $key, $data[0][$key])
1372
                    . ' AND ';
1373
            }
1374
            $where = substr($where, 0, strlen($where) - 5);
1375
            if (0 < $this->getRowCount($table, $where)) {
1376
                $mode = 'U';
1377
            } else {
1378
                $mode = 'I';
1379
            }
1380
        }
1381
1382
        // Prepare sql
1383
        if ('U' == $mode) {