diff --git a/lib/table.js b/lib/table.js index d22950ad..fd47c852 100644 --- a/lib/table.js +++ b/lib/table.js @@ -48,6 +48,13 @@ function Table (name) { } } ) + + Object.defineProperty(this.rows, 'clear', { + value () { + return this.splice(0, this.length) + } + } + ) } /* diff --git a/test/common/unit.js b/test/common/unit.js index 76a9ffcf..615219ec 100644 --- a/test/common/unit.js +++ b/test/common/unit.js @@ -140,6 +140,9 @@ describe('Unit', () => { assert.deepStrictEqual(t.rows[3], [12, 'XCXCDCDSCDSC']) assert.strictEqual(t.temporary, false) + t.rows.clear() + assert.strictEqual(t.rows.length, 0) + t = new sql.Table('schm.MyTable') assert.strictEqual(t.name, 'MyTable')