[erlang-questions] Mnesia queries

Bob Cowdery Bob.Cowdery@REDACTED
Tue Dec 11 16:14:29 CET 2007



Bob Cowdery skrev:
> I need a little help with mnesia queries. I want to parameterise the query but can't seem to find any examples of how to do that. The general form seems to be
> 
> qlc:q([X#rec.bar || X <- mnesia:table(foo), X#rec.bar == baz])
> 
> If I now want to select columns at run time is there some way I can construct the left side of the qlc.
> 
> Thanks
> Bob

>> Do you mean something like this?

>> qlc:q([{X#rec.bar, X#rec.baz} || X <- mnesia:table(foo), ...])


I've used that construct when I want to select several columns and know what they are at compile time. If I want to do that at run time by passing in a list like: 

myquery(List) ->
	qlc:q([{construct this from 'List'} || X <- mnesia:table(foo), ...]).

what is the approach to doing that.

Bob
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list