[erlang-questions] run-time record limitations
deepblue
cktgatb@REDACTED
Fri Jan 16 14:01:24 CET 2009
I wish
if I use a dict for my properties then I cant pattern match when Im
searching the tables (select(), QLC, etc.) so thats a no go, since, as
far as I can tell, I would have to iterate over every single dict item
and compare them to the value that I need...
On Jan 16, 7:35 am, Peter Lund <erl...@REDACTED> wrote:
> Define your mnesia record once:
>
> -record(myrecord, {mnesia_prim_key, dict}).
>
> Where the dict contains a dict. And then in runtime you may add how
> many dictionary keys you'd like into the dictionary.
>
> /Peter
>
> deepblue skrev:
>
>
>
> > Im developing an Erlang system and having reoccurring problems with
> > the fact that record's are compile time pre-processor macros (almost),
> > and that they cant be manipulated at runtime... basically Im working
> > with a property pattern, where properties are added at run-time to
> > objects on the front-end (AS3). Ideally I would reflect this with a
> > list on the Erlang side, since its a fundamental datatype, but then
> > using records in QLC [to query ETS tables] would not be possible since
> > to use them I have to specifically say which record property I want to
> > query over... I have at least 15 columns in the larges table, so
> > listing them all in one huge switch statement (case X of) is just
> > plain ugly.
>
> > does anyone have any ideas how to elegantly solve this? maybe some
> > built-in functions for creating tuples with appropriate signatures for
> > use in pattern matching (for QLC)?
>
> > thanks
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questi...@REDACTED
> >http://www.erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@REDACTED://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list