예제 #1
0
        public void TestQuery()
        {
            MetadataServiceSettings settings = new MetadataServiceSettings();

            settings.Catalog = @"C:\Users\User\Desktop\GitHub\publish\one-c-sharp-sql\bin\metadata";
            IMetadataService metadata = new MetadataService();

            metadata.Configure(settings);
            metadata.UseServer("sqlexpress");
            metadata.UseDatabase("trade_11_2_3_159_demo");
            metadata.UseDatabase("accounting_3_0_72_72_demo");
            IQueryExecutor     executor  = new QueryExecutor(metadata);
            IScriptingService  scripting = new ScriptingService(metadata, executor);
            IList <ParseError> errors;
            string             sql = scripting.PrepareScript(GetTestQueryText(), out errors);

            foreach (ParseError error in errors)
            {
                Console.WriteLine(error.Message);
            }
            if (errors.Count == 0)
            {
                Console.WriteLine(sql);
            }
        }