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

Bumped database driver dependencies

Latest used for MySQL, SQL Server and PostgreSQL
This commit is contained in:
sauls8t 2019-08-15 14:51:40 +01:00
parent ffacf17c5f
commit 32dbab826d
31 changed files with 2431 additions and 1611 deletions

View file

@ -14,6 +14,8 @@ import (
"strings"
"time"
"unicode"
"github.com/denisenkom/go-mssqldb/internal/querytext"
)
// ReturnStatus may be used to return the return value from a proc.
@ -351,7 +353,6 @@ func (d *Driver) connect(ctx context.Context, c *Connector, params connectParams
processQueryText: d.processQueryText,
connectionGood: true,
}
conn.sess.log = d.log
return conn, nil
}
@ -386,7 +387,7 @@ func (c *Conn) Prepare(query string) (driver.Stmt, error) {
func (c *Conn) prepareContext(ctx context.Context, query string) (*Stmt, error) {
paramCount := -1
if c.processQueryText {
query, paramCount = parseParams(query)
query, paramCount = querytext.ParseParams(query)
}
return &Stmt{c, query, paramCount, nil}, nil
}
@ -456,13 +457,13 @@ func (s *Stmt) sendQuery(args []namedValue) (err error) {
var params []param
if isProc(s.query) {
proc.name = s.query
params, _, err = s.makeRPCParams(args, 0)
params, _, err = s.makeRPCParams(args, true)
if err != nil {
return
}
} else {
var decls []string
params, decls, err = s.makeRPCParams(args, 2)
params, decls, err = s.makeRPCParams(args, false)
if err != nil {
return
}
@ -534,8 +535,12 @@ func isProc(s string) bool {
return true
}
func (s *Stmt) makeRPCParams(args []namedValue, offset int) ([]param, []string, error) {
func (s *Stmt) makeRPCParams(args []namedValue, isProc bool) ([]param, []string, error) {
var err error
var offset int
if !isProc {
offset = 2
}
params := make([]param, len(args)+offset)
decls := make([]string, len(args))
for i, val := range args {
@ -546,7 +551,7 @@ func (s *Stmt) makeRPCParams(args []namedValue, offset int) ([]param, []string,
var name string
if len(val.Name) > 0 {
name = "@" + val.Name
} else {
} else if !isProc {
name = fmt.Sprintf("@p%d", val.Ordinal)
}
params[i+offset].Name = name
@ -711,6 +716,8 @@ func (rc *Rows) Next(dest []driver.Value) error {
if tokdata.isError() {
return rc.stmt.c.checkBadConn(tokdata.getError())
}
case ReturnStatus:
rc.stmt.c.setReturnStatus(tokdata)
case error:
return rc.stmt.c.checkBadConn(tokdata)
}