Browse Source

Hopefully fix MySQL

rpm
J. King 3 years ago
parent
commit
ce68566fcb
  1. 2
      lib/Database.php
  2. 6
      lib/Db/MySQL/Statement.php

2
lib/Database.php

@ -321,7 +321,7 @@ class Database {
throw new User\ExceptionConflict("doesNotExist", ["action" => __FUNCTION__, "user" => $user]);
}
$update = $this->db->prepare("UPDATE arsse_user_meta set value = ? where owner = ? and \"key\" = ?", "str", "str", "str");
$insert = ["INSERT INTO arsse_user_meta values(?, ?, ?)", "str", "strict str", "str"];
$insert = ["INSERT INTO arsse_user_meta select ?, ?, ? where not exists(select 1 from arsse_user_meta where owner = ? and \"key\" = ?)", "str", "strict str", "str", "str", "strict str"];
foreach ($data as $k => $v) {
if ($k === "admin") {
$this->db->prepare("UPDATE arsse_users SET admin = ? where id = ?", "bool", "str")->run($v, $user);

6
lib/Db/MySQL/Statement.php

@ -84,11 +84,7 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
}
// create a result-set instance
$r = $this->st->get_result();
if (preg_match("\d+", mysqli_info($this->db), $m)) {
$changes = (int) $m[0];
} else {
$changes = 0;
}
$changes = $this->st->affected_rows;
$lastId = $this->st->insert_id;
return new Result($r, [$changes, $lastId], $this);
}

Loading…
Cancel
Save