summaryrefslogtreecommitdiffstats
path: root/lib/private/DB/Adapter.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/DB/Adapter.php')
-rw-r--r--lib/private/DB/Adapter.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php
index b9a5f272c57..139b7828596 100644
--- a/lib/private/DB/Adapter.php
+++ b/lib/private/DB/Adapter.php
@@ -126,4 +126,17 @@ class Adapter {
return 0;
}
}
+
+ public function insertIgnoreConflict($table, $input) : int {
+ try {
+ $builder = $this->conn->getQueryBuilder();
+ $builder->insert($table);
+ foreach($input as $key => $value) {
+ $builder->setValue($key, $builder->createNamedParameter($value));
+ }
+ return $builder->execute();
+ } catch(UniqueConstraintViolationException $e) {
+ return 0;
+ }
+ }
}