Conditional subscription

13 views
Skip to first unread message

Kazuho Oku

unread,
Mar 24, 2008, 4:29:01 AM3/24/08
to q4m-g...@googlegroups.com
Hi all,

From last friday, I have started implementing conditional queue
subscription, that allows clients subscribe to rows with certain
conditions.

For example, if a query like

select queue_wait('tbl:v<3');

is executed, Q4M will only return rows with column v less than 3. In
the next release, only integer columns will be supported in the
condition expression.

If you have any ideas or suggestions, please let me know.

--
Kazuho Oku

lestrrat

unread,
Mar 24, 2008, 4:53:42 AM3/24/08
to Q4M - a Message Queue for MySQL

I haven't thought this through yet so it might be a can of worms, but
would it be possible to bind parameters from perl?

$sth = $dbh->prepare("select queue_wait('tbl:v<?')");
$sth->execute(3);

--d

Kazuho Oku

unread,
Mar 24, 2008, 7:32:15 AM3/24/08
to q4m-g...@googlegroups.com
2008/3/24, lestrrat <lest...@gmail.com>:

> I haven't thought this through yet so it might be a can of worms, but
> would it be possible to bind parameters from perl?
>
> $sth = $dbh->prepare("select queue_wait('tbl:v<?')");
> $sth->execute(3);

I am not sure how the placeholders of DBI::mysql work, but at least
the script below should work fine.

$sth = $dbh->prepare("select queue_wait('?')");
$sth->execute(sprintf 'tbl:v<%d', 3);

> --d
>
>
> On Mar 24, 5:29 pm, "Kazuho Oku" <kazuho...@gmail.com> wrote:
> > Hi all,
> >
> > From last friday, I have started implementing conditional queue
> > subscription, that allows clients subscribe to rows with certain
> > conditions.
> >
> > For example, if a query like
> >
> > select queue_wait('tbl:v<3');
> >
> > is executed, Q4M will only return rows with column v less than 3. In
> > the next release, only integer columns will be supported in the
> > condition expression.
> >
> > If you have any ideas or suggestions, please let me know.
> >
> > --
> > Kazuho Oku
>
> >
>


--
Kazuho Oku

Kazuho Oku

unread,
Mar 25, 2008, 6:33:28 AM3/25/08
to q4m-g...@googlegroups.com
I have commit initial implementation of conditional subscription in
revision 103.
http://kazuho.31tools.com/svn/q4m/trunk/

The parser of conditions is written using boost::spirit, so you can
find out the BNF-like grammar in queue_cond.cc. Most of the operators
of SQL are supported.
http://kazuho.31tools.com/svn/q4m/trunk/src/queue_cond.cc

The code has not been optimized yet, so a table scan occurs every time
a row is inserted to a Q4M table. However (I hope) it should work
fine for testing and development purposes.

2008/3/24, Kazuho Oku <kazu...@gmail.com>:


--
Kazuho Oku

Reply all
Reply to author
Forward
0 new messages