Fix an edge case where invalid JSON is written the database. Fixes bug #12303.

This commit is contained in:
Colin Kuskie 2011-11-20 22:24:14 -08:00
parent b1133d9118
commit 200494b28d
3 changed files with 16 additions and 1 deletions

View file

@ -34,6 +34,7 @@ my $session = start(); # this line required
addPALastLogTable($session);
addForkRedirect($session);
extendBucketName($session);
fixSurveyQuestionTypes($session);
finish($session); # this line required
@ -81,6 +82,19 @@ EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub fixSurveyQuestionTypes {
my $session = shift;
print "\tFix bad custom Question Types in the Survey... " unless $quiet;
# and here's our code
$session->db->write(<<EOSQL);
update Survey_questionTypes set answers="{}" where answers like 'HASH%';
EOSQL
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {