Пример #1
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            SelectSqlForSubQuery subQuery = sqlElement as SelectSqlForSubQuery;
            XmlElement           xmlFrom  = SerializerUtil.AddElement(xmlParent, From.FROM);

            subQuery.From.ToXml(subQuery.From, xmlFrom);
            XmlElement xmlJoinCondition = SerializerUtil.AddElement(xmlParent, JoinConditionStatement.JOINCONDITIONSTATEMENT);

            subQuery.JoinCondition.ToXml(subQuery.JoinCondition, xmlJoinCondition);
            XmlElement xmlCondition = SerializerUtil.AddElement(xmlParent, ConditionStatement.CONDITIONSTATEMENT);

            subQuery.Condition.ToXml(subQuery.Condition, xmlCondition);

            /*
             * MainFromItem和JoinSubQueryConditionItem只序列化,不反序列化。
             * 其反序列化操作已包含在From和JoinCondition的集合中,直接从集合中取即可。
             * */
            XmlElement xmlMainFromItem = SerializerUtil.AddElement(xmlParent, MAINFROMITEM);

            subQuery.MainFromItem.ToXml(subQuery.MainFromItem, xmlMainFromItem);
            XmlElement xmlJoinSubQueryConditionItem = SerializerUtil.AddElement(xmlParent, JOINSUBQUERYCONDITIONITEM);

            subQuery.JoinSubQueryConditionItem.ToXml(subQuery.JoinSubQueryConditionItem, xmlJoinSubQueryConditionItem);
        }
Пример #2
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            SelectListField selectListField = sqlElement as SelectListField;
            XmlElement      xmlFieldAlias   = SerializerUtil.AddElement(xmlParent, FIELDALIAS, selectListField.FieldAlias);
        }
Пример #3
0
        /// <summary>
        /// 转换成XmlElement
        /// </summary>
        /// <param name="sqlElement">要转换的对象</param>
        /// <param name="xmlParent">附加到的XmlElement</param>
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            SubQuerySqlStatement selectSql     = sqlElement as SubQuerySqlStatement;
            XmlElement           xmlSelectList = SerializerUtil.AddElement(xmlParent, SelectFieldListStatement.SELECTLISTSTATEMENT);

            selectSql.SelectList.ToXml(selectSql.SelectList, xmlSelectList);
            XmlElement xmlFrom = SerializerUtil.AddElement(xmlParent, From.FROM);

            selectSql.From.ToXml(selectSql.From, xmlFrom);
            XmlElement xmlJoinCondition = SerializerUtil.AddElement(xmlParent, JoinConditionStatement.JOINCONDITIONSTATEMENT);

            selectSql.JoinCondition.ToXml(selectSql.JoinCondition, xmlJoinCondition);
            XmlElement xmlFilterCondition = SerializerUtil.AddElement(xmlParent, FILTERCONDITION);

            selectSql.FilterCondition.ToXml(selectSql.FilterCondition, xmlFilterCondition);
            XmlElement xmlOrderByCondition = SerializerUtil.AddElement(xmlParent, ORDERBYCONDITION);

            selectSql.OrderByCondition.ToXml(selectSql.OrderByCondition, xmlOrderByCondition);

            /*
             * MainFromItem只序列化,不反序列化。
             * 其反序列化操作已包含在Froms的集合中,直接从集合中取即可。
             * */
            XmlElement xmlMainFromItem = SerializerUtil.AddElement(xmlParent, MAINFROMITEM);

            selectSql.MainFromItem.ToXml(selectSql.MainFromItem, xmlMainFromItem);
        }
Пример #4
0
        /// <summary>
        /// 将SqlNode的属性写入XmlElement。
        /// </summary>
        /// <param name="sqlElement">SqlNode类的对象(或继承自SqlNode类的对象)</param>
        /// <param name="xmlParent">XmlDocument中的元素</param>
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            FromItem   fromItem = sqlElement as FromItem;
            XmlElement xmlTable = SerializerUtil.AddElement(xmlParent, SqlTable.TABLE);

            fromItem.Table.ToXml(fromItem.Table, xmlTable);
        }
Пример #5
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            // 先处理基类
            base.ToXml(sqlElement, xmlParent);

            SqlTable   table                = sqlElement as SqlTable;
            XmlElement tableNameElement     = SerializerUtil.AddElement(xmlParent, TABLENAME, table.TableName);
            XmlElement tableAliasElement    = SerializerUtil.AddElement(xmlParent, TABLEALIAS, table.TableAlias);
            XmlElement realTableNameElement = SerializerUtil.AddElement(xmlParent, REALTABLENAME, table.RealTableName);
        }
Пример #6
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            LeftJoinItem leftJoinItem = sqlElement as LeftJoinItem;

            XmlElement xmlLeftJoinTable = SerializerUtil.AddElement(xmlParent, LEFTJOINTABLE);

            leftJoinItem.LeftJoinTable.ToXml(leftJoinItem.LeftJoinTable, xmlLeftJoinTable);

            XmlElement xmlAddtionalCondition = SerializerUtil.AddElement(xmlParent, ADDITIONALCONDITION, leftJoinItem.AdditionalCondition);
        }
Пример #7
0
        /// <summary>
        /// 转换成XML
        /// </summary>
        /// <param name="sqlElement">SQL元素</param>
        /// <param name="xmlParent">XML父节点元素</param>
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            InsertSqlStaMSS insertSql       = sqlElement as InsertSqlStaMSS;
            XmlElement      xmlInsertFields = SerializerUtil.AddElement(xmlParent, InsertFieldList.INSERTFIELDLIST);

            insertSql.InsertFields.ToXml(insertSql.InsertFields, xmlInsertFields);

            //不需要对FieldValue序列化
            //XmlElement xmlInsertValues = SerializerUtil.AddElement(xmlParent, InsertValueList.INSERTVALUELIST);
            //insertSql.InsertValues.ToXml(insertSql.InsertValues, xmlInsertValues);
        }
