Diff of /SQLite.Designer/Design/Column.cs [d935ac] .. [a235fd]  Maximize  Restore

Switch to unified view

a/SQLite.Designer/Design/Column.cs b/SQLite.Designer/Design/Column.cs
...
...
14
  using System.ComponentModel.Design;
14
  using System.ComponentModel.Design;
15
  using System.Windows.Forms;
15
  using System.Windows.Forms;
16
  using System.Drawing.Design;
16
  using System.Drawing.Design;
17
  using System.Data;
17
  using System.Data;
18
  using System.Data.Common;
18
  using System.Data.Common;
19
  using System.Globalization;
19
20
20
  internal class Column : IHaveConnection
21
  internal class Column : IHaveConnection
21
  {
22
  {
22
    private bool _allowNulls = false;
23
    private bool _allowNulls;
23
    private string _dataType = "";
24
    private string _dataType = "";
24
    private string _defaultValue = "";
25
    private string _defaultValue = "";
25
    private string _columnName = "";
26
    private string _columnName = "";
26
    private string _origName = "";
27
    private string _origName = "";
27
    private string _collate;
28
    private string _collate;
...
...
52
      _collate = (row.IsNull("COLLATION_NAME") == false) ? row["COLLATION_NAME"].ToString() : String.Empty;
53
      _collate = (row.IsNull("COLLATION_NAME") == false) ? row["COLLATION_NAME"].ToString() : String.Empty;
53
54
54
      string edmtype = (row.IsNull("EDM_TYPE") == false) ? row["EDM_TYPE"].ToString() : String.Empty;
55
      string edmtype = (row.IsNull("EDM_TYPE") == false) ? row["EDM_TYPE"].ToString() : String.Empty;
55
      if (edmtype == "nvarchar" || edmtype == "varchar" || edmtype == "blob" || edmtype == "nchar" || edmtype == "char")
56
      if (edmtype == "nvarchar" || edmtype == "varchar" || edmtype == "blob" || edmtype == "nchar" || edmtype == "char")
56
      {
57
      {
57
        int size = (row.IsNull("CHARACTER_MAXIMUM_LENGTH") == false) ? Convert.ToInt32(row["CHARACTER_MAXIMUM_LENGTH"]) : int.MaxValue;
58
        int size = (row.IsNull("CHARACTER_MAXIMUM_LENGTH") == false) ? Convert.ToInt32(row["CHARACTER_MAXIMUM_LENGTH"], CultureInfo.InvariantCulture) : int.MaxValue;
58
        if (size != int.MaxValue)
59
        if (size != int.MaxValue)
59
          _dataType = string.Format("{0}({1})", _dataType, size);
60
          _dataType = string.Format(CultureInfo.InvariantCulture, "{0}({1})", _dataType, size);
60
      }
61
      }
61
      else if (edmtype == "decimal")
62
      else if (edmtype == "decimal")
62
      {
63
      {
63
        int size = (row.IsNull("NUMERIC_PRECISION") == false) ? Convert.ToInt32(row["NUMERIC_PRECISION"]) : 53;
64
        int size = (row.IsNull("NUMERIC_PRECISION") == false) ? Convert.ToInt32(row["NUMERIC_PRECISION"], CultureInfo.InvariantCulture) : 53;
64
        int scale = (row.IsNull("NUMERIC_SCALE") == false) ? Convert.ToInt32(row["NUMERIC_SCALE"]) : int.MaxValue;
65
        int scale = (row.IsNull("NUMERIC_SCALE") == false) ? Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture) : int.MaxValue;
65
66
66
        if (size != 53)
67
        if (size != 53)
67
        {
68
        {
68
          string scalestr = (scale == int.MaxValue) ? "" : String.Format(",{0}", scale);
69
          string scalestr = (scale == int.MaxValue) ? "" : String.Format(CultureInfo.InvariantCulture, ",{0}", scale);
69
          _dataType = string.Format("{0}({1}{2})", _dataType, size, scalestr);
70
          _dataType = string.Format(CultureInfo.InvariantCulture, "{0}({1}{2})", _dataType, size, scalestr);
70
        }
71
        }
71
      }
72
      }
72
    }
73
    }
73
74
74
    #region IHaveConnection Members
75
    #region IHaveConnection Members
...
...
142
          DataType = value.ToString();
143
          DataType = value.ToString();
143
          break;
144
          break;
144
        case 2:
145
        case 2:
145
          try
146
          try
146
          {
147
          {
147
            AllowNulls = Convert.ToBoolean(value);
148
            AllowNulls = Convert.ToBoolean(value, CultureInfo.InvariantCulture);
148
          }
149
          }
149
          catch
150
          catch
150
          {
151
          {
151
          }
152
          }
152
          break;
153
          break;