]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 57819 - cut down large mysql error strings. Patch by n_hibma@qubesoft.com, r...
authorgerv%gerv.net <>
Fri, 12 Oct 2001 04:58:07 +0000 (04:58 +0000)
committergerv%gerv.net <>
Fri, 12 Oct 2001 04:58:07 +0000 (04:58 +0000)
globals.pl

index c7f848c8af89189af28aec805a2af3b47a863609..eedfa12e3b94c78ce345ecba6f90121e4a78a9f1 100644 (file)
@@ -211,8 +211,13 @@ sub SendSQL {
     }
     SqlLog($str);
     $::currentquery = $::db->prepare($str);
-    $::currentquery->execute
-       || die "$str: " . $::db->errstr;
+    if (!$::currentquery->execute) {
+       my $errstr = $::db->errstr;
+       # Cut down the error string to a reasonable.size
+       $errstr = substr($errstr, 0, 100) . ' ... ' . substr($errstr, -100)
+               if length($errstr) > 200;
+       die "$str: " . $errstr;
+    }
     SqlLog("Done");
     if (!$dontshadow && $iswrite && Param("shadowdb")) {
         my $q = SqlQuote($str);