private function loadRoutineFile(): void
  {
    // Set magic constants specific for this stored routine.
    $this->setMagicConstants();

    // Replace all place holders with their values.
    $lines          = explode("\n", $this->routineSourceCode);
    $routine_source = [];
    foreach ($lines as $i => &$line)
    {
      $this->replace['__LINE__'] = $i + 1;
      $routine_source[$i]        = strtr($line, $this->replace);
    }
    $routine_source = implode("\n", $routine_source);

    // Unset magic constants specific for this stored routine.
    $this->unsetMagicConstants();

    // Drop the stored procedure or function if its exists.
    $this->dropRoutine();

    // Set the SQL-mode under which the stored routine will run.
    MetaDataLayer::setSqlMode($this->sqlMode);

    // Set the default character set and collate under which the store routine will run.
    MetaDataLayer::setCharacterSet($this->characterSet, $this->collate);

    // Finally, execute the SQL code for loading the stored routine.
    MetaDataLayer::loadRoutine($routine_source);
  }