示例#1
0
 public static ActiveQueryBuilder.View.WinForms.QueryBuilder CreateQueryBuilderSQLite(
     string connectionString,
     bool loadDefaultDatabaseOnly,
     bool loadSystemObjects,
     bool withFields
     )
 {
     ActiveQueryBuilder.View.WinForms.QueryBuilder qb = new ActiveQueryBuilder.View.WinForms.QueryBuilder( )
     {
         SyntaxProvider   = new ActiveQueryBuilder.Core.SQLiteSyntaxProvider( ),
         MetadataProvider = new ActiveQueryBuilder.Core.SQLiteMetadataProvider( )
     };
     qb.MetadataProvider.Connection = new System.Data.SQLite.SQLiteConnection(connectionString);
     {
         ActiveQueryBuilder.Core.MetadataLoadingOptions loadingOptions = qb.SQLContext.MetadataContainer.LoadingOptions;
         loadingOptions.LoadDefaultDatabaseOnly = loadDefaultDatabaseOnly;
         loadingOptions.LoadSystemObjects       = loadSystemObjects;
         //loadingOptions.IncludeFilter.Types = MetadataType.Field;
         //loadingOptions.ExcludeFilter.Schemas.Add("dbo");
     }
     qb.InitializeDatabaseSchemaTree( );
     qb.MetadataContainer.LoadAll(withFields);
     return(qb);
 } // createQueryBuilder(...)
