Modified:
trunk/CPAN/TheSchwartz-Moosified/Changes
trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm
trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified/Utils.pm
Log:
borrow some code from TheSchwartz::Simple
Modified: trunk/CPAN/TheSchwartz-Moosified/Changes
==============================================================================
--- trunk/CPAN/TheSchwartz-Moosified/Changes (original)
+++ trunk/CPAN/TheSchwartz-Moosified/Changes Tue Feb 17 06:06:43 2009
@@ -1,5 +1,8 @@
Revision history for TheSchwartz-Moosified
+0.03 2009.2.17
+ borrow some code from TheSchwartz::Simple
+
0.02 2009.2.14
fix _grab_a_job with WHERE grabbed_until = $old_grabbed_until
Modified: trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm
==============================================================================
--- trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm (original)
+++ trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified.pm Tue Feb
17 06:06:43 2009
@@ -7,11 +7,11 @@
use List::Util qw( shuffle );
use File::Spec ();
use Storable ();
-use TheSchwartz::Moosified::Utils qw/insert_id sql_for_unixtime/;
+use TheSchwartz::Moosified::Utils qw/insert_id sql_for_unixtime
bind_param_attr/;
use TheSchwartz::Moosified::Job;
use TheSchwartz::Moosified::JobHandle;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
our $AUTHORITY = 'cpan:FAYLAND';
## Number of jobs to fetch at a time in find_job_for_workers.
@@ -113,7 +113,14 @@
join( ", ", @col ), join( ", ", ("?") x @col );
my $sth = $dbh->prepare_cached($sql);
- $sth->execute( @$row{@col} );
+ my $i = 1;
+ for my $col (@col) {
+ $sth->bind_param(
+ $i++,
+ $row->{$col},
+ bind_param_attr( $dbh, $col ),
+ );
+ }
my $jobid = insert_id( $dbh, $sth, "job", "jobid" );
$job->jobid($jobid);
@@ -722,6 +729,10 @@
Note the C<TheSchwartz> implementation of this function uses a C<LIKE>
query to
find matching jobs, with all the attendant performance implications for
your
job databases.
+
+=head1 SEE ALSO
+
+L<TheSchwartz>, L<TheSchwartz::Simple>
=head1 AUTHOR
Modified:
trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified/Utils.pm
==============================================================================
--- trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified/Utils.pm
(original)
+++ trunk/CPAN/TheSchwartz-Moosified/lib/TheSchwartz/Moosified/Utils.pm Tue
Feb 17 06:06:43 2009
@@ -4,7 +4,7 @@
use Carp;
use vars qw/@EXPORT_OK/;
-@EXPORT_OK = qw/insert_id sql_for_unixtime/;
+@EXPORT_OK = qw/insert_id sql_for_unixtime bind_param_attr/;
sub insert_id {
my ( $dbh, $sth, $table, $col ) = @_;
@@ -39,6 +39,22 @@
return time();
}
+
+sub bind_param_attr {
+ my ( $dbh, $col ) = @_;
+
+ return if $col ne 'arg';
+
+ my $driver = $dbh->{Driver}{Name};
+ if ( $driver and $driver eq 'Pg' ) {
+ return { pg_type => DBD::Pg::PG_BYTEA() };
+ }
+ elsif ( $driver and $driver eq 'SQLite' ) {
+ return DBI::SQL_BLOB();
+ }
+ return;
+}
+
1;
__END__