Skip to content

Commit 92bcd16

Browse files
committed
feat: clean up memory data after stmt2 execution
1 parent 6709a50 commit 92bcd16

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

nodejs/src/stmt/wsStmt2.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ export class WsStmt2 implements WsStmt{
227227
},
228228
};
229229
await this.execute(execMsg);
230+
this.cleanup();
231+
}
232+
233+
private cleanup() {
234+
this._stmtTableInfo.clear();
235+
this._stmtTableInfoList = [];
236+
this._currentTableInfo = new TableInfo();
230237
}
231238

232239
getLastAffected(): number | null | undefined {
@@ -282,11 +289,11 @@ export class WsStmt2 implements WsStmt{
282289
if (resp.fields) {
283290
this.fields = resp.fields;
284291
}
292+
285293
if (resp.is_insert) {
286294
this._isInsert = resp.is_insert;
287-
} else {
288-
this._toBeBindColCount = resp.fields_count ? resp.fields_count : 0;
289295
}
296+
290297
return resp;
291298
}
292299

nodejs/test/bulkPulling/stmt2.func.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ describe('TDWebSocket.Stmt()', () => {
505505
params.setVarchar(['SanFrancisco']);
506506
params.setInt([7]);
507507
await stmt.setTags(params)
508+
508509
let dataParams = stmt.newStmtParam()
509510
dataParams.setTimestamp(multi[0])
510511
dataParams.setFloat(multi[1])

0 commit comments

Comments
 (0)