Пример #8
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            UpdateSqlStatement updateSql       = sqlElement as UpdateSqlStatement;
            XmlElement         xmlUpdateFields = SerializerUtil.AddElement(xmlParent, UpdateFieldList.UPDATEFIELDLIST);

            updateSql.UpdateFields.ToXml(updateSql.UpdateFields, xmlUpdateFields);

            XmlElement xmlUpdateCondition = SerializerUtil.AddElement(xmlParent, UPDATECONDITION);

            updateSql.UpdateCondition.ToXml(updateSql.UpdateCondition, xmlUpdateCondition);
        }
Пример #9
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            DeleteSqlStatement deleteSql    = sqlElement as DeleteSqlStatement;
            XmlElement         xmlCondition = SerializerUtil.AddElement(xmlParent, ConditionStatement.CONDITIONSTATEMENT);

            deleteSql.Condition.ToXml(deleteSql.Condition, xmlCondition);
            if (deleteSql.SubQuerySql != null)// SubQuerySql 可以为空
            {
                XmlElement xmlSubQuerySql = SerializerUtil.AddElement(xmlParent, SUBQUERYSQL);
                deleteSql.SubQuerySql.ToXml(deleteSql.SubQuerySql, xmlSubQuerySql);
            }
        }
Пример #10
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            JoinConditionItem joinConditionItem = sqlElement as JoinConditionItem;

            XmlElement xmlLeftField = SerializerUtil.AddElement(xmlParent, LEFTFIELD);

            joinConditionItem.LeftField.ToXml(joinConditionItem.LeftField, xmlLeftField);

            XmlElement xmlRightField = SerializerUtil.AddElement(xmlParent, RIGHTFIELD);

            joinConditionItem.RightField.ToXml(joinConditionItem.RightField, xmlRightField);
        }
Пример #11
0
        /// <summary>
        /// 转换成XML
        /// </summary>
        /// <param name="sqlElement">SQL元素</param>
        /// <param name="xmlParent">XML父节点元素</param>
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            Field field = sqlElement as Field;

            if (field.Table != null)// Table 可以为空
            {
                XmlElement xmlTable = SerializerUtil.AddElement(xmlParent, SqlTable.TABLE);
                field.Table.ToXml(field.Table, xmlTable);
            }

            SerializerUtil.AddElement(xmlParent, FIELDNAME, field.FieldName);
            SerializerUtil.AddElement(xmlParent, ISUSEFIELDPREFIX, field.IsUseFieldPrefix.ToString());
        }
Пример #12
0
        public override void ToXml(SqlElement sqlElement, XmlElement xmlParent)
        {
            base.ToXml(sqlElement, xmlParent);

            SqlStatement sqlStatement         = sqlElement as SqlStatement;
            XmlElement   xmlTableName         = SerializerUtil.AddElement(xmlParent, TABLENAME, sqlStatement.TableName);
            XmlElement   xmlTableCode         = SerializerUtil.AddElement(xmlParent, TABLECODE, sqlStatement.TableCode);
            XmlElement   xmlCOID              = SerializerUtil.AddElement(xmlParent, COMMONOBJECTID, sqlStatement.CommonObjectID);
            XmlElement   xmlNodeObjectID      = SerializerUtil.AddElement(xmlParent, NODEOBJECTID, sqlStatement.NodeID);
            XmlElement   xmlCOVersion         = SerializerUtil.AddElement(xmlParent, COMMONOBJECTVERSION, sqlStatement.CommonObjectVersion);
            XmlElement   xmlNodeObjectVersion = SerializerUtil.AddElement(xmlParent, NODEOBJECTVERSION, sqlStatement.NodeVersion);

            XmlElement xmlPrimaryKeyField = SerializerUtil.AddElement(xmlParent, SqlPrimaryKey.SQLPRIMARYKEY);

            sqlStatement.PrimaryKeys.ToXml(sqlStatement.PrimaryKeys, xmlPrimaryKeyField);
        }
Пример #13
0
        /// <summary>
        /// 将SqlElement的属性写入XmlElement。
        /// </summary>
        /// <param name="sqlNode">SqlElement类的对象(或继承自SqlElement类的对象)</param>
        /// <param name="xmlParent">XmlDocument中的元素</param>
        public virtual void ToXml(SqlElement sqlNode, XmlElement xmlParent)
        {
            //XmlElement xmlId = SerializerUtil.AddElement(xmlParent, ID, sqlNode.Id);
            //XmlElement xmlVersion = SerializerUtil.AddElement(xmlParent, VERSION, sqlNode.Version);
            if (sqlNode.ChildCollection != null)
            {
                XmlElement xmlchildList = SerializerUtil.AddElement(xmlParent, CHILDCOLLECTION);
                foreach (SqlElement childNode in sqlNode.ChildCollection)
                {
                    XmlElement childNodeElement = SerializerUtil.AddElement(xmlchildList, SQLELEMENT);

                    /*
                     * FullName:一个包含 Type 的完全限定名的字符串,其中包括 Type 的命名空间但不包括程序集;
                     * 例如,C# 字符串类型的完全限定名为 System.String。
                     * */
                    //childNodeElement.SetAttribute(CLASSFULLNAME, childNode.GetType().FullName);
                    childNodeElement.SetAttribute(SQLELEMENTTYPE, SqlElementFactory.GetSqlElementType(childNode).ToString());
                    childNode.ToXml(childNode, childNodeElement);
                }
            }
        }