System.Data.SQLite
Check-in [1119da4703]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove unnecessary loop and fix indentation of foreign key SQL fragments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | VsDesignerFKey
Files: files | file ages | folders
SHA1: 1119da4703ba5e9b2ae4f7f8f01dffc997133355
User & Date: mistachkin 2012-01-25 18:10:54
Context
2012-01-25
18:17
When emitting SQL for foreign keys in the VS designer, be sure to take all returned rows into account. Fix for [b226147b37]. check-in: 38cd99987c user: mistachkin tags: trunk
18:10
Remove unnecessary loop and fix indentation of foreign key SQL fragments. Closed-Leaf check-in: 1119da4703 user: mistachkin tags: VsDesignerFKey
13:37
More work on fixing ticket [b226147b37]. check-in: e67a436c40 user: mistachkin tags: VsDesignerFKey
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to SQLite.Designer/Design/Table.cs.

   405    405               break;
   406    406             }
   407    407           }
   408    408           builder.Append(separator);
   409    409           builder.AppendFormat("CONSTRAINT [CK_{0}_{1}] CHECK {2}", Name, n + 1, check);
   410    410         }
   411    411   
   412         -      List<ForeignKey> keys = new List<ForeignKey>();
   413         -
   414         -      for (int x = 0; x < ForeignKeys.Count; x++)
   415         -      {
   416         -        ForeignKey key = ForeignKeys[x];
   417         -        keys.Add(key);
   418         -      }
   419         -
   420         -      if (keys.Count > 0)
          412  +      if (ForeignKeys.Count > 0)
   421    413         {
   422    414           builder.Append(separator);
   423         -        WriteFKeys(keys, builder);
          415  +        WriteFKeys(ForeignKeys, builder);
   424    416         }
   425    417   
   426    418         builder.Append("\r\n);\r\n");
   427    419   
   428    420         // Rebuilding an existing table
   429    421         if (altName != null)
   430    422         {
................................................................................
   485    477       private void WriteFKeys(List<ForeignKey> keys, StringBuilder builder)
   486    478       {
   487    479           for (int index = 0; index < keys.Count; )
   488    480           {
   489    481               ForeignKey key = keys[index];
   490    482   
   491    483               if (index > 0)
   492         -                builder.Append(",\r\n");
          484  +                builder.Append(",\r\n    ");
   493    485   
   494    486               builder.AppendFormat(
   495    487                   "CONSTRAINT [{0}] FOREIGN KEY (", key.Name);
   496    488   
   497    489               int startIndex = index;
   498    490   
   499    491               do