MCPcopy Create free account
hub / github.com/NobleMajo/al-sql / deleteQuery

Method deleteQuery

src/pg.ts:428–450  ·  view source on GitHub ↗
(
        table: SqlTable,
        where?: SqlCondition,
        returning?: SqlResultColumnSelector | undefined,
    )

Source from the content-addressed store, hash-verified

426 }
427
428 deleteQuery(
429 table: SqlTable,
430 where?: SqlCondition,
431 returning?: SqlResultColumnSelector | undefined,
432 ): ExecutableSqlQuery {
433 let line = `DELETE FROM "${table.name}"`
434
435 let values: any[] = []
436 if (where && Object.keys(where).length > 0) {
437 let i: [number] = [1]
438 const whereData = this.createSqlWhereCondition(table.name, where, i)
439 line += ` WHERE ${whereData[0]}`
440 values = whereData.slice(1)
441 }
442
443 if (typeof returning != "undefined") {
444 line += ` RETURNING ${this.createSelectQuery(returning)}`
445 }
446 return [
447 line,
448 ...values
449 ]
450 }
451}
452
453export class PostgresConnection implements AbstractSqlConnection {

Callers

nothing calls this directly

Calls 2

createSelectQueryMethod · 0.95

Tested by

no test coverage detected