1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 23:29:42 +02:00

Update SQL Server driver library

This commit is contained in:
HarveyKandola 2019-06-25 15:37:19 +01:00
parent c538fc9eb1
commit 9c36241b58
37 changed files with 9138 additions and 1091 deletions

View file

@ -0,0 +1,38 @@
package mssql
import "fmt"
func ExampleError_1() {
// call a function that might return a mssql error
err := callUsingMSSQL()
type ErrorWithNumber interface {
SQLErrorNumber() int32
}
if errorWithNumber, ok := err.(ErrorWithNumber); ok {
if errorWithNumber.SQLErrorNumber() == 1205 {
fmt.Println("deadlock error")
}
}
}
func ExampleError_2() {
// call a function that might return a mssql error
err := callUsingMSSQL()
type SQLError interface {
SQLErrorNumber() int32
SQLErrorMessage() string
}
if sqlError, ok := err.(SQLError); ok {
if sqlError.SQLErrorNumber() == 1205 {
fmt.Println("deadlock error", sqlError.SQLErrorMessage())
}
}
}
func callUsingMSSQL() error {
return nil
}