Esempio n. 1
0
        static ServerAccessOracle()
        {
           //if (LoggingSystem.LoggingSystem.TraceCode) LoggingSystem.LoggingSystem.LogMessage = "static ServerAccessOracle()";
            OracleConnection = getOracleConnection(null);

            List<string> databaseNames = new List<string>();
            try
            {
                try
                {
                    string commandString = "show databases ";
                    OracleCommand OracleCommand = new OracleCommand(commandString, OracleConnection);
                    /*OracleDataReader myReader = OracleCommand.ExecuteReader();
                    ////if (OracleTrace) SQLView.Log(OracleCommand.CommandText);
                    while (myReader.Read())
                    {
                        if (!string.IsNullOrEmpty(myReader.GetString(0)))
                        {
                            databaseNames.Add(myReader.GetString(0));
                        }
                    }
                    myReader.Close();
                    */
                }
                catch (InvalidOperationException ioe)
                {
                }
            }
            catch (OracleException retrieveSymbolIndexException)
            {
                Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
            }

            foreach (string database in databaseNames)
            {
                List<string> tableNames = new List<string>();
                try
                {
                    try
                    {
                        OracleConnection.ChangeDatabase(database);
                        getOracleConnection(database);
                        string commandString = "USE " + database + "; SHOW TABLES ;";
                        OracleCommand OracleCommand = new OracleCommand(commandString, OracleConnection);
                        OracleDataReader myReader = OracleCommand.ExecuteReader();
                        ////if (OracleTrace) SQLView.Log(OracleCommand.CommandText);
                        while (myReader.Read())
                        {
                            if (!string.IsNullOrEmpty(myReader.GetString(0)))
                            {
                                string tb = myReader.GetString(0);
                                string DB = myReader.GetString(0);
                                if (tb.Equals("simbs") || tb.Equals("srel"))
                                {
                                    tableNames.Add(tb);
                                }
                            }
                        }
                        myReader.Close();
                    }
                    catch (InvalidOperationException ioe)
                    {
                    }
                }
                catch (OracleException retrieveSymbolIndexException)
                {
                    Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
                }

                if (tableNames.Contains("simbs") && tableNames.Contains("srel"))
                {
                    GooDBDs.Add(database);
                }
            }

            OracleDB = "SYSTEM";
            //if (MyResultsTrace)//SQLView.LogResult(new string[] { name });
        }