web/modules/rhn/RHN/DB.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
New commits: commit 6288d77f77d9420374560b1149ca6a875f472802 Author: Jan Pazdziora jpazdziora@redhat.com Date: Wed Oct 6 10:33:27 2010 +0200
Make sequence_nextval method support PostgreSQL syntax.
diff --git a/web/modules/rhn/RHN/DB.pm b/web/modules/rhn/RHN/DB.pm index 9840462..d0b076c 100644 --- a/web/modules/rhn/RHN/DB.pm +++ b/web/modules/rhn/RHN/DB.pm @@ -486,8 +486,14 @@ sub sequence_nextval { my $self = shift; my $sequence = shift;
- my $sth = $self->prepare("SELECT $sequence.nextval FROM DUAL"); - $sth->execute; + my $sth; + if ($self->{Driver}->{Name} eq 'Pg') { + $sth = $self->prepare('select nextval(?)'); + $sth->execute($sequence); + } else { + $sth = $self->prepare("SELECT $sequence.nextval FROM DUAL"); + $sth->execute; + }
my ($ret) = $sth->fetchrow; $sth->finish;
spacewalk-commits@lists.fedorahosted.org