MCPcopy Create free account
hub / github.com/ChakshuGautam/stylusdb-sql / parseDeleteQuery

Function parseDeleteQuery

src/queryParser.js:229–248  ·  view source on GitHub ↗
(query)

Source from the content-addressed store, hash-verified

227}
228
229function parseDeleteQuery(query) {
230 const deleteRegex = /DELETE FROM (\w+)( WHERE (.*))?/i;
231 const match = query.match(deleteRegex);
232
233 if (!match) {
234 throw new Error("Invalid DELETE syntax.");
235 }
236
237 const [, table, , whereString] = match;
238 let whereClauses = [];
239 if (whereString) {
240 whereClauses = parseWhereClause(whereString);
241 }
242
243 return {
244 type: 'DELETE',
245 table: table.trim(),
246 whereClauses
247 };
248}
249
250
251module.exports = { parseSelectQuery, parseJoinClause, parseInsertQuery, parseDeleteQuery };

Callers 1

executeDELETEQueryFunction · 0.85

Calls 1

parseWhereClauseFunction · 0.85

Tested by

no test coverage detected