Пример #1
0
        protected static OracleDatabase Parse(string text)
        {
            OracleDatabase oracleDatabase       = new OracleDatabase();
            ConvertScriptToModelVisitor visitor = new ConvertScriptToModelVisitor(oracleDatabase);

            var p = ScriptParser.ParseString(text, "");

            p.Visit <object>(visitor);

            return(oracleDatabase);
        }
Пример #2
0
        protected override void ProcessRecord()
        {
            LogInitializer.Initialize();

            string path = SourcePath;

            SolutionFolder sln = new SolutionFolder(new ScriptParserContext(path, searchPattern));

            OracleDatabase db = new OracleDatabase()
            {
                SourceScript = true,
                Name         = Name,
            };

            var visitor = new ConvertScriptToModelVisitor();

            if (this.Validators != null)
            {
                visitor.Validators.AddRange(this.Validators);
            }

            sln.Visit(visitor);

            // Map items in db


            FileInfo file = new FileInfo(OutputFilename);

            if (!file.Directory.Exists)
            {
                file.Directory.Create();
            }

            db.WriteFile(file.FullName);

            base.WriteObject(db);

            base.ProcessRecord();
        }
Пример #3
0
        public void TestMethod1()
        {
            List <FileInfo> _files = new List <FileInfo>();
            DirectoryInfo   dir    = new DirectoryInfo(@"C:\src\PLSQL\Pickup\Main\Schemas");

            foreach (FileInfo file in dir.GetFiles("*.sql", SearchOption.AllDirectories))
            {
                if (file.Directory.Name.ToLower() == "userobjectprivileges")
                {
                    _files.Add(file);
                }
            }

            var db = new OracleDatabase();

            ConvertScriptToModelVisitor visitor = new ConvertScriptToModelVisitor(db);

            foreach (var item in _files)
            {
                Debug.WriteLine($"parsing {item.FullName}");
                var p = ScriptParser.ParsePath(item.FullName);
                p.Visit <object>(visitor);
            }
        }