anchor.diff:                    , lastFailureTime         ::ddDatetime()        %% erlang time of last login failure (for existing account name)
                     , lastPasswordChangeTime  ::ddDatetime()        %% change time (undefined or too old  => must change it now and reconnect)
                     , locked='false'          ::'true' | 'false'
  -                  }
  -       ).
  +                  }).
   
   -define(ddAccount, [userid,binstr,atom,list,binstr,datetime,datetime,datetime,boolean]).
   
  --record(ddRole,                             %% hierarchy of roles with permissions and access privileges to connections and commands  
  +%% hierarchy of roles with permissions and access privileges to connections and commands
  +-record(ddRole,
                     { id                      ::ddEntityId()            %% lookup starts with ddAccount.id, other roles are atoms
                     , roles=[]                ::[atom()]                %% granted roles
                     , permissions=[]          ::[ddPermission()]        %% granted permissions
                     , quotas=[]               ::[ddQuota()]             %% granted quotas
  -                  }
  -       ).
  +                  }).
   
   -define(ddRole, [userid,list,list,list]).
   
  
positive.code:                   , conns = local           ::list() | local    %% can be local or a list with remote connections, empty list for all remote connections.
                    , command                 ::binary()          %% erlang term depending on adapter (e.g. SQL text)
                    , opts                    ::any()             %% command options ()
                    }
         ).
  -define(ddCmd, [integer, binstr, userid, list, list, binstr, term]).
  
  -record(ddView,                             %% user representation of a db command including rendering parameters
                    { id                      ::ddEntityId()
                    , interface               ::atom()            %% interface plugin (ddjson for now)  
                    , owner                   ::ddEntityId()      %% account.id of creator / owner
                    , name                    ::binary()          %% should default to command name
                    , cmd                     ::ddEntityId()      %% db command id
                    , state                   ::#viewstate{}      %% transparent viewstate (managed by client application)
                    }
         ).
  -define(ddView, [integer, atom, userid, binstr, integer, term]).
  
  -record(ddDash,                             %% user representation of a dashboard (collection of views)
                    { id                      ::ddEntityId()
                    , interface               ::atom()            %% interface plugin (ddjson for now)  
                    , owner                   ::ddEntityId()      %% account.id of creator / owner
                    , name                    ::binary()          %% should default to command name
                    , views                   ::list()            %% array of proplists with view layout
                    }
         ).
  
  -define(ddDash, [integer, atom, userid, binstr, list]).
  
  
negative.code: -include_lib("imem/include/imem_exports.hrl").
  
  -define(DEFAULT_ROW_SIZE, 100).
  -record(viewstate,
                    { table_layout = []
                    , column_layout = []
                    }).
  
  %% DDerl adapter (connect to databases)
  -record(ddAdapter,
                    { id                      :: atom()             %% oci | imem | ets | os_text | dfs_text | hdfs_text
                    , fullName                :: binary()           %% displayed in drop down box
                    }).
  -define(ddAdapter, [atom, binstr]).
  
  %% DDerl client interface (connect to ui / applications)
  -record(ddInterface,
                    { id                      :: atom()             %% ddjson
                    , fullName                :: binary()           %% displayed in drop down box
                    }).
  -define(ddInterface, [atom, binstr]).
  
  %% DB connection
  -record(ddConn,
                    { id                      ::ddEntityId()       
                    , name                    ::binary()          %% connection name (mutable)
                    , owner                   ::ddEntityId()      %% account.id of creator / owner
                    , adapter                 ::atom()            %% oci | imem | ets | os_text | dfs_text | hdfs_text
                    , access                  ::any()             %% erlang term depending on adapter (e.g. ip+service or tns)
                    , schm                    ::any()             %% erlang term depending on adapter (e.g. name or uri or data root path)
                    }).
  -define(ddConn, [integer, binstr, userid, atom, term, term]).
  
  %% DB command
  -record(ddCmd,
                    { id                      ::ddEntityId()       
                    , name                    ::binary()          %% command template name (mutable)
                    , owner                   ::ddEntityId()      %% account.id of creator / owner
  