fix(iotdb): preserve LIST query result sets
This commit is contained in:
1 parent
d2c471306c
commit
1216cfbf54
2 files changed
+26
-1
No files matched your search
@@ -290,6 +290,31 @@ func TestDecodeQueryOptions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIsQueryStatementRecognizesListStatements(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
sql string
|
||||||
|
want bool
|
||||||
|
}{
|
||||||
|
{sql: "LIST USER", want: true},
|
||||||
|
{sql: "list role", want: true},
|
||||||
|
{sql: " LiSt PRIVILEGES OF USER root; ", want: true},
|
||||||
|
{sql: "\tLIST PRIVILEGES OF ROLE dbx7359_role\n", want: true},
|
||||||
|
{sql: "SHOW VERSION", want: true},
|
||||||
|
{sql: "SELECT * FROM root.dbx_7359.d", want: true},
|
||||||
|
{sql: ""},
|
||||||
|
{sql: " ; "},
|
||||||
|
{sql: "INSERT INTO root.dbx_7359.d(time,s) VALUES(1,1)"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
t.Run(test.sql, func(t *testing.T) {
|
||||||
|
if got := isQueryStatement(trimStatementSQL(test.sql)); got != test.want {
|
||||||
|
t.Fatalf("isQueryStatement(%q) = %t, want %t", test.sql, got, test.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestCancelActiveOperationInvalidatesClient(t *testing.T) {
|
func TestCancelActiveOperationInvalidatesClient(t *testing.T) {
|
||||||
blocking := &blockingIoTDBSession{closed: make(chan struct{})}
|
blocking := &blockingIoTDBSession{closed: make(chan struct{})}
|
||||||
connected := &sessionClient{session: blocking, dialect: client.TreeSqlDialect}
|
connected := &sessionClient{session: blocking, dialect: client.TreeSqlDialect}
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ func isQueryStatement(sql string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
switch strings.ToUpper(fields[0]) {
|
switch strings.ToUpper(fields[0]) {
|
||||||
case "SELECT", "SHOW", "DESC", "DESCRIBE", "EXPLAIN", "WITH":
|
case "SELECT", "SHOW", "DESC", "DESCRIBE", "EXPLAIN", "WITH", "LIST":
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in new issue
Block a user