From 5d9a6ffe347a738275bb71e4dfa8ea41531fbf9a Mon Sep 17 00:00:00 2001 From: HarrisChu <1726587+HarrisChu@users.noreply.github.com> Date: Thu, 24 Feb 2022 16:31:21 +0800 Subject: [PATCH] fix nil point --- pkg/common/types.go | 2 +- pkg/nebulagraph/client.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/common/types.go b/pkg/common/types.go index 25d7c47..5c52088 100644 --- a/pkg/common/types.go +++ b/pkg/common/types.go @@ -19,7 +19,7 @@ type ( IGraphClient interface { IClient GetData() (Data, error) - Execute(stat string) (IGraphResponse, error) + Execute(stmt string) (IGraphResponse, error) } // IGraphResponse graph response, just support 3 functions to user. diff --git a/pkg/nebulagraph/client.go b/pkg/nebulagraph/client.go index bfa73b3..02ac582 100644 --- a/pkg/nebulagraph/client.go +++ b/pkg/nebulagraph/client.go @@ -192,6 +192,7 @@ func (gp *GraphPool) GetSession(username, password string) (common.IGraphClient, // balancer, ccore just use the first endpoint index := len(gp.clients) % len(gp.hosts) client, err := gp.clientGetter(gp.hosts[index], username, password) + if gp.Version == "" { gp.Version = string(client.Version()) } @@ -267,6 +268,8 @@ func (gc *GraphClient) Execute(stmt string) (common.IGraphResponse, error) { rows = 0 latency = 0 } else { + // no err, so the error code is ErrorCode_SUCCEEDED + codeErr, _ = nerrors.AsCodeError(nerrors.NewCodeError(nerrors.ErrorCode_SUCCEEDED, "")) rs, _ = wrapper.GenResultSet(resp, gc.Client.Factory(), types.TimezoneInfo{}) rows = int32(rs.GetRowSize()) latency = resp.GetLatencyInUs()