Close() public method

public Close ( ) : void
return void
コード例 #1
0
ファイル: Executor.cs プロジェクト: kriti-sc/lionfish
        public void Run(string customSqlSetName, Guid myKey, string sqlDialect, string exportFileName, bool useFs)
        {
            try
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();

                // could be useful
                Logger.Log(Environment.Is64BitOperatingSystem ? "64bit system" : "32bit system");

                DBExecutor.Connect();

                this.ProgressInfo.SetProgressPercent(10, "Collecting data from DB.");

                // this will fill some dbStructure fields, such as queries and tables...
                SQLCompleteStructure dbStructure = this.Run(sqlDialect, useFs);

                // append queries from FS
                if (useFs)
                {
                    this.ProgressInfo.SetProgressPercent(85, "Collecting data from FileSystem.");
                    this.GetQueriesFromFS(dbStructure);
                }

                int totalTablesCount = 0;
                foreach (var item in dbStructure.databaseModel.databases)
                {
                    totalTablesCount += item.tables.Count;
                }

                if (dbStructure.queries.Count == 0 && totalTablesCount == 0)
                {
                    throw new Exception("None data collected. Missing any querry or table.");
                }

                dbStructure.dialect          = sqlDialect;
                dbStructure.userAccountId    = myKey.ToString();
                dbStructure.customSqlSetName = customSqlSetName;
                sw.Stop();
                dbStructure.exportTime = sw.ElapsedMilliseconds.ToString();
                this.ProgressInfo.SetProgressPercent(95, "Saving collected data to file.");
                if (sqlDialect == "snowflake")
                {
                    makeDbModelCaseSensitive(dbStructure);
                }

                myJson = this.SaveStructureToFile(dbStructure, exportFileName);
                DBExecutor.Close();
            }
            finally
            {
                this.ProgressInfo.RemoveProgress();
            }
        }
コード例 #2
0
ファイル: Executor.cs プロジェクト: davidbudac/lionfish
        public void Run(string customSqlSetName, Guid myKey, string sqlDialect, string exportFileName)
        {
            this.ProgressInfo.CreateProgress();
            try
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();

                this.LogFileName = "SQLdepLog.txt";
                // pripoj se do databaze
                this.Log("Before database open.");
                DBExecutor.Connect();
                this.Log("Database open.");

                this.ProgressInfo.SetProgressRatio(0.95, string.Empty);
                SQLCompleteStructure dbStructure = this.Run(sqlDialect);

                this.ProgressInfo.SetProgressRatio(0.05, string.Empty);

                int totalTablesCount = 0;
                foreach (var item in dbStructure.databaseModel.databases)
                {
                    totalTablesCount += item.tables.Count;
                }

                if (dbStructure.queries.Count == 0 && totalTablesCount == 0)
                {
                    throw new Exception("None data collected. Missinq any querry or table.");
                }

                dbStructure.dialect          = sqlDialect;
                dbStructure.userAccountId    = myKey.ToString();
                dbStructure.customSqlSetName = customSqlSetName;
                sw.Stop();
                dbStructure.exportTime = sw.ElapsedMilliseconds.ToString();
                myJson = this.SaveStructureToFile(dbStructure, exportFileName);
                DBExecutor.Close();
            }
            catch (Exception ex)
            {
                this.Log("Error " + ex.Message + "\n" + ex.StackTrace);
                throw;
            }
            finally
            {
                this.ProgressInfo.RemoveProgress();
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: kuntvlad/lionfish
        private void buttonTestConnection_Click(object sender, EventArgs e)
        {
            DBExecutor dbExecutor = new DBExecutor();
            string connection = this.BuildConnectionString(dbExecutor);

            try
            {

                dbExecutor.Connect();
                dbExecutor.Close();
                this.buttonRun.Enabled = true;
                this.SaveDialogSettings();
                MessageBox.Show("Database connected!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Database not connected! \n\nConnection string:\n" + connection + "\n\nError: " + ex.ToString());
            }
        }