| @@ 1040-1050 (lines=11) @@ | ||
| 1037 | ||
| 1038 | $mode = strtoupper($mode); |
|
| 1039 | // Consider mode if user not assigned |
|
| 1040 | if ('A' == $mode) { |
|
| 1041 | $s_where = ' WHERE '; |
|
| 1042 | foreach ($pk as $key) |
|
| 1043 | $s_where .= " $key = " . $this->QuoteValue($tbl, $key, $data[0][$key]) |
|
| 1044 | . ' AND '; |
|
| 1045 | $s_where = substr($s_where, 0, strlen($s_where) - 5); |
|
| 1046 | if (0 < $this->GetRowCount($tbl, $s_where)) |
|
| 1047 | $mode = 'U'; |
|
| 1048 | else |
|
| 1049 | $mode = 'I'; |
|
| 1050 | } |
|
| 1051 | ||
| 1052 | // Do batch update or insert, prepare stmt first |
|
| 1053 | $sql = ''; |
|
| @@ 1369-1382 (lines=14) @@ | ||
| 1366 | $sqlCfg = []; |
|
| 1367 | ||
| 1368 | // Auto determine mode |
|
| 1369 | if ('A' == $mode) { |
|
| 1370 | $where = ' WHERE '; |
|
| 1371 | foreach ($arPk as $key) { |
|
| 1372 | $where .= " $key = " |
|
| 1373 | . $this->quoteValue($table, $key, $data[0][$key]) |
|
| 1374 | . ' AND '; |
|
| 1375 | } |
|
| 1376 | $where = substr($where, 0, strlen($where) - 5); |
|
| 1377 | if (0 < $this->getRowCount($table, $where)) { |
|
| 1378 | $mode = 'U'; |
|
| 1379 | } else { |
|
| 1380 | $mode = 'I'; |
|
| 1381 | } |
|
| 1382 | } |
|
| 1383 | ||
| 1384 | // Prepare sql |
|
| 1385 | if ('U' == $mode) { |
|