System.Data.SQLite
Hex Artifact Content
Not logged in

Artifact ab064aa710626cc41de1d6c8754a6cd14ae2334a:


0000: 2f 2f 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  //--------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0040: 2d 2d 2d 2d 2d 2d 2d 0d 0a 2f 2f 20 3c 63 6f 70  -------..// <cop
0050: 79 72 69 67 68 74 20 66 69 6c 65 3d 22 53 79 6d  yright file="Sym
0060: 62 6f 6c 50 61 69 72 2e 63 73 22 20 63 6f 6d 70  bolPair.cs" comp
0070: 61 6e 79 3d 22 4d 69 63 72 6f 73 6f 66 74 22 3e  any="Microsoft">
0080: 0d 0a 2f 2f 20 20 20 20 20 20 50 6f 72 74 69 6f  ..//      Portio
0090: 6e 73 20 6f 66 20 74 68 69 73 20 66 69 6c 65 20  ns of this file 
00a0: 63 6f 70 79 72 69 67 68 74 20 28 63 29 20 4d 69  copyright (c) Mi
00b0: 63 72 6f 73 6f 66 74 20 43 6f 72 70 6f 72 61 74  crosoft Corporat
00c0: 69 6f 6e 0d 0a 2f 2f 20 20 20 20 20 20 61 6e 64  ion..//      and
00d0: 20 61 72 65 20 72 65 6c 65 61 73 65 64 20 75 6e   are released un
00e0: 64 65 72 20 74 68 65 20 4d 69 63 72 6f 73 6f 66  der the Microsof
00f0: 74 20 50 75 6c 69 63 20 4c 69 63 65 6e 73 65 2e  t Pulic License.
0100: 20 20 53 65 65 0d 0a 2f 2f 20 20 20 20 20 20 68    See..//      h
0110: 74 74 70 3a 2f 2f 61 72 63 68 69 76 65 2e 6d 73  ttp://archive.ms
0120: 64 6e 2e 6d 69 63 72 6f 73 6f 66 74 2e 63 6f 6d  dn.microsoft.com
0130: 2f 45 46 53 61 6d 70 6c 65 50 72 6f 76 69 64 65  /EFSampleProvide
0140: 72 2f 50 72 6f 6a 65 63 74 2f 4c 69 63 65 6e 73  r/Project/Licens
0150: 65 2e 61 73 70 78 0d 0a 2f 2f 20 20 20 20 20 20  e.aspx..//      
0160: 6f 72 20 4c 69 63 65 6e 73 65 2e 74 78 74 20 66  or License.txt f
0170: 6f 72 20 64 65 74 61 69 6c 73 2e 0d 0a 2f 2f 20  or details...// 
0180: 20 20 20 20 20 41 6c 6c 20 72 69 67 68 74 73 20       All rights 
0190: 72 65 73 65 72 76 65 64 2e 0d 0a 2f 2f 20 3c 2f  reserved...// </
01a0: 63 6f 70 79 72 69 67 68 74 3e 0d 0a 2f 2f 2d 2d  copyright>..//--
01b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01f0: 2d 2d 2d 0d 0a 0d 0a 6e 61 6d 65 73 70 61 63 65  ---....namespace
0200: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c   System.Data.SQL
0210: 69 74 65 0d 0a 7b 0d 0a 20 20 75 73 69 6e 67 20  ite..{..  using 
0220: 53 79 73 74 65 6d 2e 44 69 61 67 6e 6f 73 74 69  System.Diagnosti
0230: 63 73 3b 0d 0a 20 20 75 73 69 6e 67 20 53 79 73  cs;..  using Sys
0240: 74 65 6d 2e 44 61 74 61 2e 43 6f 6d 6d 6f 6e 2e  tem.Data.Common.
0250: 43 6f 6d 6d 61 6e 64 54 72 65 65 73 3b 0d 0a 0d  CommandTrees;...
0260: 0a 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e  .  /// <summary>
0270: 0d 0a 20 20 2f 2f 2f 20 54 68 65 20 53 79 6d 62  ..  /// The Symb
0280: 6f 6c 50 61 69 72 20 65 78 69 73 74 73 20 74 6f  olPair exists to
0290: 20 73 6f 6c 76 65 20 74 68 65 20 72 65 63 6f 72   solve the recor
02a0: 64 20 66 6c 61 74 74 65 6e 69 6e 67 20 70 72 6f  d flattening pro
02b0: 62 6c 65 6d 2e 0d 0a 20 20 2f 2f 2f 20 3c 73 65  blem...  /// <se
02c0: 65 20 63 72 65 66 3d 22 53 71 6c 47 65 6e 65 72  e cref="SqlGener
02d0: 61 74 6f 72 2e 56 69 73 69 74 28 44 62 50 72 6f  ator.Visit(DbPro
02e0: 70 65 72 74 79 45 78 70 72 65 73 73 69 6f 6e 29  pertyExpression)
02f0: 22 2f 3e 0d 0a 20 20 2f 2f 2f 20 43 6f 6e 73 69  "/>..  /// Consi
0300: 64 65 72 20 61 20 70 72 6f 70 65 72 74 79 20 65  der a property e
0310: 78 70 72 65 73 73 69 6f 6e 20 44 28 76 2c 20 22  xpression D(v, "
0320: 6a 33 2e 6a 32 2e 6a 31 2e 61 2e 78 22 29 0d 0a  j3.j2.j1.a.x")..
0330: 20 20 2f 2f 2f 20 77 68 65 72 65 20 76 20 69 73    /// where v is
0340: 20 61 20 56 61 72 52 65 66 2c 20 6a 31 2c 20 6a   a VarRef, j1, j
0350: 32 2c 20 6a 33 20 61 72 65 20 6a 6f 69 6e 73 2c  2, j3 are joins,
0360: 20 61 20 69 73 20 61 6e 20 65 78 74 65 6e 74 20   a is an extent 
0370: 61 6e 64 20 78 20 69 73 20 61 20 63 6f 6c 75 6d  and x is a colum
0380: 6e 73 2e 0d 0a 20 20 2f 2f 2f 20 54 68 69 73 20  ns...  /// This 
0390: 68 61 73 20 74 6f 20 62 65 20 74 72 61 6e 73 6c  has to be transl
03a0: 61 74 65 64 20 65 76 65 6e 74 75 61 6c 6c 79 20  ated eventually 
03b0: 69 6e 74 6f 20 7b 6a 27 7d 2e 7b 78 27 7d 0d 0a  into {j'}.{x'}..
03c0: 20 20 2f 2f 2f 20 0d 0a 20 20 2f 2f 2f 20 54 68    /// ..  /// Th
03d0: 65 20 73 6f 75 72 63 65 20 66 69 65 6c 64 20 72  e source field r
03e0: 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 6f 75  epresents the ou
03f0: 74 65 72 6d 6f 73 74 20 53 71 6c 53 74 61 74 65  termost SqlState
0400: 6d 65 6e 74 20 72 65 70 72 65 73 65 6e 74 69 6e  ment representin
0410: 67 20 61 20 6a 6f 69 6e 0d 0a 20 20 2f 2f 2f 20  g a join..  /// 
0420: 65 78 70 72 65 73 73 69 6f 6e 20 28 73 61 79 20  expression (say 
0430: 6a 32 29 20 2d 20 74 68 69 73 20 69 73 20 61 6c  j2) - this is al
0440: 77 61 79 73 20 61 20 4a 6f 69 6e 20 73 79 6d 62  ways a Join symb
0450: 6f 6c 2e 0d 0a 20 20 2f 2f 2f 20 0d 0a 20 20 2f  ol...  /// ..  /
0460: 2f 2f 20 54 68 65 20 63 6f 6c 75 6d 6e 20 66 69  // The column fi
0470: 65 6c 64 20 6b 65 65 70 73 20 6d 6f 76 69 6e 67  eld keeps moving
0480: 20 66 72 6f 6d 20 6f 6e 65 20 6a 6f 69 6e 20 73   from one join s
0490: 79 6d 62 6f 6c 20 74 6f 20 74 68 65 20 6e 65 78  ymbol to the nex
04a0: 74 2c 20 75 6e 74 69 6c 20 69 74 0d 0a 20 20 2f  t, until it..  /
04b0: 2f 2f 20 73 74 6f 70 73 20 61 74 20 61 20 6e 6f  // stops at a no
04c0: 6e 2d 6a 6f 69 6e 20 73 79 6d 62 6f 6c 2e 0d 0a  n-join symbol...
04d0: 20 20 2f 2f 2f 20 0d 0a 20 20 2f 2f 2f 20 54 68    /// ..  /// Th
04e0: 69 73 20 69 73 20 72 65 74 75 72 6e 65 64 20 62  is is returned b
04f0: 79 20 3c 73 65 65 20 63 72 65 66 3d 22 53 71 6c  y <see cref="Sql
0500: 47 65 6e 65 72 61 74 6f 72 2e 56 69 73 69 74 28  Generator.Visit(
0510: 44 62 50 72 6f 70 65 72 74 79 45 78 70 72 65 73  DbPropertyExpres
0520: 73 69 6f 6e 29 22 2f 3e 2c 0d 0a 20 20 2f 2f 2f  sion)"/>,..  ///
0530: 20 62 75 74 20 6e 65 76 65 72 20 6d 61 6b 65 73   but never makes
0540: 20 69 74 20 69 6e 74 6f 20 61 20 53 71 6c 42 75   it into a SqlBu
0550: 69 6c 64 65 72 2e 0d 0a 20 20 2f 2f 2f 20 3c 2f  ilder...  /// </
0560: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 63 6c 61 73  summary>..  clas
0570: 73 20 53 79 6d 62 6f 6c 50 61 69 72 20 3a 20 49  s SymbolPair : I
0580: 53 71 6c 46 72 61 67 6d 65 6e 74 0d 0a 20 20 7b  SqlFragment..  {
0590: 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 53 79 6d  ..    public Sym
05a0: 62 6f 6c 20 53 6f 75 72 63 65 3b 0d 0a 20 20 20  bol Source;..   
05b0: 20 70 75 62 6c 69 63 20 53 79 6d 62 6f 6c 20 43   public Symbol C
05c0: 6f 6c 75 6d 6e 3b 0d 0a 0d 0a 20 20 20 20 70 75  olumn;....    pu
05d0: 62 6c 69 63 20 53 79 6d 62 6f 6c 50 61 69 72 28  blic SymbolPair(
05e0: 53 79 6d 62 6f 6c 20 73 6f 75 72 63 65 2c 20 53  Symbol source, S
05f0: 79 6d 62 6f 6c 20 63 6f 6c 75 6d 6e 29 0d 0a 20  ymbol column).. 
0600: 20 20 20 7b 0d 0a 20 20 20 20 20 20 74 68 69 73     {..      this
0610: 2e 53 6f 75 72 63 65 20 3d 20 73 6f 75 72 63 65  .Source = source
0620: 3b 0d 0a 20 20 20 20 20 20 74 68 69 73 2e 43 6f  ;..      this.Co
0630: 6c 75 6d 6e 20 3d 20 63 6f 6c 75 6d 6e 3b 0d 0a  lumn = column;..
0640: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 23 72 65      }....    #re
0650: 67 69 6f 6e 20 49 53 71 6c 46 72 61 67 6d 65 6e  gion ISqlFragmen
0660: 74 20 4d 65 6d 62 65 72 73 0d 0a 0d 0a 20 20 20  t Members....   
0670: 20 70 75 62 6c 69 63 20 76 6f 69 64 20 57 72 69   public void Wri
0680: 74 65 53 71 6c 28 53 71 6c 57 72 69 74 65 72 20  teSql(SqlWriter 
0690: 77 72 69 74 65 72 2c 20 53 71 6c 47 65 6e 65 72  writer, SqlGener
06a0: 61 74 6f 72 20 73 71 6c 47 65 6e 65 72 61 74 6f  ator sqlGenerato
06b0: 72 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20  r)..    {..     
06c0: 20 2f 2f 20 53 79 6d 62 6f 6c 20 70 61 69 72 20   // Symbol pair 
06d0: 73 68 6f 75 6c 64 20 6e 65 76 65 72 20 62 65 20  should never be 
06e0: 70 61 72 74 20 6f 66 20 61 20 53 71 6c 42 75 69  part of a SqlBui
06f0: 6c 64 65 72 2e 0d 0a 20 20 20 20 20 20 44 65 62  lder...      Deb
0700: 75 67 2e 41 73 73 65 72 74 28 66 61 6c 73 65 29  ug.Assert(false)
0710: 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20  ;..    }....    
0720: 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 20 20 7d 0d  #endregion..  }.
0730: 0a 7d 0d 0a                                      .}..