mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 19:42:25 -05:00
[chore] bumps modernc/sqlite version to v1.34.2 on our custom fork (#3599)
This commit is contained in:
parent
55d6731497
commit
79f2e85f51
23 changed files with 172 additions and 288 deletions
40
vendor/modernc.org/sqlite/sqlite.go
generated
vendored
40
vendor/modernc.org/sqlite/sqlite.go
generated
vendored
|
|
@ -18,6 +18,7 @@ import (
|
|||
"net/url"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
|
@ -819,7 +820,25 @@ func applyQueryParams(c *conn, query string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var a []string
|
||||
for _, v := range q["_pragma"] {
|
||||
a = append(a, v)
|
||||
}
|
||||
// Push 'busy_timeout' first, the rest in lexicographic order, case insenstive.
|
||||
// See https://gitlab.com/cznic/sqlite/-/issues/198#note_2233423463 for
|
||||
// discussion.
|
||||
sort.Slice(a, func(i, j int) bool {
|
||||
x, y := strings.TrimSpace(strings.ToLower(a[i])), strings.TrimSpace(strings.ToLower(a[j]))
|
||||
if strings.HasPrefix(x, "busy_timeout") {
|
||||
return true
|
||||
}
|
||||
if strings.HasPrefix(y, "busy_timeout") {
|
||||
return false
|
||||
}
|
||||
|
||||
return x < y
|
||||
})
|
||||
for _, v := range a {
|
||||
cmd := "pragma " + v
|
||||
_, err := c.exec(context.Background(), cmd, nil)
|
||||
if err != nil {
|
||||
|
|
@ -1390,6 +1409,27 @@ func (c *conn) closeV2(db uintptr) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ResetSession is called prior to executing a query on the connection if the
|
||||
// connection has been used before. If the driver returns ErrBadConn the
|
||||
// connection is discarded.
|
||||
func (c *conn) ResetSession(ctx context.Context) error {
|
||||
if !c.usable() {
|
||||
return driver.ErrBadConn
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsValid is called prior to placing the connection into the connection pool.
|
||||
// The connection will be discarded if false is returned.
|
||||
func (c *conn) IsValid() bool {
|
||||
return c.usable()
|
||||
}
|
||||
|
||||
func (c *conn) usable() bool {
|
||||
return c.db != 0 && sqlite3.Xsqlite3_is_interrupted(c.tls, c.db) == 0
|
||||
}
|
||||
|
||||
// FunctionImpl describes an [application-defined SQL function]. If Scalar is
|
||||
// set, it is treated as a scalar function; otherwise, it is treated as an
|
||||
// aggregate function using MakeAggregate.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue