$hasAllFields =
count(array_intersect($index->fields,
$fieldNames)) ===
count($index->fields
);
return ($index->type === 'UNIQUE' ||
$index->type === 'PRIMARY'
) &&
$hasAllFields;
});
foreach (array_map(static fn ($index) =>
$index->fields,
$allIndexes) as $index) { $constraints[] =
current($index);
// only one index can be used?
break;
} $constraints =
$this->
onConstraint($constraints)->QBOptions
['constraints'
] ??
[];
} if (empty($constraints)) { if ($this->db->DBDebug
) { throw new DatabaseException('No constraint found for upsert.'
);
} return ''; // @codeCoverageIgnore
} // in value set - replace null with DEFAULT where constraint is presumed not null