Expose MySQL affected row counts

This commit is contained in:
udo
2026-07-13 07:10:03 +00:00
parent 7281302287
commit d857930ceb
8 changed files with 50 additions and 1 deletions
+14 -1
View File
@@ -131,8 +131,21 @@ RENDER(Request& context)
(dbs.find("information_schema") != String::npos || dbs.find("mysql") != String::npos) ? "pass" : "fail",
dbs.substr(0, dbs.length() > 220 ? 220 : dbs.length())
);
mysql.query("USE mysql");
mysql.query("CREATE TEMPORARY TABLE uce_affected_rows_test (id INT PRIMARY KEY, value INT NOT NULL)");
mysql.query("INSERT INTO uce_affected_rows_test VALUES (1,10),(2,20)");
u32 inserted = mysql_affected_rows(&mysql);
mysql.query("UPDATE uce_affected_rows_test SET value=value+1 WHERE id=1");
u32 updated = mysql_affected_rows(&mysql);
mysql.query("SELECT * FROM uce_affected_rows_test");
u32 selected = mysql_affected_rows(&mysql);
mark(
"mysql_affected_rows()",
inserted == 2 && updated == 1 && selected == 0 ? "pass" : "fail",
"inserted=" + std::to_string((u64)inserted) + " updated=" + std::to_string((u64)updated) + " selected=" + std::to_string((u64)selected)
);
}
site_tests_summary(passed, failed, skipped, "Memcache or MySQL checks are allowed to skip cleanly when the corresponding service is not available on the development host.");
site_tests_page_end();
}
}