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 Unified Diffs Ignore Whitespace Patch

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

405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
...
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
            break;
          }
        }
        builder.Append(separator);
        builder.AppendFormat("CONSTRAINT [CK_{0}_{1}] CHECK {2}", Name, n + 1, check);
      }

      List<ForeignKey> keys = new List<ForeignKey>();

      for (int x = 0; x < ForeignKeys.Count; x++)
      {
        ForeignKey key = ForeignKeys[x];
        keys.Add(key);
      }

      if (keys.Count > 0)
      {
        builder.Append(separator);
        WriteFKeys(keys, builder);
      }

      builder.Append("\r\n);\r\n");

      // Rebuilding an existing table
      if (altName != null)
      {
................................................................................
    private void WriteFKeys(List<ForeignKey> keys, StringBuilder builder)
    {
        for (int index = 0; index < keys.Count; )
        {
            ForeignKey key = keys[index];

            if (index > 0)
                builder.Append(",\r\n");

            builder.AppendFormat(
                "CONSTRAINT [{0}] FOREIGN KEY (", key.Name);

            int startIndex = index;

            do







<
<
<
<
<
<
<
<
|

|
|







 







|







405
406
407
408
409
410
411








412
413
414
415
416
417
418
419
420
421
422
...
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
            break;
          }
        }
        builder.Append(separator);
        builder.AppendFormat("CONSTRAINT [CK_{0}_{1}] CHECK {2}", Name, n + 1, check);
      }









      if (ForeignKeys.Count > 0)
      {
        builder.Append(separator);
        WriteFKeys(ForeignKeys, builder);
      }

      builder.Append("\r\n);\r\n");

      // Rebuilding an existing table
      if (altName != null)
      {
................................................................................
    private void WriteFKeys(List<ForeignKey> keys, StringBuilder builder)
    {
        for (int index = 0; index < keys.Count; )
        {
            ForeignKey key = keys[index];

            if (index > 0)
                builder.Append(",\r\n    ");

            builder.AppendFormat(
                "CONSTRAINT [{0}] FOREIGN KEY (", key.Name);

            int startIndex = index;

            do