1
0
Fork 0
forked from forgejo/forgejo

Update to latest mssqldriver (#7613)

* New driver does not tolerate USE - handle this by closing db and reopening db in the new dbname
This commit is contained in:
zeripath 2019-07-26 05:10:20 +01:00 committed by GitHub
parent bebc6a3c77
commit 78e5317242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 2376 additions and 598 deletions

View file

@ -28,9 +28,8 @@ const (
isolationSnapshot = 5
)
func sendBeginXact(buf *tdsBuffer, headers []headerStruct, isolation isoLevel,
name string) (err error) {
buf.BeginPacket(packTransMgrReq)
func sendBeginXact(buf *tdsBuffer, headers []headerStruct, isolation isoLevel, name string, resetSession bool) (err error) {
buf.BeginPacket(packTransMgrReq, resetSession)
writeAllHeaders(buf, headers)
var rqtype uint16 = tmBeginXact
err = binary.Write(buf, binary.LittleEndian, &rqtype)
@ -52,8 +51,8 @@ const (
fBeginXact = 1
)
func sendCommitXact(buf *tdsBuffer, headers []headerStruct, name string, flags uint8, isolation uint8, newname string) error {
buf.BeginPacket(packTransMgrReq)
func sendCommitXact(buf *tdsBuffer, headers []headerStruct, name string, flags uint8, isolation uint8, newname string, resetSession bool) error {
buf.BeginPacket(packTransMgrReq, resetSession)
writeAllHeaders(buf, headers)
var rqtype uint16 = tmCommitXact
err := binary.Write(buf, binary.LittleEndian, &rqtype)
@ -81,8 +80,8 @@ func sendCommitXact(buf *tdsBuffer, headers []headerStruct, name string, flags u
return buf.FinishPacket()
}
func sendRollbackXact(buf *tdsBuffer, headers []headerStruct, name string, flags uint8, isolation uint8, newname string) error {
buf.BeginPacket(packTransMgrReq)
func sendRollbackXact(buf *tdsBuffer, headers []headerStruct, name string, flags uint8, isolation uint8, newname string, resetSession bool) error {
buf.BeginPacket(packTransMgrReq, resetSession)
writeAllHeaders(buf, headers)
var rqtype uint16 = tmRollbackXact
err := binary.Write(buf, binary.LittleEndian, &rqtype)