MySql.Data.VisualStudio.DbObjects.Table.GetTableOptionSql C# (CSharp) Méthode

GetTableOptionSql() private méthode

private GetTableOptionSql ( bool newTable ) : string
newTable bool
Résultat string
    private string GetTableOptionSql(bool newTable)
    {
      List<string> options = new List<string>();
      StringBuilder sql = new StringBuilder(" ");

      if (!newTable)
      {
        if (Name != OldTable.Name)
          options.Add(String.Format("RENAME TO `{0}` ", Name));
      }
      if (AutoInc != OldTable.AutoInc)
        options.Add(String.Format("AUTO_INCREMENT={0}", AutoInc));
      if (AvgRowLength != OldTable.AvgRowLength)
        options.Add(String.Format("AVG_ROW_LENGTH={0}", AvgRowLength));
      if (CheckSum != OldTable.CheckSum)
        options.Add(String.Format("CHECKSUM={0}", CheckSum ? 1 : 0));
      if (Engine != OldTable.Engine)
        options.Add(String.Format("ENGINE={0}", Engine));
      if (InsertMethod != OldTable.InsertMethod)
        options.Add(String.Format("INSERT_METHOD={0}", InsertMethod.ToString()));
      if (MaxRows != OldTable.MaxRows)
        options.Add(String.Format("MAX_ROWS={0}", MaxRows));
      if (MinRows != OldTable.MinRows)
        options.Add(String.Format("MIN_ROWS={0}", MinRows));
      if (PackKeys != OldTable.PackKeys)
        options.Add(String.Format("PACK_KEYS={0}", PackKeys.ToString()));
      if (RowFormat != OldTable.RowFormat)
        options.Add(String.Format("ROW_FORMAT={0}", RowFormat.ToString()));
      if (StringPropertyHasChanged(Comment, OldTable.Comment))
        options.Add(String.Format("COMMENT='{0}'", Comment));
      if (StringPropertyHasChanged(CharacterSet, OldTable.CharacterSet))
        options.Add(String.IsNullOrEmpty(CharacterSet) ? "DEFAULT CHARACTER SET" :
            String.Format("CHARACTER SET='{0}'", CharacterSet));
      if (StringPropertyHasChanged(Collation, OldTable.Collation))
        options.Add(String.IsNullOrEmpty(Collation) ? "DEFAULT COLLATE" :
            String.Format("COLLATE='{0}'", Collation));
      if (StringPropertyHasChanged(DataDirectory, OldTable.DataDirectory))
        options.Add(String.Format("DATA DIRECTORY='{0}' ", DataDirectory));
      if (StringPropertyHasChanged(IndexDirectory, OldTable.IndexDirectory))
        options.Add(String.Format("INDEX DIRECTORY='{0}' ", IndexDirectory));

      string delimiter = "";
      foreach (string option in options)
      {
        sql.AppendFormat("{0}{1}", delimiter, option);
        delimiter = ",\r\n";
      }
      return sql.ToString();
    }