Example #1
0
        //private ColumnSchema GetColumnSchema(ViewColumn col)
        //{
        //    ColumnSchema ci = new ColumnSchema();
        //    ci.Alias = col.Name;
        //    ci.Name = col.DisplayName;

        //    ci.AllowNulls = false;

        //    ci.NetType = DbTypeToNeType(col.DataType);

        //    ci.DataType = col.DataType;
        //    ci.Length = col.Length;
        //    ci.IsAutoIncrement = false;

        //    ci.IsPrimaryKey = false;
        //    ci.IsForeignKey = false;

        //    ci.HighValue = col.HighValue;
        //    ci.LowValue = col.LowValue;

        //    ci.IsActive = true;

        //    ci.DefaultValue = getDefaultValue(ci.AllowNulls, col.DefaultValue, ci.NetType);
        //    ci.IsReadOnly = false;
        //    return ci;


        //    //ci.DataTypeId = (int)dr["ProviderType"];
        //    //ci.DefaultTestValue = ProviderInfoManager.GetInstance().GetTestDefaultById(this.dbProviderType, ci.DataTypeId);

        //    //ci.IsUnique = (bool)dr["IsUnique"];

        //    //ci.Ordinal = (int)dr["ColumnOrdinal"];
        //}



        private ProcedureSchema CreateProcedureSchema(PdPDM.Procedure pro)
        {
            ProcedureSchema prc = new ProcedureSchema();

            prc.Name = pro.Name;
            //foreach( PdPDM.Parameter par in pro.Par

            //string tmpFile = System.IO.Path.GetTempFileName();
            //System.IO.File.WriteAllText(tmpFile, pro.TextPreview);


            //if (!pgr.ParseFile(tmpFile)) throw new Exception("Not Parse");
            if (!pgr.ParseString(pro.TextPreview))
            {
                throw new Exception("Not Parse");
            }
            CodeObject list = pgr.Find("/.*procedure_param_list", pgr.GetRoot());

            if (list != null)
            {
                ParseProcedure_param_list(prc, list);
            }

            return(prc);
        }
Example #2
0
        public void Test()
        {
            CodeParser parser = new CodeParser(CodeParser.ProgramLanguage.CSharp1);

            Assert.IsNotNull(parser);
            parser.ParseString(@"
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Savchin.CodeParsing;

namespace ToolsTest
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void Test()
        {
            CodeParser parser= new CodeParser(CodeParser.ProgramLanguage.CSharp1);
            Assert.IsNotNull(parser);
            parser.ParseString();
        }
    }
}
            ");

            Assert.IsNotNull(parser.GetRoot());
        }