private static string InDbFieldDefToSqlDataType(InDbFieldDef fieldDef)
        {
            switch (fieldDef.DataType & DataType.BaseMask)
            {
            case DataType.Boolean:
                return("bit");

            case DataType.Integer:
                return("Int");

            case DataType.Float:
                return("Float");

            case DataType.Currency:
                return("Money");

            case DataType.DateTime:
                return("datetime");

            case DataType.String:
                return(string.Format("varchar({0})", (object)fieldDef.Size));

            case DataType.Memo:
                return("text");

            case DataType.Binary:
                return("image");

            default:
                throw new InDbException("Тип не поддерживается");
            }
        }
 public void DeleteFieldDef(string name, bool autoCorrectIndexes)
 {
     try
     {
         InDbFieldDef fieldDef = this.FieldDefs[name];
         if (!StrUtils.IsNullOrEmpty(fieldDef.OriginalName))
         {
             this.FFieldDefsToDelete.Add(fieldDef);
         }
         this.FieldDefs.RemoveAt(this.FieldDefs.IndexOf(name));
         if (!autoCorrectIndexes)
         {
             return;
         }
         for (int index1 = this.IndexDefs.Count - 1; index1 >= 0; --index1)
         {
             InDbIndexDef indexDef = this.IndexDefs[index1];
             for (int index2 = indexDef.FieldDefs.Count - 1; index2 >= 0; --index2)
             {
                 if (indexDef.FieldDefs[index2] == fieldDef)
                 {
                     indexDef.FieldDefs.RemoveAt(index2);
                     if (this.FModifiedIndexDefs.IndexOf(indexDef) == -1)
                     {
                         this.FModifiedIndexDefs.Add(indexDef);
                     }
                 }
             }
             if (indexDef.FieldDefs.Count == 0)
             {
                 this.DeleteIndexDef(index1);
             }
         }
     }
     catch (Exception ex)
     {
         throw new InDbException(string.Format("Ошибка удаления поля '{0}' таблицы '{1}'.", (object)name, (object)this.Name), ex);
     }
 }
 private static bool IsFieldDefModified(InDbFieldDef fieldDef) => fieldDef.Name != fieldDef.OriginalName || fieldDef.DataType != fieldDef.OriginalDataType || fieldDef.Size != fieldDef.OriginalSize;
 internal int Add(InDbFieldDef fieldDef) => this.FItems.Add((object)fieldDef);