示例#2
0
        static void Main()
        {
            try
            {
                DataPhilosophiaeSection dps = cm.GetSection("DataPhilosophiaeSection") as DataPhilosophiaeSection;
                if (dps != null)
                {
                    System.Console.WriteLine(dps.Stage.PathDir);
                    foreach (DataStoreElement ds in dps.DataStores)
                    {
                        System.Console.WriteLine(ds.Name);
                        System.Console.WriteLine(ds.LoadDefaultDatabaseOnly);
                        System.Console.WriteLine(ds.LoadSystemObjects);
                        System.Console.WriteLine(ds.WithFields);
                        if (string.IsNullOrWhiteSpace(ds.PathDir))
                        {
                            ds.PathDir = System.IO.Path.Combine(dps.Stage.PathDir, ds.Name);
                            cm.Save(System.Configuration.ConfigurationSaveMode.Minimal, true);
                        }
                        System.Console.WriteLine(ds.PathDir);
                    }
                }
                //DataStoreElement dse = new DataStoreElement(  );
                //cm.Save( System.Configuration.ConfigurationSaveMode.Minimal, false );
            }
            catch (System.Configuration.ConfigurationErrorsException ex)
            {
                System.Console.WriteLine(ex.Message);
            }
            try
            {
                System.Configuration.ConnectionStringSettingsCollection settings = System.Configuration.ConfigurationManager.ConnectionStrings;
                if (settings != null)
                {
                    foreach (System.Configuration.ConnectionStringSettings cs in settings)
                    {
                        System.Console.WriteLine("            Name:" + cs.Name);
                        System.Console.WriteLine("    ProviderName:" + cs.ProviderName);
                        System.Console.WriteLine("ConnectionString:" + cs.ConnectionString);
                    }
                }
            }
            catch (System.Configuration.ConfigurationErrorsException ex)
            {
                System.Console.WriteLine(ex.Message);
            }
            {
                DataPhilosophiaeSection dps = cm.GetSection("DataPhilosophiaeSection") as DataPhilosophiaeSection;
                DataStoreElement        ds  = dps.DataStores[0];
                System.Configuration.ConnectionStringSettingsCollection settings = System.Configuration.ConfigurationManager.ConnectionStrings;
                System.Configuration.ConnectionStringSettings           cs       = settings[ds.ConnectionStringName];
                //

                ActiveQueryBuilder.Core.SyntaxProviderList syntaxProviderList = new ActiveQueryBuilder.Core.SyntaxProviderList( );
                ActiveQueryBuilder.Core.SQLContext         sc = new ActiveQueryBuilder.Core.SQLContext( )
                {
                    SyntaxProvider   = new ActiveQueryBuilder.Core.AutoSyntaxProvider( ),
                    MetadataProvider = new ActiveQueryBuilder.Core.OLEDBMetadataProvider
                    {
                        Connection = new System.Data.OleDb.OleDbConnection( )
                        {
                            ConnectionString = cs.ConnectionString
                        }
                    }
                };
            }
            {
                DataPhilosophiaeSection dps = cm.GetSection("DataPhilosophiaeSection") as DataPhilosophiaeSection;
                DataStoreElement        ds  = dps.DataStores[0];
                System.Configuration.ConnectionStringSettingsCollection settings = System.Configuration.ConfigurationManager.ConnectionStrings;
                System.Configuration.ConnectionStringSettings           cs       = settings[ds.ConnectionStringName];
                //
                ActiveQueryBuilder.Core.SyntaxProviderList syntaxProviderList = new ActiveQueryBuilder.Core.SyntaxProviderList( );
                ActiveQueryBuilder.Core.SQLContext         sc = new ActiveQueryBuilder.Core.SQLContext( )
                {
                    SyntaxProvider   = new ActiveQueryBuilder.Core.SQLiteSyntaxProvider( ),
                    MetadataProvider = new ActiveQueryBuilder.Core.SQLiteMetadataProvider( )
                    {
                        Connection = new System.Data.SQLite.SQLiteConnection( )
                        {
                            ConnectionString = cs.ConnectionString
                        }
                    }
                };
                ActiveQueryBuilder.Core.MetadataLoadingOptions loadingOptions = sc.MetadataContainer.LoadingOptions;
                loadingOptions.LoadDefaultDatabaseOnly = ds.LoadDefaultDatabaseOnly == 1 ? true : false;
                loadingOptions.LoadSystemObjects       = ds.LoadSystemObjects == 1 ? true : false;
                //loadingOptions.IncludeFilter.Types = MetadataType.Field;
                //loadingOptions.ExcludeFilter.Schemas.Add(“dbo”);
                sc.MetadataContainer.LoadAll(ds.WithFields == 1 ? true : false);
            }

            //TunnelSection ts = System.Configuration.ConfigurationManager.GetSection( "TunnelSection" ) as TunnelSection;
            TunnelSection       ts                = cm.GetSection("TunnelSection") as TunnelSection;
            int                 count1            = ts.Tunnels.Count;
            HostConfigElement   hc                = ts.Tunnels[0];
            string              sSHServerHostname = hc.SSHServerHostname;
            string              username          = hc.Username;
            TunnelCollection    tunnels           = hc.Tunnels;
            int                 count2            = tunnels.Count;
            TunnelConfigElement tce               = tunnels[0];
            string              name              = tce.Name;
            int                 localPort         = tce.LocalPort;

            //ProductSettings productSettings = System.Configuration.ConfigurationManager.GetSection( "ProductSettings" ) as ProductSettings;
            //ConfigurationClassLoader x = System.Configuration.ConfigurationManager.GetSection( "Plugins" ) as ConfigurationClassLoader;

            //
            System.Configuration.ConfigurationSectionGroup      a        = cm.GetSectionGroup("DataStoreGroup");
            System.Configuration.ConfigurationSectionCollection sections = a.Sections;
            int count = sections.Count;

            System.Configuration.ConfigurationSection get = sections.Get(0);

            //         NewMethod( );
            //
            System.Windows.Forms.Application.EnableVisualStyles( );
            System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            System.Windows.Forms.Application.Run(new Form1( ));
        }
