Click here to get back home

RFC: new module SQL::QueryQueue

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
RFC: new module SQL::QueryQueue mapeck65 02-20-2008
Posted by mapeck65 on February 20, 2008, 2:45 pm
Please log in for more thread options
Looking for comments on the name, as well as the function of this
module proposal. This will be my first public module submission, of a
module I have developed and used privately for a few months. The
intention of the module is to provide a FIFO queue for execution of
SQL statements, providing a fault-tolerant, abstraction of the DBI.
During times of lost database connectivity, statements will be queued
while the SQL::QueryQueue object tries to reconnect. Once a
connection has been reestablished, the queue will resume processing.

SYNOPSIS:

use SQL::QueryQueue;
...
my $queue = SQL::QueryQueue->instance($db_dsn, $db_user_id,
$db_password);
my $sql = qq { update test set ip = '209.197.123.153' where domain
= ?};
$queue->submit_job($sql, 'perlmonks.org');
...
# in another sub somewhere in your program...
my $q = SQL::QueryQueue->instance();
my $sql = qq{ select * from test where ip like '209.%' };
my $array_ref = $q->submit_job($sql);
foreach my $row (@$array_ref) {
print join ', ', @$row, "\n";
}

The SQL::QueryQueue object inherits from Class::Singleton and depends
on DBI. The current implementation also depends on Log::Log4perl and
Linuga::EN::Numbers::Ordinate, though these dependencies could be
removed.

Any comments & suggestions are greatly appreciated.

Michael Peck
mpeck [at] pobox.com

Posted by Dean Arnold on February 20, 2008, 7:01 pm
Please log in for more thread options
mapeck65@gmail.com wrote:
> Looking for comments on the name, as well as the function of this
> module proposal. This will be my first public module submission, of a
> module I have developed and used privately for a few months. The
> intention of the module is to provide a FIFO queue for execution of
> SQL statements, providing a fault-tolerant, abstraction of the DBI.
> During times of lost database connectivity, statements will be queued
> while the SQL::QueryQueue object tries to reconnect. Once a
> connection has been reestablished, the queue will resume processing.
>
> SYNOPSIS:
>
> use SQL::QueryQueue;
> ...
> my $queue = SQL::QueryQueue->instance($db_dsn, $db_user_id,
> $db_password);
> my $sql = qq { update test set ip = '209.197.123.153' where domain
> = ?};
> $queue->submit_job($sql, 'perlmonks.org');
> ...
> # in another sub somewhere in your program...
> my $q = SQL::QueryQueue->instance();
> my $sql = qq{ select * from test where ip like '209.%' };
> my $array_ref = $q->submit_job($sql);
> foreach my $row (@$array_ref) {
> print join ', ', @$row, "\n";
> }
>
> The SQL::QueryQueue object inherits from Class::Singleton and depends
> on DBI. The current implementation also depends on Log::Log4perl and
> Linuga::EN::Numbers::Ordinate, though these dependencies could be
> removed.
>
> Any comments & suggestions are greatly appreciated.
>
> Michael Peck
> mpeck [at] pobox.com

Might this be better applied via a DBI subclass (DBIx::QueryQueue) ?
I.e., connect() sets up the queue as well as doing connect,
and prepare/execute/do() route things thru the queue.
Then its all transparent to the rest of the app,
and existing DBI apps (presumably including things like
DBIx::Class, etc.) can just plug it in by changing
"DBI->connect()" to "DBIx::QueryQueue->connect()"
(or via the explicit RootClass connect attribute).

Dean Arnold
Presicient Corp.

Similar ThreadsPosted
Lower case module name for non-pragma module January 4, 2005, 10:19 am
RFC: New module 'Module::Bundled::Files' August 26, 2005, 3:49 pm
help with an MD5.pm module!! September 3, 2005, 11:39 pm
Looking for RTP module December 9, 2004, 9:17 pm
module for FFT May 9, 2005, 3:06 pm
Module may not be right one? April 27, 2006, 12:57 pm
The 'if' module June 1, 2006, 8:18 pm
The 'if' module June 1, 2006, 8:26 pm
use module March 3, 2007, 5:13 am
Name my Module! July 27, 2007, 6:46 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap