[LON-CAPA-cvs] cvs: loncom(version_1_1_X) /interface loncoursedata.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 09 Mar 2004 21:42:01 -0000


albertel		Tue Mar  9 16:42:01 2004 EDT

  Modified files:              (Branch: version_1_1_X)
    /loncom/interface	loncoursedata.pm 
  Log:
  - backport 1.116 and 1.117
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.112 loncom/interface/loncoursedata.pm:1.112.2.1
--- loncom/interface/loncoursedata.pm:1.112	Mon Jan 19 11:31:25 2004
+++ loncom/interface/loncoursedata.pm	Tue Mar  9 16:42:01 2004
@@ -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.1 2004/03/09 21:42:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1225,11 +1225,7 @@
                     # 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 @@
     }
     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<scalar(@$dataset);$i++) {
+            $dataset->[$i]->[3] =~ s/(\'$|^\')//g;
+        }
         return $dataset;
     }
 }