web/modules/rhn/RHN/DB/Channel.pm | 2 +-
web/modules/rhn/RHN/DB/ChannelEditor.pm | 4 ++--
web/modules/rhn/RHN/DB/User.pm | 12 ++++--------
3 files changed, 7 insertions(+), 11 deletions(-)
New commits:
commit 041985d8f90f32e8709656b1252fdbe02af53f0d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 13:52:57 2011 +0100
The use of verify_channel_role is always in scalar context, no need to user the
user_role_check_debug.
Addressing
Please use DBI functions for transaction handling at
/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBD/Pg.pm line 191.
at /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/User.pm line 1283
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index 6cb3790..2f3ac69 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -1281,19 +1281,15 @@ sub verify_channel_role {
my $dbh = RHN::DB->connect;
my $sth = $dbh->prepare(<<EOQ);
-BEGIN
- :result := rhn_channel.user_role_check_debug(:cid, :user_id, :role, :reason);
-END;
+ select rhn_channel.user_role_check(:cid, :user_id, :role) from dual
EOQ
- my ($result, $reason);
- $sth->execute_h(cid => $channel_id,
+ my $result = $sth->execute_h(cid => $channel_id,
user_id => $self->id,
role => $role,
- result => \$result,
- reason => \$reason);
+ );
- return wantarray ? ($result, $reason) : $result;
+ return $result;
}
sub verify_errata_admin {
my $self = shift;
commit c013bea51bee474277e755f1f046fef0fd1952ca
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 13:38:02 2011 +0100
We need to use current_timestamp instead of sysdate.
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: column "sysdate" does
not exist at character 263
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index dcfbd37..02420fb 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -340,7 +340,7 @@ INSERT
INTO rhnRepoRegenQueue
(id, channel_label, client, reason, force, bypass_filters, next_action, created,
modified)
VALUES (sequence_nextval('rhn_repo_regen_queue_id_seq'),
- :label, 'perl-web::clone_original_channel_packages', NULL, 'N',
'N', sysdate, sysdate, sysdate)
+ :label, 'perl-web::clone_original_channel_packages', NULL, 'N',
'N', current_timestamp, current_timestamp, current_timestamp)
EOQ
my $channel = RHN::Channel->lookup(-id => $to_cid);
commit 068117ebab3c2194e2e00f3f25ab1111ec401270
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 13:37:04 2011 +0100
Use sequence_nextval function.
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: missing FROM-clause entry for
table "rhn_repo_regen_queue_id_seq" at character 141
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index ec6a43f..dcfbd37 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -339,7 +339,7 @@ EOQ
INSERT
INTO rhnRepoRegenQueue
(id, channel_label, client, reason, force, bypass_filters, next_action, created,
modified)
-VALUES (rhn_repo_regen_queue_id_seq.nextval,
+VALUES (sequence_nextval('rhn_repo_regen_queue_id_seq'),
:label, 'perl-web::clone_original_channel_packages', NULL, 'N',
'N', sysdate, sysdate, sysdate)
EOQ
commit 7f980d086c784204471ab194e8d4b4b9ecd90bc7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 13:35:46 2011 +0100
Prevent empty strings from being inserted to the database.
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: new row for relation
"rhnchannel" violates check constraint "vn_rhnchannel_gpg_key_fp"
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index ce21838..2dfabb7 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -108,7 +108,7 @@ sub commit {
}
my $sth = $dbh->prepare($query);
- $sth->execute((map { $self->$_() } grep { $modified{$_} } $c->method_names),
($mode eq 'update') ? ($self->id) : ());
+ $sth->execute((map { my $e = $self->$_(); $e = undef if defined $e and $e eq
''; $e } grep { $modified{$_} } $c->method_names), ($mode eq 'update')
? ($self->id) : ());
# if ($mode eq 'insert') {
# $sth = $dbh->prepare('INSERT INTO rhnChannelPermissions (channel_id, org_id)
VALUES (?, ?)');