MCPcopy
hub / github.com/sequelize/sequelize / deleteQuery

Method deleteQuery

lib/dialects/db2/query-generator.js:500–526  ·  view source on GitHub ↗
(tableName, where, options = {}, model)

Source from the content-addressed store, hash-verified

498 }
499
500 deleteQuery(tableName, where, options = {}, model) {
501 const table = this.quoteTable(tableName);
502 const query = 'DELETE FROM <%= table %><%= where %><%= limit %>';
503
504 where = this.getWhereConditions(where, null, model, options);
505
506 let limit = '';
507
508 if (options.offset > 0) {
509 limit = ` OFFSET ${ this.escape(options.offset) } ROWS`;
510 }
511 if (options.limit) {
512 limit += ` FETCH NEXT ${ this.escape(options.limit) } ROWS ONLY`;
513 }
514
515 const replacements = {
516 limit,
517 table,
518 where
519 };
520
521 if (replacements.where) {
522 replacements.where = ` WHERE ${replacements.where}`;
523 }
524
525 return _.template(query, this._templateSettings)(replacements);
526 }
527
528 showIndexesQuery(tableName) {
529 let sql = 'SELECT NAME AS "name", TBNAME AS "tableName", UNIQUERULE AS "keyType", COLNAMES, INDEXTYPE AS "type" FROM SYSIBM.SYSINDEXES WHERE TBNAME = <%= tableName %>';

Callers 3

deleteMethod · 0.45
bulkDeleteMethod · 0.45
delete.test.jsFile · 0.45

Calls 3

quoteTableMethod · 0.80
getWhereConditionsMethod · 0.80
escapeMethod · 0.45

Tested by

no test coverage detected