Don’t ignore transaction errors
This commit is contained in:
parent
70026fe8d7
commit
63cbb59bae
3 changed files with 15 additions and 3 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue