Commit e915d7a5 authored by Kirill Smelkov's avatar Kirill Smelkov

go/neo/sqlite: Don't avoid defer

Starting from Go1.14 defer is no longer slow:
https://golang.org/doc/go1.14#runtime
parent 18037af1
...@@ -296,16 +296,13 @@ func (b *Backend) LastOid(ctx context.Context) (zodb.Oid, error) { ...@@ -296,16 +296,13 @@ func (b *Backend) LastOid(ctx context.Context) (zodb.Oid, error) {
return lastOid, nil return lastOid, nil
} }
func (b *Backend) Load(ctx context.Context, xid zodb.Xid) (*proto.AnswerObject, error) { func (b *Backend) Load(ctx context.Context, xid zodb.Xid) (_ *proto.AnswerObject, err error) {
// XXX instead of defer defer func() {
obj, err := b.load(xid) if err != nil {
if err != nil { err = &zodb.OpError{URL: b.url, Op: "load", Err: err}
err = &zodb.OpError{URL: b.url, Op: "load", Err: err} }
} }()
return obj, err
}
func (b *Backend) load(xid zodb.Xid) (*proto.AnswerObject, error) {
obj := &proto.AnswerObject{Oid: xid.Oid, DataSerial: 0} obj := &proto.AnswerObject{Oid: xid.Oid, DataSerial: 0}
// TODO reenable, but XXX we have to use Query, not QueryRow for RawBytes support // TODO reenable, but XXX we have to use Query, not QueryRow for RawBytes support
//var data sql.RawBytes //var data sql.RawBytes
...@@ -328,7 +325,7 @@ func (b *Backend) load(xid zodb.Xid) (*proto.AnswerObject, error) { ...@@ -328,7 +325,7 @@ func (b *Backend) load(xid zodb.Xid) (*proto.AnswerObject, error) {
// XXX use conn for several query1 (see below) without intermediate returns to pool? // XXX use conn for several query1 (see below) without intermediate returns to pool?
err := b.query1( err = b.query1(
"SELECT tid, compression, data.hash, value, value_tid" + "SELECT tid, compression, data.hash, value, value_tid" +
" FROM obj LEFT JOIN data ON obj.data_id = data.id" + " FROM obj LEFT JOIN data ON obj.data_id = data.id" +
" WHERE partition=? AND oid=? AND tid<=?" + " WHERE partition=? AND oid=? AND tid<=?" +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment