mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] bump ncruces/go-sqlite3 to v0.25.0 (#3966)
This commit is contained in:
38
vendor/github.com/ncruces/go-sqlite3/sqlite.go
generated
vendored
38
vendor/github.com/ncruces/go-sqlite3/sqlite.go
generated
vendored
@ -120,33 +120,33 @@ func (sqlt *sqlite) error(rc res_t, handle ptr_t, sql ...string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := Error{code: rc}
|
||||
|
||||
if err.Code() == NOMEM || err.ExtendedCode() == IOERR_NOMEM {
|
||||
if ErrorCode(rc) == NOMEM || xErrorCode(rc) == IOERR_NOMEM {
|
||||
panic(util.OOMErr)
|
||||
}
|
||||
|
||||
if ptr := ptr_t(sqlt.call("sqlite3_errstr", stk_t(rc))); ptr != 0 {
|
||||
err.str = util.ReadString(sqlt.mod, ptr, _MAX_NAME)
|
||||
}
|
||||
|
||||
if handle != 0 {
|
||||
var msg, query string
|
||||
if ptr := ptr_t(sqlt.call("sqlite3_errmsg", stk_t(handle))); ptr != 0 {
|
||||
err.msg = util.ReadString(sqlt.mod, ptr, _MAX_LENGTH)
|
||||
msg = util.ReadString(sqlt.mod, ptr, _MAX_LENGTH)
|
||||
switch {
|
||||
case msg == "not an error":
|
||||
msg = ""
|
||||
case msg == util.ErrorCodeString(uint32(rc))[len("sqlite3: "):]:
|
||||
msg = ""
|
||||
}
|
||||
}
|
||||
|
||||
if len(sql) != 0 {
|
||||
if i := int32(sqlt.call("sqlite3_error_offset", stk_t(handle))); i != -1 {
|
||||
err.sql = sql[0][i:]
|
||||
query = sql[0][i:]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch err.msg {
|
||||
case err.str, "not an error":
|
||||
err.msg = ""
|
||||
if msg != "" || query != "" {
|
||||
return &Error{code: rc, msg: msg, sql: query}
|
||||
}
|
||||
}
|
||||
return &err
|
||||
return xErrorCode(rc)
|
||||
}
|
||||
|
||||
func (sqlt *sqlite) getfn(name string) api.Function {
|
||||
@ -212,14 +212,10 @@ func (sqlt *sqlite) realloc(ptr ptr_t, size int64) ptr_t {
|
||||
}
|
||||
|
||||
func (sqlt *sqlite) newBytes(b []byte) ptr_t {
|
||||
if (*[0]byte)(b) == nil {
|
||||
if len(b) == 0 {
|
||||
return 0
|
||||
}
|
||||
size := len(b)
|
||||
if size == 0 {
|
||||
size = 1
|
||||
}
|
||||
ptr := sqlt.new(int64(size))
|
||||
ptr := sqlt.new(int64(len(b)))
|
||||
util.WriteBytes(sqlt.mod, ptr, b)
|
||||
return ptr
|
||||
}
|
||||
@ -288,7 +284,7 @@ func (a *arena) new(size int64) ptr_t {
|
||||
}
|
||||
|
||||
func (a *arena) bytes(b []byte) ptr_t {
|
||||
if (*[0]byte)(b) == nil {
|
||||
if len(b) == 0 {
|
||||
return 0
|
||||
}
|
||||
ptr := a.new(int64(len(b)))
|
||||
|
Reference in New Issue
Block a user