bug fixes

This commit is contained in:
JT Smith 2004-03-07 17:16:52 +00:00
parent 66e1e0b427
commit a03cab50c9
3 changed files with 25 additions and 13 deletions

View file

@ -63,6 +63,15 @@ save you many hours of grief.
nothing to worry about. All of the theme components will nothing to worry about. All of the theme components will
automatically be converted to 6.0. automatically be converted to 6.0.
* If you have any SQL Reports going against any USS, they will need
to be updated as the USS tables have changed.
* During the upgrade process you may see some database errors during
the migration of SQL Reports. Don't be alarmed. Your upgrade
has not failed. Instead, some of the queries in the SQL Reports
may have failed and will cause the SQL Report templates to not
be automatically generated.
5.5.0 5.5.0
-------------------------------------------------------------------- --------------------------------------------------------------------

View file

@ -400,10 +400,8 @@ WebGUI::SQL->write("delete from incrementer where incrementerId='LinkList_linkId
#-------------------------------------------- #--------------------------------------------
print "\tUpdating SQL Reports.\n" unless ($quiet); print "\tUpdating SQL Reports.\n" unless ($quiet);
my %dblink; my %dblink;
$dblink{$session{config}{dsn}} = ( $dblink{$session{config}{dsn}}{id} = 0;
id=>0, $dblink{$session{config}{dsn}}{user} = $session{config}{dbuser};
user=>$session{config}{dbuser}
);
my $sth = WebGUI::SQL->read("select DSN, databaseLinkId, username, identifier, wobjectId from SQLReport"); my $sth = WebGUI::SQL->read("select DSN, databaseLinkId, username, identifier, wobjectId from SQLReport");
while (my $data = $sth->hashRef) { while (my $data = $sth->hashRef) {
my $id = undef; my $id = undef;
@ -419,10 +417,8 @@ while (my $data = $sth->hashRef) {
my $title = $data->{username}.'@'.$data->{DSN}; my $title = $data->{username}.'@'.$data->{DSN};
WebGUI::SQL->write("insert into databaseLink (databaseLinkId, title, DSN, username, identifier) values ($id, ".quote($title).", WebGUI::SQL->write("insert into databaseLink (databaseLinkId, title, DSN, username, identifier) values ($id, ".quote($title).",
".quote($data->{DSN}).", ".quote($data->{username}).", ".quote($data->{identifier}).")"); ".quote($data->{DSN}).", ".quote($data->{username}).", ".quote($data->{identifier}).")");
$dblink{$data->{DSN}} = ( $dblink{$data->{DSN}}{id} = $id;
id=>$id, $dblink{$data->{DSN}}{user} = $data->{username};
user=>$data->{username}
);
} }
WebGUI::SQL->write("update SQLReport set databaseLinkId=".$id." where wobjectId=".$data->{wobjectId}); WebGUI::SQL->write("update SQLReport set databaseLinkId=".$id." where wobjectId=".$data->{wobjectId});
} }
@ -432,9 +428,9 @@ WebGUI::SQL->write("alter table SQLReport drop column username");
WebGUI::SQL->write("alter table SQLReport drop column identifier"); WebGUI::SQL->write("alter table SQLReport drop column identifier");
use WebGUI::DatabaseLink; use WebGUI::DatabaseLink;
my $templateId; my $templateId;
my $a = WebGUI::SQL->read("select a.databaseLinkId, a.dbQuery, a.template, a.wobjectId, b.title from SQLReport a my $a = WebGUI::SQL->read("select a.databaseLinkId, a.dbQuery, a.template, a.wobjectId, b.title from SQLReport a , wobject b where a.wobjectId=b.wobjectId");
left join wobject b on a.wobjectId=b.wobjectId");
while (my $data = $a->hashRef) { while (my $data = $a->hashRef) {
next if ($data->{dbQuery} eq "");
my $db = WebGUI::DatabaseLink->new($data->{databaseLinkId}); my $db = WebGUI::DatabaseLink->new($data->{databaseLinkId});
if ($data->{template} ne "") { if ($data->{template} ne "") {
($templateId) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='SQLReport'"); ($templateId) = WebGUI::SQL->quickArray("select max(templateId) from template where namespace='SQLReport'");
@ -463,11 +459,13 @@ while (my $data = $a->hashRef) {
'.$template[0].' '.$template[0].'
<tmpl_loop rows_loop> '; <tmpl_loop rows_loop> ';
my $i; my $i;
if (defined $b) {
foreach my $col ($b->getColumnNames) { foreach my $col ($b->getColumnNames) {
my $replacement = '<tmpl_var row.field.'.$col.'.value>'; my $replacement = '<tmpl_var row.field.'.$col.'.value>';
$template[1] =~ s/\^$i\;/$replacement/g; $template[1] =~ s/\^$i\;/$replacement/g;
$i++; $i++;
} }
}
$template[1] =~ s/\^rownum\;/\<tmpl_var row\.number\>/g; $template[1] =~ s/\^rownum\;/\<tmpl_var row\.number\>/g;
$final .= $template[1].' $final .= $template[1].'
</tmpl_loop> </tmpl_loop>
@ -482,7 +480,8 @@ while (my $data = $a->hashRef) {
} else { } else {
$templateId = 1; $templateId = 1;
} }
WebGUI::SQL->write("insert into wobject set templateId=$templateId where wobjectId=".$data->{wobjectId}); WebGUI::SQL->write("update wobject set templateId=$templateId where wobjectId=".$data->{wobjectId});
print "\tend loop\n";
} }
$a->finish; $a->finish;
WebGUI::SQL->write("alter table SQLReport drop column template"); WebGUI::SQL->write("alter table SQLReport drop column template");
@ -605,13 +604,13 @@ while (my ($surveyId) = $a->array) {
while (my ($userId) = $b->array) { while (my ($userId) = $b->array) {
my ($username,$ipAddress) = WebGUI::SQL->quickArray("select username,ipAddress from Survey_questionResponse where Survey_id=$surveyId and my ($username,$ipAddress) = WebGUI::SQL->quickArray("select username,ipAddress from Survey_questionResponse where Survey_id=$surveyId and
userId=".quote($userId)); userId=".quote($userId));
WebGUI::SQL->write("insert into (Survey_id, Survey_responseId, userId, username, isComplete, ipAddress) values ($surveyId, WebGUI::SQL->write("insert into Survey_response (Survey_id, Survey_responseId, userId, username, isComplete, ipAddress) values ($surveyId,
".getNextId("Survey_responseId")." ,".quote($userId).", ".quote($username).", 1, ".quote($ipAddress).")"); ".getNextId("Survey_responseId")." ,".quote($userId).", ".quote($username).", 1, ".quote($ipAddress).")");
} }
$b->finish; $b->finish;
$b = WebGUI::SQL->read("select distinct ipAddress from Survey_questionResponse where Survey_id=$surveyId and userId='1'"); $b = WebGUI::SQL->read("select distinct ipAddress from Survey_questionResponse where Survey_id=$surveyId and userId='1'");
while (my ($ipAddress) = $b->array) { while (my ($ipAddress) = $b->array) {
WebGUI::SQL->write("insert into (Survey_id, Survey_responseId, userId, username, isComplete, ipAddress) values ( WebGUI::SQL->write("insert into Survey_response (Survey_id, Survey_responseId, userId, username, isComplete, ipAddress) values (
$surveyId, ".getNextId("Survey_responseId")." ,'1', 'Visitor', 1, ".quote($ipAddress).")"); $surveyId, ".getNextId("Survey_responseId")." ,'1', 'Visitor', 1, ".quote($ipAddress).")");
} }
$b->finish; $b->finish;

View file

@ -679,7 +679,11 @@ sub unconditionalRead {
if ($sth) { if ($sth) {
$sth->execute or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr); $sth->execute or WebGUI::ErrorHandler::warn("Unconditional read failed: ".$_[1]." : ".DBI->errstr);
bless ({_sth => $sth}, $_[0]); bless ({_sth => $sth}, $_[0]);
unless (DBI->errstr) {
return;
}
} }
return undef;
} }