Add MariaDB queue table. Fix Bugs
This commit is contained in:
Vendored
+6
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user