diff options
Diffstat (limited to 'lib/private/DB')
-rw-r--r-- | lib/private/DB/AdapterPgSql.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php index 47ef4dff037..86f2fe2e384 100644 --- a/lib/private/DB/AdapterPgSql.php +++ b/lib/private/DB/AdapterPgSql.php @@ -35,4 +35,16 @@ class AdapterPgSql extends Adapter { $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); return $statement; } + + public function insertIgnoreConflict($table, $input) : int { + $builder = $this->conn->getQueryBuilder(); + $builder->insert($table) + ->values($input); + foreach($input as $key => $value) { + $builder->setValue($key, $builder->createNamedParameter($value)); + } + $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; + $inserts = array_values($input); + return $this->conn->executeUpdate($queryString, $inserts); + } } |