Skip to content

Commit 7377db6

Browse files
committedMay 14, 2024
fix(web-console): handling DML response for INSERT and UPDATE
1 parent c4c8169 commit 7377db6

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
 

‎packages/web-console/src/scenes/Editor/Monaco/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ const MonacoEditor = () => {
298298
renderLineMarkings(monacoRef.current, editorRef?.current)
299299
}
300300

301-
if (result.type === QuestDB.Type.DDL) {
301+
if (result.type === QuestDB.Type.DDL || result.type === QuestDB.Type.DML) {
302302
dispatch(
303303
actions.query.addNotification({
304304
content: (

‎packages/web-console/src/utils/questdb.ts

+25-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type RawData = Record<string, Value>
3535

3636
export enum Type {
3737
DDL = "ddl",
38+
DML = "dml",
3839
DQL = "dql",
3940
ERROR = "error",
4041
}
@@ -56,6 +57,7 @@ type RawDqlResult = {
5657
count: number
5758
dataset: DatasetType[]
5859
ddl: undefined
60+
dml: undefined
5961
error: undefined
6062
query: string
6163
timings: Timings
@@ -64,10 +66,17 @@ type RawDqlResult = {
6466

6567
type RawDdlResult = {
6668
ddl: "OK"
69+
dml: undefined
70+
}
71+
72+
type RawDmlResult = {
73+
ddl: undefined
74+
dml: "OK"
6775
}
6876

6977
type RawErrorResult = {
7078
ddl: undefined
79+
dml: undefined
7180
error: "<error message>"
7281
position: number
7382
query: string
@@ -78,15 +87,21 @@ type DdlResult = {
7887
type: Type.DDL
7988
}
8089

81-
type RawResult = RawDqlResult | RawDdlResult | RawErrorResult
90+
type DmlResult = {
91+
query: string
92+
type: Type.DML
93+
}
94+
95+
type RawResult = RawDqlResult | RawDmlResult | RawDdlResult | RawErrorResult
8296

8397
export type ErrorResult = RawErrorResult & {
8498
type: Type.ERROR
8599
status: number
86100
}
87101

88102
export type QueryRawResult =
89-
| (Omit<RawDqlResult, "ddl"> & { type: Type.DQL })
103+
| (Omit<RawDqlResult, "ddl" | "dml"> & { type: Type.DQL })
104+
| DmlResult
90105
| DdlResult
91106
| ErrorResult
92107

@@ -100,6 +115,7 @@ export type QueryResult<T extends Record<string, any>> =
100115
explain?: Explain
101116
}
102117
| ErrorResult
118+
| DmlResult
103119
| DdlResult
104120

105121
export type Table = {
@@ -425,6 +441,13 @@ export class Client {
425441
}
426442
}
427443

444+
if (data.dml) {
445+
return {
446+
query,
447+
type: Type.DML,
448+
}
449+
}
450+
428451
if (data.error) {
429452
// eslint-disable-next-line prefer-promise-reject-errors
430453
return Promise.reject({

0 commit comments

Comments
 (0)
Failed to load comments.