summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/denisenkom/go-mssqldb/buf.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/denisenkom/go-mssqldb/buf.go')
-rw-r--r--vendor/github.com/denisenkom/go-mssqldb/buf.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/vendor/github.com/denisenkom/go-mssqldb/buf.go b/vendor/github.com/denisenkom/go-mssqldb/buf.go
index 927d75d1b7..ba39b40f17 100644
--- a/vendor/github.com/denisenkom/go-mssqldb/buf.go
+++ b/vendor/github.com/denisenkom/go-mssqldb/buf.go
@@ -221,23 +221,27 @@ func (r *tdsBuffer) uint16() uint16 {
}
func (r *tdsBuffer) BVarChar() string {
- l := int(r.byte())
- return r.readUcs2(l)
+ return readBVarCharOrPanic(r)
}
-func (r *tdsBuffer) UsVarChar() string {
- l := int(r.uint16())
- return r.readUcs2(l)
+func readBVarCharOrPanic(r io.Reader) string {
+ s, err := readBVarChar(r)
+ if err != nil {
+ badStreamPanic(err)
+ }
+ return s
}
-func (r *tdsBuffer) readUcs2(numchars int) string {
- b := make([]byte, numchars*2)
- r.ReadFull(b)
- res, err := ucs22str(b)
+func readUsVarCharOrPanic(r io.Reader) string {
+ s, err := readUsVarChar(r)
if err != nil {
badStreamPanic(err)
}
- return res
+ return s
+}
+
+func (r *tdsBuffer) UsVarChar() string {
+ return readUsVarCharOrPanic(r)
}
func (r *tdsBuffer) Read(buf []byte) (copied int, err error) {