(tableName, where, options = {}, model)
| 508 | } |
| 509 | |
| 510 | deleteQuery(tableName, where, options = {}, model) { |
| 511 | const table = this.quoteTable(tableName); |
| 512 | const query = 'DELETE FROM <%= table %><%= where %><%= limit %>'; |
| 513 | |
| 514 | where = this.getWhereConditions(where, null, model, options); |
| 515 | |
| 516 | let limit = ''; |
| 517 | |
| 518 | if (options.offset > 0) { |
| 519 | limit = ` OFFSET ${ this.escape(options.offset) } ROWS`; |
| 520 | } |
| 521 | if (options.limit) { |
| 522 | limit += ` FETCH NEXT ${ this.escape(options.limit) } ROWS ONLY`; |
| 523 | } |
| 524 | |
| 525 | const replacements = { |
| 526 | limit, |
| 527 | table, |
| 528 | where |
| 529 | }; |
| 530 | |
| 531 | if (replacements.where) { |
| 532 | replacements.where = ` WHERE ${replacements.where}`; |
| 533 | } |
| 534 | |
| 535 | return _.template(query, this._templateSettings)(replacements); |
| 536 | } |
| 537 | |
| 538 | showIndexesQuery(tableName) { |
| 539 | let sql = 'SELECT NAME AS "name", TBNAME AS "tableName", UNIQUERULE AS "keyType", COLNAMES, INDEXTYPE AS "type" FROM SYSIBM.SYSINDEXES WHERE TBNAME = <%= tableName %>'; |
no test coverage detected