--- loncom/interface/loncoursedata.pm 2004/01/19 16:31:25 1.112 +++ loncom/interface/loncoursedata.pm 2004/04/30 20:09:18 1.112.2.2 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursedata.pm,v 1.112 2004/01/19 16:31:25 matthew Exp $ +# $Id: loncoursedata.pm,v 1.112.2.2 2004/04/30 20:09:18 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -581,7 +581,7 @@ sub init_dbs { restrictions => 'NOT NULL', auto_inc => 'yes', }, { name => 'part', - type => 'VARCHAR(100)', + type => 'VARCHAR(100) BINARY', restrictions => 'NOT NULL'}, ], 'PRIMARY KEY' => ['part (100)'], @@ -596,10 +596,10 @@ sub init_dbs { restrictions => 'NOT NULL', auto_inc => 'yes', }, { name => 'student', - type => 'VARCHAR(100)', + type => 'VARCHAR(100) BINARY', restrictions => 'NOT NULL'}, { name => 'classification', - type => 'varchar(100)', }, + type => 'varchar(100) BINARY', }, ], 'PRIMARY KEY' => ['student (100)'], 'KEY' => [{ columns => ['student_id']},], @@ -616,9 +616,9 @@ sub init_dbs { { name => 'fullupdatetime', type => 'INT UNSIGNED'}, { name => 'section', - type => 'VARCHAR(100)'}, + type => 'VARCHAR(100) BINARY'}, { name => 'classification', - type => 'VARCHAR(100)', }, + type => 'VARCHAR(100) BINARY', }, ], 'PRIMARY KEY' => ['student_id'], }; @@ -636,7 +636,7 @@ sub init_dbs { type => 'MEDIUMINT UNSIGNED', restrictions => 'NOT NULL' }, { name => 'part', - type => 'VARCHAR(100)', + type => 'VARCHAR(100) BINARY', restrictions => 'NOT NULL'}, { name => 'solved', type => 'TINYTEXT' }, @@ -716,7 +716,7 @@ sub init_dbs { { name => 'awarddetail', type => 'TINYTEXT' }, # { name => 'message', -# type => 'CHAR' }, +# type => 'CHAR BINARY' }, { name => 'response_specific', type => 'TINYTEXT' }, { name => 'response_specific_value', @@ -1225,11 +1225,7 @@ sub update_full_student_data { # However, there is one wrinkle: submissions which end in # and odd number of '\' cause insert errors to occur. # Best trap this somehow... - $value =~ s/\'/\\\'/g; - my ($offensive_string) = ($value =~ /(\\+)$/); - if (length($offensive_string) % 2) { - $value =~ s/\\$/\\\\/; - } + $value = $dbh->quote($value); } if ($field eq 'submissiongrading' || $field eq 'molecule') { @@ -2075,6 +2071,10 @@ sub get_response_data { } my $dataset = $sth->fetchall_arrayref(); if (ref($dataset) eq 'ARRAY' && scalar(@$dataset)>0) { + # Clear the \'s from around the submission + for (my $i =0;$i[$i]->[3] =~ s/(\'$|^\')//g; + } return $dataset; } }