diff --git a/txn/db.go b/txn/db.go index e2bc26ac..4a19f180 100644 --- a/txn/db.go +++ b/txn/db.go @@ -84,7 +84,11 @@ func (t *TX) AddDB(ctx context.Context, ns, db string) (val *sql.DefineDatabaseS key := &keys.DB{KV: cnf.Settings.DB.Base, NS: ns, DB: db} - if kv, _ = t.Get(ctx, 0, key.Encode()); kv.Exi() { + if kv, err = t.Get(ctx, 0, key.Encode()); err != nil { + return + } + + if kv != nil && kv.Exi() { val = &sql.DefineDatabaseStatement{} val.Decode(kv.Val()) t.set(_db, db, val) diff --git a/txn/ns.go b/txn/ns.go index b1dd797c..acbc4cd5 100644 --- a/txn/ns.go +++ b/txn/ns.go @@ -80,7 +80,11 @@ func (t *TX) AddNS(ctx context.Context, ns string) (val *sql.DefineNamespaceStat key := &keys.NS{KV: cnf.Settings.DB.Base, NS: ns} - if kv, _ = t.Get(ctx, 0, key.Encode()); kv.Exi() { + if kv, err = t.Get(ctx, 0, key.Encode()); err != nil { + return + } + + if kv != nil && kv.Exi() { val = &sql.DefineNamespaceStatement{} val.Decode(kv.Val()) t.set(_ns, ns, val) diff --git a/txn/tb.go b/txn/tb.go index ad687ad1..34d0333a 100644 --- a/txn/tb.go +++ b/txn/tb.go @@ -84,7 +84,11 @@ func (t *TX) AddTB(ctx context.Context, ns, db, tb string) (val *sql.DefineTable key := &keys.TB{KV: cnf.Settings.DB.Base, NS: ns, DB: db, TB: tb} - if kv, _ = t.Get(ctx, 0, key.Encode()); kv.Exi() { + if kv, err = t.Get(ctx, 0, key.Encode()); err != nil { + return + } + + if kv != nil && kv.Exi() { val = &sql.DefineTableStatement{} val.Decode(kv.Val()) t.set(_tb, tb, val)