Click here to get back home

RFC: new module SQL::QueryQueue

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    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, 3:19 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 smallpond on February 20, 2008, 5:03 pm
Please log in for more thread options
On Feb 20, 3:19 pm, mapec...@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


Looks like a good idea, but why the limitation to a single instance?
I've known of applications using multiple connected databases.
--S

Posted by Dr.Ruud on February 20, 2008, 5:53 pm
Please log in for more thread options
mapeck65@gmail.com schreef:

> Looking for comments on the name, as well as the function of this
> module proposal.

See also:
Mailing-List: contact modules-help(AT)perl.org; run by ezmlm

--
Affijn, Ruud

"Gewoon is een tijger."

Similar ThreadsPosted
[FR-EN] Pb de hachage dans un module (.pm) / make a hash in a module (.pm) September 1, 2005, 1:59 am
Own module needs loaded module from main script August 25, 2004, 12:43 pm
Module Can't Access Routines in Another Module (even with "use" statement!) August 18, 2005, 9:41 pm
Can't locate in @INC - but I can see module is there! January 3, 2005, 7:39 pm
How to handle " use module qw/abc/ " in the module ? February 23, 2005, 3:21 am
How to re-"use Module" if the Module has changed? January 31, 2006, 2:09 pm
how can a module tell if its caller is using some other module February 14, 2006, 9:25 am
Module November 16, 2005, 10:17 am
Need your help with a module. May 13, 2006, 11:38 am
Module help! November 17, 2006, 10:23 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap