fixed bugs in the rewritten perl scripts

This commit is contained in:
hyung-hwan 2014-05-16 16:11:33 +00:00
parent e23e23d592
commit 9880d2d4f8
4 changed files with 21 additions and 8 deletions

View File

@ -69,15 +69,20 @@ sub write_commit_log
my $message = "svn,$projectid,$revision"; my $message = "svn,$projectid,$revision";
my $createdon = strftime ('%Y-%m-%d %H:%M:%S', localtime()); my $createdon = strftime ('%Y-%m-%d %H:%M:%S', localtime());
my $query = $dbh->prepare ("INSERT INTO ${prefix}log(type,projectid,message,createdon,action,userid) VALUES(?,?,?,?,?,?)"); $dbh->begin_work ();
my $query = $dbh->prepare ("INSERT INTO ${prefix}log (type,projectid,message,createdon,action,userid) VALUES (?,?,?,?,?,?)");
if (!$query || !$query->execute ('code', $projectid, $message, $createdon, 'commit', $userid)) if (!$query || !$query->execute ('code', $projectid, $message, $createdon, 'commit', $userid))
{ {
my $errstr = $dbh->errstr();
$query->finish ();
$dbh->rollback (); $dbh->rollback ();
return (-1, $dbh->errstr()); return (-1, $errstr);
} }
$query->finish ();
$dbh->commit (); $dbh->commit ();
return 0; return (0, undef);
} }
#------------------------------------------------------------ #------------------------------------------------------------

View File

@ -83,15 +83,20 @@ sub write_revprop_change_log
my $message = "svn,$projectid,$revision,$propname,$action"; my $message = "svn,$projectid,$revision,$propname,$action";
my $createdon = strftime ('%Y-%m-%d %H:%M:%S', localtime()); my $createdon = strftime ('%Y-%m-%d %H:%M:%S', localtime());
my $query = $dbh->prepare ("INSERT INTO ${prefix}log(type,projectid,message,createdon,action,userid) VALUES(?,?,?,?,?,?)"); $dbh->begin_word ();
my $query = $dbh->prepare ("INSERT INTO ${prefix}log (type,projectid,message,createdon,action,userid) VALUES (?,?,?,?,?,?)");
if (!$query || !$query->execute ('code', $projectid, $message, $createdon, 'revpropchange', $userid)) if (!$query || !$query->execute ('code', $projectid, $message, $createdon, 'revpropchange', $userid))
{ {
$dbh->rollback (); my $errstr = $dbh->errstr();
return (-1, $dbh->errstr()); $query->finish ();
} $dbh->rollback ();
return (-1, $errstr);
}
$query->finish ();
$dbh->commit (); $dbh->commit ();
return 0; return (0, undef);
} }
#------------------------------------------------------------ #------------------------------------------------------------

View File

@ -69,6 +69,7 @@ sub is_project_member
} }
my @row = $query->fetchrow_array; my @row = $query->fetchrow_array;
$query->finish ();
return (((scalar(@row) > 0)? 1: 0), undef); return (((scalar(@row) > 0)? 1: 0), undef);
} }

View File

@ -66,6 +66,7 @@ sub is_project_member
} }
my @row = $query->fetchrow_array; my @row = $query->fetchrow_array;
$query->finish ();
return (((scalar(@row) > 0)? 1: 0), undef); return (((scalar(@row) > 0)? 1: 0), undef);
} }
@ -80,6 +81,7 @@ sub is_project_commitable
} }
my @row = $query->fetchrow_array; my @row = $query->fetchrow_array;
$query->finish ();
return (((scalar(@row) > 0 && $row[0] eq 'Y')? 1: 0), undef); return (((scalar(@row) > 0 && $row[0] eq 'Y')? 1: 0), undef);
} }