Skip to content

Commit

Permalink
fix StatementId doesn't exist in this session issue (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
HTHou authored Jun 28, 2023
1 parent e5122a5 commit a053afa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ func (s *Session) ExecuteStatement(sql string) (*SessionDataSet, error) {
if err != nil && resp == nil {
if s.reconnect() {
request.SessionId = s.sessionId
request.StatementId = s.requestStatementId
resp, err = s.client.ExecuteStatement(context.Background(), &request)
}
}
Expand All @@ -450,6 +451,7 @@ func (s *Session) ExecuteNonQueryStatement(sql string) (r *rpc.TSStatus, err err
if err != nil && resp == nil {
if s.reconnect() {
request.SessionId = s.sessionId
request.StatementId = s.requestStatementId
resp, err = s.client.ExecuteStatement(context.Background(), &request)
}
}
Expand All @@ -469,6 +471,7 @@ func (s *Session) ExecuteQueryStatement(sql string, timeoutMs *int64) (*SessionD
} else {
if s.reconnect() {
request.SessionId = s.sessionId
request.StatementId = s.requestStatementId
resp, err = s.client.ExecuteQueryStatement(context.Background(), &request)
if statusErr := VerifySuccess(resp.Status); statusErr == nil {
return NewSessionDataSet(sql, resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.client, s.sessionId, resp.QueryDataSet, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, s.config.FetchSize, timeoutMs), err
Expand Down Expand Up @@ -769,6 +772,7 @@ func (s *Session) ExecuteRawDataQuery(paths []string, startTime int64, endTime i
if err != nil && resp == nil {
if s.reconnect() {
request.SessionId = s.sessionId
request.StatementId = s.requestStatementId
resp, err = s.client.ExecuteRawDataQuery(context.Background(), &request)
}
}
Expand All @@ -788,6 +792,7 @@ func (s *Session) ExecuteUpdateStatement(sql string) (*SessionDataSet, error) {
if err != nil && resp == nil {
if s.reconnect() {
request.SessionId = s.sessionId
request.StatementId = s.requestStatementId
resp, err = s.client.ExecuteUpdateStatement(context.Background(), &request)
}
}
Expand Down

0 comments on commit a053afa

Please sign in to comment.