示例#3
0
        private static ActiveQueryBuilder.Core.SQLContext PullMetadata(DataModel.DataStore ds)
        {
            ActiveQueryBuilder.Core.SQLContext sc;
            switch ((DataModel.DataStore.SyntaxProviderEnum)ds.SyntaxProvider)
            {
            case DataModel.DataStore.SyntaxProviderEnum.SQLITE:
                sc = CreateAqbQbSQLite(ds);
                break;

            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2014:
                return(sc = null); // CreateAqbQbMSSS( ds );

            // break;
            case DataModel.DataStore.SyntaxProviderEnum.AUTO:
                return(sc = null); // CreateAqbQbAuto( ds );

            // break;
            case DataModel.DataStore.SyntaxProviderEnum.GENERIC:
            case DataModel.DataStore.SyntaxProviderEnum.ANSI_SQL_2003:
            case DataModel.DataStore.SyntaxProviderEnum.ANSI_SQL_89:
            case DataModel.DataStore.SyntaxProviderEnum.ANSI_SQL_92:
            case DataModel.DataStore.SyntaxProviderEnum.FIREBIRD_1_0:
            case DataModel.DataStore.SyntaxProviderEnum.FIREBIRD_1_5:
            case DataModel.DataStore.SyntaxProviderEnum.FIREBIRD_2_0:
            case DataModel.DataStore.SyntaxProviderEnum.FIREBIRD_2_5:
            case DataModel.DataStore.SyntaxProviderEnum.IBM_DB2:
            case DataModel.DataStore.SyntaxProviderEnum.IBM_INFORMIX_10:
            case DataModel.DataStore.SyntaxProviderEnum.IBM_INFORMIX_8:
            case DataModel.DataStore.SyntaxProviderEnum.IBM_INFORMIX_9:
            case DataModel.DataStore.SyntaxProviderEnum.MS_ACCESS_2000:
            case DataModel.DataStore.SyntaxProviderEnum.MS_ACCESS_2003:
            case DataModel.DataStore.SyntaxProviderEnum.MS_ACCESS_97:
            case DataModel.DataStore.SyntaxProviderEnum.MS_ACCESS_XP:
            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2000:
            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2005:
            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2008:
            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2012:
            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_7:
            case DataModel.DataStore.SyntaxProviderEnum.MS_SQL_SERVER_COMPACT_EDITION:
            case DataModel.DataStore.SyntaxProviderEnum.MYSQL_3_XX:
            case DataModel.DataStore.SyntaxProviderEnum.MYSQL_4_0:
            case DataModel.DataStore.SyntaxProviderEnum.MYSQL_4_1:
            case DataModel.DataStore.SyntaxProviderEnum.MYSQL_5_0:
            case DataModel.DataStore.SyntaxProviderEnum.ORACLE_10:
            case DataModel.DataStore.SyntaxProviderEnum.ORACLE_11:
            case DataModel.DataStore.SyntaxProviderEnum.ORACLE_7:
            case DataModel.DataStore.SyntaxProviderEnum.ORACLE_8:
            case DataModel.DataStore.SyntaxProviderEnum.ORACLE_9:
            case DataModel.DataStore.SyntaxProviderEnum.POSTGRESQL:
            case DataModel.DataStore.SyntaxProviderEnum.SYBASE_ASE:
            case DataModel.DataStore.SyntaxProviderEnum.SYBASE_SQL_ANYWHERE:
            case DataModel.DataStore.SyntaxProviderEnum.TERADATA:
            case DataModel.DataStore.SyntaxProviderEnum.VISTADB:
            default:
                return(null);
            }
            ActiveQueryBuilder.Core.MetadataLoadingOptions loadingOptions = sc.MetadataContainer.LoadingOptions;
            loadingOptions.LoadDefaultDatabaseOnly = ds.LoadDefaultDatabaseOnly;
            loadingOptions.LoadSystemObjects       = ds.LoadSystemObjects;
            //loadingOptions.IncludeFilter.Types = MetadataType.Field;
            //loadingOptions.ExcludeFilter.Schemas.Add(“dbo”);
            {
                ds.PullTS = System.DateTime.Now;
                string x = string.Format(Global.TS_MASK_FORMAT, ds.PullTS).Replace(":", "");
                ds.TempFileFullPathName = System.IO.Path.GetTempFileName( );
                ds.AqbQbFilename        = Global.DataStoreCollectionPathName + x + "." + ds.Name + Global.FileExtensionXmlAqbQb;
                ds.MiFqnFilename        = Global.DataStoreCollectionPathName + x + "." + ds.Name + Global.FileExtensionXmlMiFqn;
            }
            sc.MetadataContainer.LoadAll(ds.WithFields);
            //qb.InitializeDatabaseSchemaTree( );
            return(sc);
        }