Add MariaDB queue table. Fix Bugs

This commit is contained in:
2026-10-18 15:58:02 +01:00
parent d872c3661a
commit f9ba5f8657
28 changed files with 785 additions and 49 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ import sanitizeHtmlFields from "../../utils/sanitize-html-fields";
import { quoteIdentifier } from "../../utils/sql-identifier";
import sqlValuePlaceholder from "../../utils/sql-value-placeholder";
import grabTableFields from "../../utils/grab-table-fields";
import { assertNoProtectedQueueFields, isQueueTable, QUEUE_NOT_CLAIMED_SQL, } from "../queue/queue-utils";
/** Thrown inside the transaction to roll back and return a response */
class UpdateAbort extends Error {
response;
@@ -26,13 +27,17 @@ export default async function DbUpdate({ table, data, query, targetId, config, }
genObject: finalQuery,
targetId,
});
const whereClause = sqlQueryObj.where;
let whereClause = sqlQueryObj.where;
if (!whereClause) {
return {
success: false,
msg: `No WHERE clause`,
};
}
if (isQueueTable(table)) {
assertNoProtectedQueueFields(table, [data]);
whereClause += ` AND ${QUEUE_NOT_CLAIMED_SQL}`;
}
const sanitizedData = sanitizeHtmlFields({
table,
data,