]> git.mjollnir.org Git - moodle.git/commitdiff
Oracle PL/SQL blocks can end by ";". Prevent that to be trimmed.
authorstronk7 <stronk7>
Sat, 27 Jan 2007 23:37:22 +0000 (23:37 +0000)
committerstronk7 <stronk7>
Sat, 27 Jan 2007 23:37:22 +0000 (23:37 +0000)
lib/dmllib.php

index 5c3dabb3a9567ed271e1ab21f0be70109a226f2b..53c2e2e1f6af06a174de0c3f8f344c7eaf64ecce 100644 (file)
@@ -72,8 +72,13 @@ function execute_sql($command, $feedback=true) {
         $command = trim($command);
     /// If the trailing ; is there, fix and warn!
         if (substr($command, strlen($command)-1, 1) == ';') {
-            $command = trim($command, ';');
-            debugging('Warning. Avoid to end your SQL commands with a trailing ";".', DEBUG_DEVELOPER);
+        /// One noticeable exception, Oracle PL/SQL blocks require ending in ";"
+            if ($db->family == 'oracle' && substr($command, -4) == 'END;') {
+                /// Nothing to fix/warn. The command is one PL/SQL block, so it's ok.
+            } else {
+                $command = trim($command, ';');
+                debugging('Warning. Avoid to end your SQL commands with a trailing ";".', DEBUG_DEVELOPER);
+            }
         }
     }