private function extractDesignationType(): void
  {
    $found = true;
    $key   = array_search('begin', $this->routineSourceCodeLines);

    if ($key!==false)
    {
      for ($i = 1; $i<$key; $i++)
      {
        $n = preg_match('/^\s*--\s+type:\s*(\w+)\s*(.+)?\s*$/',
                        $this->routineSourceCodeLines[$key - $i],
                        $matches);
        if ($n==1)
        {
          $this->designationType = $matches[1];
          switch ($this->designationType)
          {
            case 'bulk_insert':
              $m = preg_match('/^([a-zA-Z0-9_]+)\s+([a-zA-Z0-9_,]+)$/',
                              $matches[2],
                              $info);
              if ($m==0)
              {
                throw new RoutineLoaderException('Error: Expected: -- type: bulk_insert <table_name> <columns>');
              }
              $this->bulkInsertTableName = $info[1];
              $this->bulkInsertKeys      = explode(',', $info[2]);
              break;

            case 'rows_with_key':
            case 'rows_with_index':
              $this->indexColumns = explode(',', $matches[2]);
              break;

            default:
              if (isset($matches[2])) $found = false;
          }
          break;
        }
        if ($i==($key - 1)) $found = false;
      }
    }
    else
    {
      $found = false;
    }

    if ($found===false)
    {
      throw new RoutineLoaderException('Unable to find the designation type of the stored routine');
    }
  }
private function extractDesignationType(): void
  {
    $found = true;
    $key   = array_search('begin', $this->routineSourceCodeLines);

    if ($key!==false)
    {
      for ($i = 1; $i<$key; $i++)
      {
        $n = preg_match('/^\s*--\s+type:\s*(\w+)\s*(.+)?\s*$/',
                        $this->routineSourceCodeLines[$key - $i],
                        $matches);
        if ($n==1)
        {
          $this->designationType = $matches[1];
          switch ($this->designationType)
          {
            case 'bulk_insert':
              $m = preg_match('/^([a-zA-Z0-9_]+)\s+([a-zA-Z0-9_,]+)$/',
                              $matches[2],
                              $info);
              if ($m==0)
              {
                throw new RoutineLoaderException('Error: Expected: -- type: bulk_insert <table_name> <columns>');
              }
              $this->bulkInsertTableName = $info[1];
              $this->bulkInsertKeys      = explode(',', $info[2]);
              break;

            case 'rows_with_key':
            case 'rows_with_index':
              $this->indexColumns = explode(',', $matches[2]);
              break;

            default:
              if (isset($matches[2])) $found = false;
          }
          break;
        }
        if ($i==($key - 1)) $found = false;
      }
    }
    else
    {
      $found = false;
    }

    if ($found===false)
    {
      throw new RoutineLoaderException('Unable to find the designation type of the stored routine');
    }
  }
private function extractDesignationType ( ) : void { $ found = true ; $ key = array_search ( 'begin' , $ this -> routineSourceCodeLines ) ; if ( $ key !== false ) { for ( $ i = 1 ; $ i < $ key ; $ i ++ ) { $ n = preg_match ( '/^\s*--\s+type:\s*(\w+)\s*(.+)?\s*$/' , $ this -> routineSourceCodeLines [ $ key - $ i ] , $ matches ) ; if ( $ n == 1 ) { $ this -> designationType = $ matches [ 1 ] ; switch ( $ this -> designationType ) { case 'bulk_insert' : $ m = preg_match ( '/^([a-zA-Z0-9_]+)\s+([a-zA-Z0-9_,]+)$/' , $ matches [ 2 ] , $ info ) ; if ( $ m == 0 ) { throw new RoutineLoaderException ( 'Error: Expected: -- type: bulk_insert <table_name> <columns>' ) ; } $ this -> bulkInsertTableName = $ info [ 1 ] ; $ this -> bulkInsertKeys = explode ( ',' , $ info [ 2 ] ) ; break ; case 'rows_with_key' : case 'rows_with_index' : $ this -> indexColumns = explode ( ',' , $ matches [ 2 ] ) ; break ; default : if ( isset ( $ matches [ 2 ] ) ) $ found = false ; } break ; } if ( $ i == ( $ key - 1 ) ) $ found = false ; } } else { $ found = false ; } if ( $ found === false ) { throw new RoutineLoaderException ( 'Unable to find the designation type of the stored routine' ) ; } }
Extracts the designation type of the stored routine.
Extracts the designation type of the stored routine .