1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Hopefully fix MySQL

This commit is contained in:
J. King 2020-12-06 20:27:20 -05:00
parent a431243421
commit ce68566fcb
2 changed files with 2 additions and 6 deletions

View file

@ -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);

View file

@ -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);
}