Commit 18be70c7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e87b841b
...@@ -301,13 +301,16 @@ func (b *Backend) LastOid(ctx context.Context) (zodb.Oid, error) { ...@@ -301,13 +301,16 @@ 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, err error) { func (b *Backend) Load(ctx context.Context, xid zodb.Xid) (*proto.AnswerObject, error) {
defer func() { // XXX instead of defer
if err != nil { obj, err := b.load(xid)
err = &zodb.OpError{URL: b.url, Op: "load", Err: err} if err != nil {
} 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
...@@ -330,7 +333,7 @@ func (b *Backend) Load(ctx context.Context, xid zodb.Xid) (_ *proto.AnswerObject ...@@ -330,7 +333,7 @@ func (b *Backend) Load(ctx context.Context, xid zodb.Xid) (_ *proto.AnswerObject
// 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