]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/Database.php
NL translation update THX casperrutten33
[friendica.git] / src / Database / Database.php
index 609b86d0e5dae85c3a8f7ef316ac150da8e6dbe4..80fd02dc0d5f230c26cd91057c5ae5c85fe685f2 100644 (file)
@@ -134,6 +134,8 @@ class Database
                        return false;
                }
 
+               $persistent = (bool)$this->configCache->get('database', 'persistent');
+
                $this->emulate_prepares = (bool)$this->configCache->get('database', 'emulate_prepares');
                $this->pdo_emulate_prepares = (bool)$this->configCache->get('database', 'pdo_emulate_prepares');
 
@@ -150,7 +152,7 @@ class Database
                        }
 
                        try {
-                               $this->connection = @new PDO($connect, $user, $pass);
+                               $this->connection = @new PDO($connect, $user, $pass, [PDO::ATTR_PERSISTENT => $persistent]);
                                $this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, $this->pdo_emulate_prepares);
                                $this->connected = true;
                        } catch (PDOException $e) {
@@ -1007,7 +1009,8 @@ class Database
        }
 
        /**
-        * Replace a row of a table
+        * Inserts a row with the provided data in the provided table.
+        * If the data corresponds to an existing row through a UNIQUE or PRIMARY index constraints, it updates the row instead.
         *
         * @param string|array $table Table name or array [schema => table]
         * @param array        $param parameter array
@@ -1418,7 +1421,7 @@ class Database
                        if (is_bool($old_fields)) {
                                if ($do_insert) {
                                        $values = array_merge($condition, $fields);
-                                       return $this->insert($table, $values, $do_insert);
+                                       return $this->replace($table, $values);
                                }
                                $old_fields = [];
                        }