示例#1
0
        }             // public static void f( ... ) ...

        private static void Dump(ActiveQueryBuilder.View.WinForms.QueryBuilder qb, DataStore ds)
        {
            string TS_STR = @"D:\TEMP\SQLite\" + DataStore.TS_STR.Replace(":", "");

            {
                // Export AQB's Query Builder XML Structures...
                //string xmlStr = qb.MetadataContainer.XML;
                string filename = TS_STR + "." + ds.AqbQbFilename;
                qb.MetadataContainer.ExportToXML(filename);
                // qb.MetadataContainer.ImportFromXML( filename );
            }
            {
                // Export MetadataItem FQN Collection...
                MetadataItemFQNCollection o = new MetadataItemFQNCollection( );
                o.List = ExtractMetadataValues.BuildBindingList(qb);
                string filename = TS_STR + "." + ds.MiFqnFilename;
                o.Save(filename);
            }
            tnm.ShowNotification(tnm.Notifications[0]);
        }
        public MetadataItemFQNForm(string connectionString, string aqbQbXmlFilename, bool loadDefaultDatabaseOnly = true, bool loadSystemObjects = false, bool withFields = true)
        {
            bool isToPullRemotelly = false;
            bool isMSSQL           = false;

            InitializeComponent( );
            {
                if (!isMSSQL)
                { // IT IS A SQLITE DBMS...
                    //connectionString = @"Data Source=D:\TEMP\SQLite\SQLITEDB1.db3;";
                    connectionString = @"Data Source=D:\TEMP\SQLite\chinook\chinook.db;";
                    aqbQbXmlFilename = @"D:\TEMP\SQLite\MetadataSQLiteTestWithFields.xml";
                    string miFqnXmlFilename = @"D:\TEMP\SQLite\SqliteMiFqn.xml";
                    if (isToPullRemotelly)
                    {
                        this.qb = CreateQueryBuilderSQLite(connectionString, loadDefaultDatabaseOnly, loadSystemObjects, withFields);
                        { // Export AQB's Query Builder XML Structures...
                            ExtractMetadataValues.SerializeQueryBuilder(this.qb, aqbQbXmlFilename);
                        }
                        MetadataItemFQNCollection o = new MetadataItemFQNCollection( );
                        o.List = ExtractMetadataValues.BuildBindingList(this.qb);
                        { // Export MetadataItem FQN Collection...
                            o.Save(miFqnXmlFilename);
                        }
                        this.gridControl1.DataSource = o.List;
                    }
                    else
                    {
                        MetadataItemFQNCollection p = MetadataItemFQNCollection.Load(miFqnXmlFilename);
                        this.gridControl1.DataSource = p.List;
                    }
                }
                else
                { // IS MSSQL DBMS...
                    connectionString = @"Data Source=DBSRV\QWERTY;Database=Sales;User Id=user02;Password=8a0IucJ@Nx1Qy5HfFrX0Ob3m;";
                    aqbQbXmlFilename = @"D:\TEMP\SQLite\MetadataMSSQLTestWithFields.xml";
                    string miFqnXmlFilename = @"D:\TEMP\SQLite\MssqlMiFqn.xml";
                    if (isToPullRemotelly)
                    {
                        this.qb = CreateQueryBuilderMSSQL(connectionString, loadDefaultDatabaseOnly, loadSystemObjects, withFields);
                        { // Export AQB's Query Builder XML Structures...
                            ExtractMetadataValues.SerializeQueryBuilder(this.qb, aqbQbXmlFilename);
                        }
                        MetadataItemFQNCollection o = new MetadataItemFQNCollection( );
                        o.List = ExtractMetadataValues.BuildBindingList(this.qb);
                        { // Export MetadataItem FQN Collection...
                            o.Save(miFqnXmlFilename);
                        }
                        this.gridControl1.DataSource = o.List;
                    }
                    else
                    {
                        MetadataItemFQNCollection p = MetadataItemFQNCollection.Load(miFqnXmlFilename);
                        this.gridControl1.DataSource = p.List;
                    }
                }
            }
            ExtractMetadataValues.ConfigGridControl(this.gridControl1, this.gridView1);
            // QueryBuilder.ShowMetadataContainerLoadWizard( this.qb.MetadataContainer, this.qb.MetadataLoadingOptions );
            // MetadataEditorOptions o = MetadataEditorOptions.HideLoadDatabaseButton;
            // QueryBuilder.EditMetadataContainer( this.qb.MetadataContainer, this.qb.MetadataStructure, this.qb.MetadataLoadingOptions );
        }
        public MetadataItemFQNForm(DataStoreCollection dsColl)
            : this()
        {
            this.dsColl = dsColl ?? throw new System.ArgumentNullException(nameof(dsColl));
            for (int i = 0; i < this.dsColl.List.Count; i++)
            {
                DataStore ds = this.dsColl.List[i];
                if (!ds.IsActive)
                {
                    continue;
                }
                if (ds.IsToPullRemotely)
                {
                    DataStore.SyntaxProviderEnum x = (DataStore.SyntaxProviderEnum)ds.SyntaxProvider;
                    switch (x)
                    {
                    case DataStore.SyntaxProviderEnum.SQLITE:
                        this.qb = CreateQueryBuilderSQLite(ds);
                        break;

                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2014:
                        this.qb = CreateQueryBuilderMSSQL(ds);
                        break;

                    case DataStore.SyntaxProviderEnum.AUTO:
                        break;

                    case DataStore.SyntaxProviderEnum.GENERIC:
                        break;

                    case DataStore.SyntaxProviderEnum.ANSI_SQL_2003:
                    case DataStore.SyntaxProviderEnum.ANSI_SQL_89:
                    case DataStore.SyntaxProviderEnum.ANSI_SQL_92:
                    case DataStore.SyntaxProviderEnum.FIREBIRD_1_0:
                    case DataStore.SyntaxProviderEnum.FIREBIRD_1_5:
                    case DataStore.SyntaxProviderEnum.FIREBIRD_2_0:
                    case DataStore.SyntaxProviderEnum.FIREBIRD_2_5:
                    case DataStore.SyntaxProviderEnum.IBM_DB2:
                    case DataStore.SyntaxProviderEnum.IBM_INFORMIX_10:
                    case DataStore.SyntaxProviderEnum.IBM_INFORMIX_8:
                    case DataStore.SyntaxProviderEnum.IBM_INFORMIX_9:
                    case DataStore.SyntaxProviderEnum.MS_ACCESS_2000_:
                    case DataStore.SyntaxProviderEnum.MS_ACCESS_2003_:
                    case DataStore.SyntaxProviderEnum.MS_ACCESS_97_:
                    case DataStore.SyntaxProviderEnum.MS_ACCESS_XP_:
                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2000:
                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2005:
                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2008:
                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_2012:
                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_7:
                    case DataStore.SyntaxProviderEnum.MS_SQL_SERVER_COMPACT_EDITION:
                    case DataStore.SyntaxProviderEnum.MYSQL_3_XX:
                    case DataStore.SyntaxProviderEnum.MYSQL_4_0:
                    case DataStore.SyntaxProviderEnum.MYSQL_4_1:
                    case DataStore.SyntaxProviderEnum.MYSQL_5_0:
                    case DataStore.SyntaxProviderEnum.ORACLE_10:
                    case DataStore.SyntaxProviderEnum.ORACLE_11:
                    case DataStore.SyntaxProviderEnum.ORACLE_7:
                    case DataStore.SyntaxProviderEnum.ORACLE_8:
                    case DataStore.SyntaxProviderEnum.ORACLE_9:
                    case DataStore.SyntaxProviderEnum.POSTGRESQL:
                    case DataStore.SyntaxProviderEnum.SYBASE_ASE:
                    case DataStore.SyntaxProviderEnum.SYBASE_SQL_ANYWHERE:
                    case DataStore.SyntaxProviderEnum.TERADATA:
                    case DataStore.SyntaxProviderEnum.VISTADB:
                    default:
                        break;
                    }
                    { // Export AQB's Query Builder XML Structures...
                        ExtractMetadataValues.SerializeQueryBuilder(this.qb, ds.AqbQbFilename);
                    }
                    MetadataItemFQNCollection o = new MetadataItemFQNCollection( );
                    o.List = ExtractMetadataValues.BuildBindingList(this.qb);
                    { // Export MetadataItem FQN Collection...
                        o.Save(ds.MiFqnFilename);
                    }
                    this.gridControl1.DataSource = o.List;
                }
                else
                {
                    MetadataItemFQNCollection o = MetadataItemFQNCollection.Load(ds.MiFqnFilename);
                    this.gridControl1.DataSource = o.List;
                }
            }
        }