/// <summary> /// Добавляем where к JOIN /// </summary> /// <param name="where">Класс-ограничение</param> public void AddWhere(WhereClass where) { //this.where.Insert(0, where); this.where.Add(where); }
/// <summary> /// Конструктор /// </summary> public SQLStruct() { select = new SelectClass(this); from = new FromClass(this); where = new WhereClass(this); As = new AsClass(this); group = new GroupClass(this); }
/// <summary> /// Пишет ограничение /// </summary> /// <param name="where1"></param> /// <param name="where2"></param> /// <param name="CurentTable"></param> /// <param name="DataSetName"></param> /// <param name="Last"></param> public void WriteBeginWhere(WhereClass where1, WhereClass where2, string CurentTable, string DataSetName, bool Last) { string str1 = where1.ToString(CurentTable); string str2 = where2.ToString(CurentTable); string str = ""; //= str1 + " and "+ str2; if ((str1 == "" || str1 !=null) && (str2 == "" || str2 !=null)) tw.WriteLine("<xsl:for-each select=\"//" + DataSetName + "//" + CurentTable +"\">"); else { if (str1 == null || str1 == "") str = str2; else if (str2 == null || str2 == "") str = str1; else str = str1 + " and "+ str2; tw.WriteLine("<xsl:for-each select=\"//" + DataSetName + "//" + CurentTable +"[" + str +"]\">"); } if (Last) { tw.WriteLine("<xsl:if test=\"position() < 2\">"); } }
/// <summary> /// Закрывает теги для ограничений /// </summary> /// <param name="where"></param> /// <param name="Last"></param> public void WriteBeginEnd(WhereClass where,bool Last) { if (where.isOnlyIf()) { //tw.Write("</xsl:if>"); } if (Last) { tw.WriteLine("</xsl:if"); } }
/// <summary> /// Пишет ограничения /// </summary> /// <param name="where">Класс-ограничения</param> /// <param name="CurentTable">Имя текущей таблицы</param> /// <param name="DataSetName">Имя дата-сета</param> /// <param name="Last"></param> public void WriteBeginWhere(WhereClass where, string CurentTable, string DataSetName, bool Last) { string str = where.ToString(CurentTable); string AliasTable = CurentTable; if (where.baseSql.alias.GetTableAlias(CurentTable)!=null) AliasTable = where.baseSql.alias.GetTableAlias(CurentTable); if (str == "" || str == null) tw.WriteLine("<xsl:for-each select=\"//" + DataSetName + "//" + AliasTable +"\">"); else tw.WriteLine("<xsl:for-each select=\"//" + DataSetName + "//" + AliasTable +"[" + str +"]\">"); if (Last) { tw.WriteLine("<xsl:if test=\"position() < 2\">"); } }