Skip to content

Filechain and Blockchain regular methods have different signatures

Modules Pheix::Model::Database::Filechain and Pheix::Model::Database::Blockchian have the common method, such as

  1. table_create
  2. row_insert
  3. row_set
  4. etc...

We have them, to create the abstract universal layer at Pheix::Model::Database::Access.

But the signatures of these methods are different:

For example:

  1. Pheix::Model::Database::Filechain

method row_get(Str :$t, Hash :$clause!, Bool :$comp) returns List { ... }

  1. Pheix::Model::Database::Blockchain

method row_get(Str :$t, Int :$id!, Bool :$comp) returns Hash { ... }

So, the method get() from Pheix::Model::Database::Access will crash at $!dbswitch = 1 (blockchain case), cause:

method get( Hash $arg_ref ) returns List {
    # %arg = k1 => v1, k2 => v2, ...;
    # sql: SELECT * FROM table WHERE k1=v1 AND k2=v2,...;
    my @rows;
    given $!dbswitch {
        default {
            my $_obj = self.get_chain_obj;
            if $_obj {
                @rows = $_obj.row_get(:clause($clause));
            }
        }
    }
    @rows;
}
Edited by Konstantin Narkhov