Exemplo n.º 1
0
        public IMPORTDataForm(Form parent, DBRegistrationClass drc)
        {
            InitializeComponent();
            this.MdiParent = parent;

            localNotify = new NotifiesClass()
            {
                ErrorGranularity = eMessageGranularity.never
            };
            localNotify.Register4Info(InfoRaised);
            localNotify.Register4Error(ErrorRaised);

            DBReg = drc;

            var tableObjects = StaticTreeClass.Instance().GetAllNonSystemTableObjectsComplete(DBReg);

            if (tableObjects.Count <= 0)
            {
                return;
            }

            foreach (var tc in tableObjects.Values)
            {
                selTables.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selTables.CheckChecks();
            SelectAllTableFields();
        }
Exemplo n.º 2
0
        private int MakeSQLAlter()
        {
            var SQLScript = new List <string>();

            SQLScript.Clear();
            SQLScript = StaticTreeClass.Instance().MakeSQLAlterProcedure(_procedureObject, _procedureObjectOld, true);
            SQLToUI(SQLScript);
            return(SQLScript.Count);
        }
Exemplo n.º 3
0
        private void GetDatabaseObjects2(DBRegistrationClass dbR)
        {
            if (dbR == null)
            {
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            var db  = dbR.Clone();
            var ddc = new DatabaseDesignClass
            {
                Tables = StaticTreeClass.Instance().GetAllNonSystemTableObjectsComplete(db),
                Views  = StaticTreeClass.Instance().GetViewObjects(db)
            };

            var generators = StaticTreeClass.Instance().GetGeneratorObjects(db);
            var procedures = StaticTreeClass.Instance().GetProcedureObjects(db);
            var functions  = StaticTreeClass.Instance().GetFunctionObjects(db);

            slbDbObjects2.ClearItems();
            if (ddc.Tables != null)
            {
                foreach (var tc in ddc.Tables.Values)
                {
                    slbDbObjects2.Add($@"TABLE.{tc.Name}", CheckState.Checked, tc);
                }
            }
            if (ddc.Views != null)
            {
                foreach (var tc in ddc.Views.Values)
                {
                    slbDbObjects2.Add($@"VIEW.{tc.Name}", CheckState.Checked, tc);
                }
            }
            if (generators != null)
            {
                foreach (var tc in generators.Values)
                {
                    slbDbObjects2.Add($@"GEN.{tc.Name}", CheckState.Checked, tc);
                }
            }
            if (procedures != null)
            {
                foreach (var tc in procedures.Values)
                {
                    slbDbObjects2.Add($@"PROC.{tc.Name}", CheckState.Checked, tc);
                }
            }
            if (functions != null)
            {
                foreach (var tc in functions.Values)
                {
                    slbDbObjects2.Add($@"FUNC.{tc.Name}", CheckState.Checked, tc);
                }
            }
            this.Cursor = Cursors.Default;
        }
Exemplo n.º 4
0
        public void MakeSQL()
        {
            SQLScript = (BearbeitenMode == StateClasses.EditStateClass.eBearbeiten.eEdit)
                ? StaticTreeClass.Instance().MakeSQLAlterFunction(FunctionObject, OldFunctionObject, true)
                : StaticTreeClass.Instance().MakeSQLCreateFunction(FunctionObject, true);

            SQLToUI(SQLScript);
            ShowCaptions();
            hsCreate.Enabled = (txtFuncName.Text.Length > 0);
        }
Exemplo n.º 5
0
        public string[] DatabaseViewFields(string view)
        {
            var words         = new List <string>();
            var actViewFields = StaticTreeClass.Instance().GetViewFieldObjects(_dbReg, view);

            foreach (var tcf in actViewFields.Values)
            {
                words.Add(tcf.Name);
            }
            return(words.ToArray());
        }
Exemplo n.º 6
0
        public string[] DatabaseTableFields(string table)
        {
            var words    = new List <string>();
            var actTable = StaticTreeClass.Instance().GetTableObjectFromName(_dbReg, table);

            foreach (var tcf in actTable.Fields.Values)
            {
                words.Add(tcf.Name);
            }
            return(words.ToArray());
        }
Exemplo n.º 7
0
        public void FillCombos()
        {
            var domains = StaticTreeClass.Instance().GetDomainObjects(_dbReg);

            cbDOMAIN.Items.Clear();
            foreach (DomainClass domain in domains.Values)
            {
                cbDOMAIN.Items.Add(domain);
            }
            cbDOMAIN.Text = "";
        }
Exemplo n.º 8
0
 public void GetSourceFieldsFromTableObject(string SourceTableName)
 {
     cbSourceTableFields.Items.Clear();
     if (SourceTableName.Length > 0)
     {
         var DestFds = StaticTreeClass.Instance().GetTableObjectFromName(_dbReg, SourceTableName).Fields;
         foreach (TableFieldClass dstr in DestFds.Values)
         {
             cbSourceTableFields.Items.Add(dstr.Name);
         }
     }
     //  cbSourceTableFieldNames.Text = ForeignKeyObject.FieldName;
 }
Exemplo n.º 9
0
 private void EventsForm_Load(object sender, EventArgs e)
 {
     FormDesign.SetFormLeft(this);
     triggers = StaticTreeClass.Instance().GetAllTriggerObjects(_dbReg);
     lvEvents.Items.Clear();
     SetCombo();
     LoadUserDesign();
     DataToEdit();
     ClearDevelopDesign(FbXpertMainForm.Instance().DevelopDesign);
     SetDesign(FbXpertMainForm.Instance().AppDesign);
     RefreshLanguageText();
     Restart();
 }
Exemplo n.º 10
0
        private void RefreshStatistics()
        {
            List <string> data = StaticTreeClass.Instance().GetDatabaseStatistics(dbReg);

            rtbInfo.Clear();
            info.Clear();
            info.Append(pre);
            foreach (string str in data)
            {
                this.AddLine(str);
            }
            this.Set();
            this.SetTitle("Statistics for " + dbReg.Alias);
        }
Exemplo n.º 11
0
        public void RefreshXml()
        {
            _ddc.Tables = StaticTreeClass.Instance().GetAllNonSystemTableObjectsComplete(_dbReg);
            _ddc.Views  = StaticTreeClass.Instance().GetViewObjects(_dbReg);
            StaticTreeClass.Instance().GetAllTablePrimaryKeyObjects(_dbReg, _ddc.Tables);
            _ddc.Database = _dbReg;
            var fs         = new FileStream(ApplicationPathClass.Instance.ApplicationPath + "\\temp\\tmp.xml", FileMode.Create);
            var serializer = new ConfigurationContainer().Create();
            var xml        = serializer.Serialize(fs, _ddc);



//            var serializer = new XmlSerializer(typeof(DatabaseDesignClass));
            //  var fs = new FileStream(ApplicationPathClass.Instance.ApplicationPath + "\\temp\\tmp.xml", FileMode.Create);
            //serializer.Serialize(_ddc,ApplicationPathClass.Instance.ApplicationPath + "\\temp\\tmp.xml");
            fs.Close();
            xmlEditStruktur.LoadXmlFromFile(ApplicationPathClass.Instance.ApplicationPath + "\\temp\\tmp.xml");
        }
Exemplo n.º 12
0
        public void FillCombos()
        {
            var domains = StaticTreeClass.Instance().GetDomainObjects(_dbReg);

            cbDOMAIN.Items.Clear();
            foreach (DomainClass domain in domains.Values)
            {
                cbDOMAIN.Items.Add(domain);
            }
            cbDOMAIN.Text = "";
            cbFieldTypes.Items.Clear();

            DBTypeList dbList = new DBTypeList();

            foreach (DBDataTypes dt in dbList.Values)
            {
                cbFieldTypes.Items.Add(dt);
            }
        }
Exemplo n.º 13
0
        public void RefreshAutocompleteForDatabase()
        {
            //create autocomplete popup menu

            actTables       = StaticTreeClass.Instance().GetAllNonSystemTableObjects(_dbReg);
            actSystemTables = StaticTreeClass.Instance().GetAllSystemTableObjects(_dbReg);
            actViews        = StaticTreeClass.Instance().GetViewObjects(_dbReg);

            _popupMenu = new AutocompleteMenu(_txtBox)
            {
                MinFragmentLength = 1
            };

            words = new List <string>();
            words.AddRange(SqlCommands());
            words.AddRange(DatabaseTables(actTables));
            words.AddRange(DatabaseViews(actViews));
            words.AddRange(DatabaseSystemTables(actSystemTables));

            if (actTables != null)
            {
                words.AddRange(DatabaseTableFields(actTables));
            }
            if (actViews != null)
            {
                words.AddRange(DatabaseViewFields(actViews));
            }
            if (actSystemTables != null)
            {
                words.AddRange(DatabaseSystemTableFields(actSystemTables));
            }

            _popupMenu.SearchPattern = @"[\w\.$]";
            _popupMenu.Items.SetAutocompleteItems(words);
            _popupMenu.AllowTabKey = true;

            //size of popupmenu
            _popupMenu.Items.MaximumSize = new System.Drawing.Size(400, 500);
            _popupMenu.Items.Width       = 400;
        }
Exemplo n.º 14
0
        public IndexForm(Form parent, string indexName, DBRegistrationClass dbReg, List <TableClass> tables, eBearbeiten mode)
        {
            InitializeComponent();
            this.MdiParent = parent;
            BearbeitenMode = mode;
            _dbReg         = dbReg;
            cbFields.Items.Clear();
            lvFields.Items.Clear();

            string TableName = string.Empty;

            if (mode == eBearbeiten.eInsert)
            {
                TableName = tables[0].Name;

                _orgIndexObject          = new IndexClass();
                _orgIndexObject.Name     = "NEW_INDEX_INX1";
                _orgIndexObject.IsActive = true;
            }
            else
            {
                TableName    = RefreshIndicesAndGetTablename(indexName);
                _tableObject = tables.Find(X => X.Name == TableName);
                _tableObject.Indices.TryGetValue(indexName, out _orgIndexObject);
            }
            _indexObject        = _orgIndexObject;
            _indexActiveChanged = false;
            _localNotify.Notify.OnRaiseErrorHandler += Notify_OnRaiseErrorHandler;
            _localNotify.Notify.OnRaiseInfoHandler  += Notify_OnRaiseInfoHandler;

            _tables = tables;

            _tableObject    = StaticTreeClass.Instance().GetTableObjectForIndexForm(_dbReg, TableName);
            _orgTableObject = _tableObject;

            FillSortingToCombo();
            _dataFilled = true;
        }
Exemplo n.º 15
0
        public string[] DatabaseSystemTableFields()
        {
            var actSystemTables = StaticTreeClass.Instance().GetAllSystemTableObjects(_dbReg);

            return(DatabaseSystemTableFields(actSystemTables));
        }
Exemplo n.º 16
0
 public void MakeSQL()
 {
     SQLScript = StaticTreeClass.Instance().MakeSQLDeclareUserDefinedFunction(UserDefinedFunctionObject, OldUserDefinedFunctionObject, true);
     SQLToUI(SQLScript);
     ShowCaptions();
 }
Exemplo n.º 17
0
        public string[] DatabaseViews()
        {
            var actViews = StaticTreeClass.Instance().GetViewObjects(_dbReg);

            return(DatabaseViews(actViews));
        }
Exemplo n.º 18
0
        public EXPORTDataForm(Form parent, DBRegistrationClass drc)
        {
            InitializeComponent();
            this.MdiParent = parent;

            localNotify = new NotifiesClass()
            {
                //NotifyType = eNotifyType.ErrorWithoutMessage,
                ErrorGranularity = eMessageGranularity.never
            };
            localNotify.Register4Info(InfoRaised);
            localNotify.Register4Error(ErrorRaised);

            DBReg = drc;

            var viewobjects      = StaticTreeClass.Instance().GetViewObjects(DBReg);
            var tableObjects     = StaticTreeClass.Instance().GetAllNonSystemTableObjectsComplete(DBReg);
            var domainObjects    = StaticTreeClass.Instance().GetDomainObjects(DBReg);
            var generatorObjects = StaticTreeClass.Instance().GetGeneratorObjects(DBReg);
            var indecesObjects   = StaticTreeClass.Instance().GetIndecesObjects(DBReg);
            var triggerObjects   = StaticTreeClass.Instance().GetTriggerObjects(DBReg);
            //var procedureObjects = StaticTreeClass.Instance().GetAllProcedureObjects(DBReg);
            var procedureObjects = StaticTreeClass.Instance().GetProcedureObjects(DBReg);
            var functionObjects  = StaticTreeClass.Instance().GetInternalFunctionObjects(DBReg);

            if (tableObjects.Count <= 0)
            {
                return;
            }

            foreach (var tc in tableObjects.Values)
            {
                selTables.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selTables.CheckChecks();

            foreach (var tc in tableObjects.Values)
            {
                selStructureTables.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selStructureTables.CheckChecks();

            SelectAllTableFields();

            foreach (var tc in viewobjects.Values)
            {
                selStructureViews.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selStructureViews.CheckChecks();

            foreach (var tc in domainObjects.Values)
            {
                if ((tc.ToString().StartsWith("RDB$")) || (tc.ToString().StartsWith("SEC$")) || (tc.ToString().StartsWith("MON$")))
                {
                    continue;
                }
                selDomains.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selDomains.CheckChecks();

            foreach (var tc in generatorObjects.Values)
            {
                if ((tc.ToString().StartsWith("RDB$")) || (tc.ToString().StartsWith("SEC$")) || (tc.ToString().StartsWith("MON$")))
                {
                    continue;
                }
                selGenerators.Add(tc.ToString(), CheckState.Unchecked, tc);
            }
            selGenerators.CheckChecks();


            foreach (var tc in triggerObjects.Values)
            {
                selTriggerStructure.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selTriggerStructure.CheckChecks();


            foreach (var tc in indecesObjects.Values)
            {
                selIndeces.Add(tc.ToString(), CheckState.Unchecked, tc);
            }

            selIndeces.CheckChecks();

            foreach (var tc in procedureObjects.Values)
            {
                selProceduresStructure.Add(tc.ToString(), CheckState.Unchecked, tc);
            }
            selProceduresStructure.CheckChecks();

            foreach (var tc in functionObjects.Values)
            {
                selFunctionsStructure.Add(tc.ToString(), CheckState.Unchecked, tc);
            }
            selFunctionsStructure.CheckChecks();

            var itm = selTables.ItemDatas[0] as ItemDataClass;

            TableObject = itm.Object as TableClass;

            selExportStructureList.AllowMultipleChecks = true;

            selExportStructureList.Add("Domains", CheckState.Checked, new DomainClass());
            selExportStructureList.Add("UDFs", CheckState.Checked, new UserDefinedFunctionClass());
            selExportStructureList.Add("Generators", CheckState.Checked, new GeneratorClass());
            selExportStructureList.Add("Procedures", CheckState.Checked, new ProcedureClass());
            selExportStructureList.Add("Functions", CheckState.Checked, new FunctionClass());
            selExportStructureList.Add("Tables", CheckState.Checked, new TableClass());
            selExportStructureList.Add("Views", CheckState.Checked, new ViewClass());
            selExportStructureList.Add("Check constraints", CheckState.Checked, new ChecksClass());
            selExportStructureList.Add("Unique constraints", CheckState.Checked, new UniquesClass());
            selExportStructureList.Add("Primary keys", CheckState.Checked, new PrimaryKeyClass());
            selExportStructureList.Add("Foreign keys", CheckState.Checked, new ForeignKeyClass());
            selExportStructureList.Add("Indices", CheckState.Checked, new IndexClass());
            selExportStructureList.Add("Triggers", CheckState.Checked, new TriggerClass());

            selExportStructureList.Add("UDF descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Generator descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Procedure descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Table descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Table field descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("View descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("View field descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Index descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Trigger descriptions", CheckState.Checked, new object());
            selExportStructureList.Add("Procedure parameter descriptions", CheckState.Checked, new object());
        }
Exemplo n.º 19
0
        public void ExportAllViewsSQL()
        {
            progressBar1.Minimum = 0;
            progressBar1.Value   = 0;
            int n = 0;

            if (ckCreateFunction.Checked)
            {
                n++;
            }
            if (ckAlterFunction.Checked)
            {
                n++;
            }
            progressBar1.Maximum = Functions.Count * n;
            string path = Path.Combine(txtSQLExportPath.Text);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (!Directory.Exists(path))
            {
                return;
            }
            if (ckDeleteAllFiles.Checked)
            {
                string[] fls = Directory.GetFiles(path, "*.sql");
                foreach (string fn in fls)
                {
                    try
                    {
                        File.Delete(fn);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
            foreach (var Function in Functions.Values)
            {
                try
                {
                    if (ckAlterFunction.Checked)
                    {
                        string        fna = Path.Combine(path, $@"{Function.Name}_alter.sql");
                        List <string> txt = StaticTreeClass.Instance().MakeSQLAlterFunction(Function, Function, true);
                        File.WriteAllLines(fna, txt);
                        progressBar1.Value++;
                    }
                    if (ckCreateFunction.Checked)
                    {
                        string        fnc = Path.Combine(path, $@"{Function.Name}_create.sql");
                        List <string> txt = StaticTreeClass.Instance().MakeSQLCreateFunction(Function, true);
                        File.WriteAllLines(fnc, txt);
                        progressBar1.Value++;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    break;
                }
            }
        }