[erlang-questions] Question: Limiting size of result set in mnesia

Hynek Vychodil vychodil.hynek@REDACTED
Mon Apr 28 15:26:54 CEST 2008


No, qlc:info just returns info. You should use cursor and next_answers.

Just from documentation:

C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})),
R = qlc:next_answers(C, 5),
ok = qlc:delete_cursor(C),
R.



On Mon, Apr 28, 2008 at 2:42 PM, Ahmed Ali <ahmed.nawras@REDACTED> wrote:

> Thanks Hynek and Kenneth for the quick response.
>
> Just to confirm, for qlc, I should write the query first and then run
> qlc:info/2 on it in order to do the limiting, as the example below
> shows. Is this it?
>
> e.g.:
> Q = qlc:q(...),
> qlc:info(Q, [{n_elements, 5}]
>
> Best regards,
>
> Ahmed Al-Issaei
>
> On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin
> <kenneth.lundin@REDACTED> wrote:
> > Hi,
> >
> >  You can use qlc
> >  http://www.erlang.org/doc/man/qlc.html
> >   or you can use
> >  mnesia:select/4 in combination with mnesia:select/1
> >  http://www.erlang.org/doc/man/mnesia.html#select-4
> >
> >  /Kenneth Erlang/OTP, Ericsson
> >
> >
> >
> >
> >  On 4/28/08, Ahmed Ali <ahmed.nawras@REDACTED> wrote:
> >  > Hi All,
> >  >
> >  > Does anyone have an idea of how to limit size of result set in mnesia
> >  > similar to the effect of LIMIT clause in the SQL query below in
> MySQL?
> >  >
> >  > SELECT * FROM Topic LIMIT 5;
> >  >
> >  > Best regards,
> >  >
> >  > Ahmed Al-Issaei
> >
> >
> > > _______________________________________________
> >  > erlang-questions mailing list
> >  > erlang-questions@REDACTED
> >  > http://www.erlang.org/mailman/listinfo/erlang-questions
> >  >
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080428/8c56b7f9/attachment.htm>


More information about the erlang-questions mailing list