Subject: | Getting Workflow to work with PostgreSQL |
I finally could get started on a project using your Workflow, it took some tweaks to get it to work with PostgreSQL though.
I have included our patch, which get things going with PostgreSQL.
Index: SequenceId.pm
===================================================================
RCS file: /cvs/patches/Workflow-0.15/lib/Workflow/Persister/DBI/SequenceId.pm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 SequenceId.pm
--- SequenceId.pm 8 Nov 2005 11:50:17 -0000 1.1.1.1
+++ SequenceId.pm 8 Nov 2005 12:04:58 -0000
@@ -1,23 +1,34 @@
package Workflow::Persister::DBI::SequenceId;
-# $Id: SequenceId.pm,v 1.1.1.1 2005/11/08 11:50:17 jonasbn Exp $
+# $Id: SequenceId.pm,v 1.3 2004/03/08 04:56:09 cwinters Exp $
use strict;
use base qw( Class::Accessor );
+use Log::Log4perl qw( get_logger );
+use DBI;
-$Workflow::Persister::DBI::SequenceId::VERSION = sprintf("%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/);
+$Workflow::Persister::DBI::SequenceId::VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
-my @FIELDS = qw( sequence_name sequence_select );
+my @FIELDS = qw( sequence_name sequence_select handle);
__PACKAGE__->mk_accessors( @FIELDS );
+my ( $log );
sub pre_fetch_id {
my ( $self, $dbh ) = @_;
- my $full_select = sprintf( $self->sequence_select, $self->sequence_name );
my ( $sth );
+ bless($self);
+ my $full_select = sprintf( $self->sequence_select, $self->sequence_name );
+ $log ||= get_logger();
+ $log->debug( "full_select = $full_select");
+ $dbh = $self->handle;
eval {
$sth = $dbh->prepare( $full_select );
$sth->execute;
};
+ if ( $@ ) {
+ die "$@";
+ }
+
my $row = $sth->fetchrow_arrayref;
$sth->finish;
return $row->[0];