mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 19:57:55 +01:00
25b5ffb6af
* Enables mssql support Port of dlobs work in gogs. Enables options in index.js Enables MSSQL as a database option in go. Sets ID to 0 on initial migration. Required for MSSQL insert statements. Signed-off-by: Beau Trepp <beautrepp@gmail.com> * Vendors in denisenkom/go-mssqldb Includes golang.org/x/crypto/md4 as this is required by go-msssqldb Signed-off-by: Beau Trepp <beautrepp@gmail.com>
74 lines
1.3 KiB
Go
Vendored
74 lines
1.3 KiB
Go
Vendored
package mssql
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// Error represents an SQL Server error. This
|
|
// type includes methods for reading the contents
|
|
// of the struct, which allows calling programs
|
|
// to check for specific error conditions without
|
|
// having to import this package directly.
|
|
type Error struct {
|
|
Number int32
|
|
State uint8
|
|
Class uint8
|
|
Message string
|
|
ServerName string
|
|
ProcName string
|
|
LineNo int32
|
|
}
|
|
|
|
func (e Error) Error() string {
|
|
return "mssql: " + e.Message
|
|
}
|
|
|
|
// SQLErrorNumber returns the SQL Server error number.
|
|
func (e Error) SQLErrorNumber() int32 {
|
|
return e.Number
|
|
}
|
|
|
|
func (e Error) SQLErrorState() uint8 {
|
|
return e.State
|
|
}
|
|
|
|
func (e Error) SQLErrorClass() uint8 {
|
|
return e.Class
|
|
}
|
|
|
|
func (e Error) SQLErrorMessage() string {
|
|
return e.Message
|
|
}
|
|
|
|
func (e Error) SQLErrorServerName() string {
|
|
return e.ServerName
|
|
}
|
|
|
|
func (e Error) SQLErrorProcName() string {
|
|
return e.ProcName
|
|
}
|
|
|
|
func (e Error) SQLErrorLineNo() int32 {
|
|
return e.LineNo
|
|
}
|
|
|
|
type StreamError struct {
|
|
Message string
|
|
}
|
|
|
|
func (e StreamError) Error() string {
|
|
return e.Message
|
|
}
|
|
|
|
func streamErrorf(format string, v ...interface{}) StreamError {
|
|
return StreamError{"Invalid TDS stream: " + fmt.Sprintf(format, v...)}
|
|
}
|
|
|
|
func badStreamPanic(err error) {
|
|
panic(err)
|
|
}
|
|
|
|
func badStreamPanicf(format string, v ...interface{}) {
|
|
panic(streamErrorf(format, v...))
|
|
}
|