mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-10 08:43:34 +08:00
🐛 fix(tdengine): 修复查询结果仅显示执行日志
- TDengine 只读查询跳过不支持的多结果集探测 - 保证可选驱动代理通过普通查询返回完整行列数据 - 补充应用层与驱动层回归测试 Fixes #610
This commit is contained in:
@@ -161,6 +161,31 @@ func openTDengineRecordingDB(t *testing.T) (*sql.DB, *tdengineRecordingState) {
|
||||
return dbConn, state
|
||||
}
|
||||
|
||||
func TestTDengineQueryContextReturnsRowsAndColumns(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dbConn, state := openTDengineRecordingDB(t)
|
||||
td := &TDengineDB{conn: dbConn}
|
||||
query := "SELECT ts, current FROM meters ORDER BY ts DESC LIMIT 1"
|
||||
state.queryResults[query] = tdengineQueryResult{
|
||||
columns: []string{"ts", "current"},
|
||||
rows: [][]driver.Value{
|
||||
{"2026-07-19 00:00:00.000", 10.2},
|
||||
},
|
||||
}
|
||||
|
||||
rows, columns, err := td.QueryContext(context.Background(), query)
|
||||
if err != nil {
|
||||
t.Fatalf("TDengine QueryContext returned error: %v", err)
|
||||
}
|
||||
if !reflect.DeepEqual(columns, []string{"ts", "current"}) {
|
||||
t.Fatalf("TDengine QueryContext columns = %#v", columns)
|
||||
}
|
||||
if len(rows) != 1 || rows[0]["ts"] != "2026-07-19 00:00:00.000" || rows[0]["current"] != 10.2 {
|
||||
t.Fatalf("TDengine QueryContext rows = %#v, want one data row", rows)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTDengineApplyChanges_InsertsIntoQualifiedTable(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user