@@ -23,9 +23,9 @@ import (
2323
2424// ReturnStatus may be used to return the return value from a proc.
2525//
26- // var rs mssql.ReturnStatus
27- // _, err := db.Exec("theproc", &rs)
28- // log.Printf("return status = %d", rs)
26+ // var rs mssql.ReturnStatus
27+ // _, err := db.Exec("theproc", &rs)
28+ // log.Printf("return status = %d", rs)
2929type ReturnStatus int32
3030
3131var driverInstance = & Driver {processQueryText : true }
@@ -150,6 +150,12 @@ func NewConnectorConfig(config msdsn.Config) *Connector {
150150 }
151151}
152152
153+ type auth interface {
154+ InitialBytes () ([]byte , error )
155+ NextBytes ([]byte ) ([]byte , error )
156+ Free ()
157+ }
158+
153159// Connector holds the parsed DSN and is ready to make a new connection
154160// at any time.
155161//
@@ -169,6 +175,9 @@ type Connector struct {
169175 // callback that can provide a security token during ADAL login
170176 adalTokenProvider func (ctx context.Context , serverSPN , stsURL string ) (string , error )
171177
178+ // auth allows to provide a custom authenticator.
179+ auth auth
180+
172181 // SessionInitSQL is executed after marking a given session to be reset.
173182 // When not present, the next query will still reset the session to the
174183 // database defaults.
@@ -231,6 +240,16 @@ func (c *Conn) IsValid() bool {
231240 return c .connectionGood
232241}
233242
243+ // GetUnderlyingConn returns underlying raw server connection.
244+ func (c * Conn ) GetUnderlyingConn () io.ReadWriteCloser {
245+ return c .sess .buf .transport
246+ }
247+
248+ // GetLoginFlags returns tokens returned by server during login handshake.
249+ func (c * Conn ) GetLoginFlags () []Token {
250+ return c .sess .loginFlags
251+ }
252+
234253// checkBadConn marks the connection as bad based on the characteristics
235254// of the supplied error. Bad connections will be dropped from the connection
236255// pool rather than reused.
@@ -878,22 +897,24 @@ func (r *Rows) ColumnTypeDatabaseTypeName(index int) string {
878897// not a variable length type ok should return false.
879898// If length is not limited other than system limits, it should return math.MaxInt64.
880899// The following are examples of returned values for various types:
881- // TEXT (math.MaxInt64, true)
882- // varchar(10) (10, true)
883- // nvarchar(10) (10, true)
884- // decimal (0, false)
885- // int (0, false)
886- // bytea(30) (30, true)
900+ //
901+ // TEXT (math.MaxInt64, true)
902+ // varchar(10) (10, true)
903+ // nvarchar(10) (10, true)
904+ // decimal (0, false)
905+ // int (0, false)
906+ // bytea(30) (30, true)
887907func (r * Rows ) ColumnTypeLength (index int ) (int64 , bool ) {
888908 return makeGoLangTypeLength (r .cols [index ].ti )
889909}
890910
891911// It should return
892912// the precision and scale for decimal types. If not applicable, ok should be false.
893913// The following are examples of returned values for various types:
894- // decimal(38, 4) (38, 4, true)
895- // int (0, 0, false)
896- // decimal (math.MaxInt64, math.MaxInt64, true)
914+ //
915+ // decimal(38, 4) (38, 4, true)
916+ // int (0, 0, false)
917+ // decimal (math.MaxInt64, math.MaxInt64, true)
897918func (r * Rows ) ColumnTypePrecisionScale (index int ) (int64 , int64 , bool ) {
898919 return makeGoLangTypePrecisionScale (r .cols [index ].ti )
899920}
@@ -1320,22 +1341,24 @@ func (r *Rowsq) ColumnTypeDatabaseTypeName(index int) string {
13201341// not a variable length type ok should return false.
13211342// If length is not limited other than system limits, it should return math.MaxInt64.
13221343// The following are examples of returned values for various types:
1323- // TEXT (math.MaxInt64, true)
1324- // varchar(10) (10, true)
1325- // nvarchar(10) (10, true)
1326- // decimal (0, false)
1327- // int (0, false)
1328- // bytea(30) (30, true)
1344+ //
1345+ // TEXT (math.MaxInt64, true)
1346+ // varchar(10) (10, true)
1347+ // nvarchar(10) (10, true)
1348+ // decimal (0, false)
1349+ // int (0, false)
1350+ // bytea(30) (30, true)
13291351func (r * Rowsq ) ColumnTypeLength (index int ) (int64 , bool ) {
13301352 return makeGoLangTypeLength (r .cols [index ].ti )
13311353}
13321354
13331355// It should return
13341356// the precision and scale for decimal types. If not applicable, ok should be false.
13351357// The following are examples of returned values for various types:
1336- // decimal(38, 4) (38, 4, true)
1337- // int (0, 0, false)
1338- // decimal (math.MaxInt64, math.MaxInt64, true)
1358+ //
1359+ // decimal(38, 4) (38, 4, true)
1360+ // int (0, 0, false)
1361+ // decimal (math.MaxInt64, math.MaxInt64, true)
13391362func (r * Rowsq ) ColumnTypePrecisionScale (index int ) (int64 , int64 , bool ) {
13401363 return makeGoLangTypePrecisionScale (r .cols [index ].ti )
13411364}
0 commit comments