(tableName, where, options = {}, model)
| 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 %>'; |
no test coverage detected