SAP / go-ase

SAP ASE Database Client for Go
Apache License 2.0
25 stars 14 forks source link

Always send a DonePackage{TDS_DONE_FINAL} as the final package #131

Closed ntnn closed 4 years ago

ntnn commented 4 years ago

Description

TDS doesn't always send a DonePackage{Status: TDS_DONE_FINAL} as the final package in a query - which causes problems with procedures that execute other procedures and the way we consume packages.

E.g. the statement create proc proc1 from select "ping"; proc1 will send DonePackage{Status: TDS_DONE_INXACT} as the last package. This package also occurs in the statement

create proc proc2 from
begin
  proc1
  proc1
end
proc1

But not at the last statement - here the DonePackage{TDS_DONE_INXACT} will occur twice for the two proc1 calls and the final package is a DonePackage{TDS_DONE_FINAL}.

This PR changes the tryParsePackage method so that the last package will always be a DonePackage{TDS_DONE_FINAL} or DonePackage{TDS_DONE_COUNT}.

Related issues

-

Tests