예제 #1
0
        private SchemataParameter[] FindProcParameters(
            string serverName, string schemaName, string packageName, string procName)
        {
            SchemataProcedure procedure = null;

            SchemataServer server = FindServer(serverName);

            if (server != null)
            {
                SchemataSchema schema = server.FindSchema(schemaName);
                if (schema != null)
                {
                    SchemataPackage package = schema.FindPackage(packageName);
                    if (package != null)
                    {
                        procedure = package.FindProcedure(procName);
                    }
                }
            }

            return(procedure == null ? null : procedure.Parameters);
        }
예제 #2
0
        //========================================================================================
        // FindPackage()
        //========================================================================================

        public SchemataPackage FindPackage(string packageName)
        {
            if (!packages.IsDiscovered)
            {
                packages.DiscoverNow();
            }

            int             i       = 0;
            bool            found   = false;
            SchemataPackage package = null;

            packageName = packageName.ToLower();

            while ((i < packages.Nodes.Count) && !found)
            {
                package = (SchemataPackage)packages.Nodes[i];
                if (!(found = package.Text.ToLower().Equals(packageName)))
                {
                    i++;
                }
            }

            return(found ? package : null);
        }
예제 #3
0
        protected override void DoDiscoverWork(object sender, DoWorkEventArgs e)
        {
            string sql =
                "SELECT O.object_name, O.created, O.last_ddl_time, O.status, S.text,"
                + "       COALESCE(E.IsError, 0) AS IsError"
                + "  FROM dba_objects O"
                + "  JOIN dba_source S"
                + "    ON S.owner = O.owner"
                + "   AND S.name = O.object_name"
                + "   AND S.type = O.object_type"
                + "   AND S.line = 1"
                + "  LEFT OUTER JOIN"
                + "      (SELECT DISTINCT E.name, 1 AS IsError"
                + "         FROM User_Errors E"
                + "        WHERE E.type = 'PACKAGE') E"
                + "    ON E.name = O.object_name"
                + " WHERE O.owner = '" + schemaName + "'"
                + "   AND O.object_type = 'PACKAGE'"
                + " ORDER BY O.object_name";

            OracleCommand cmd = new OracleCommand(sql, dbase.OraConnection);

            try
            {
                SchemataPackage  package;
                OracleDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    if (Logger.IsEnabled)
                    {
                        Logger.WriteLine(schemaName + "." + reader.GetString(0));
                    }

                    package = new SchemataPackage(dbase, srvnode, reader.GetString(0));

                    package.AddProperty("Name", reader.GetString(0));
                    package.AddProperty("Created", reader.GetDateTime(1).ToString());
                    package.AddProperty("Last DDL Time", reader.GetDateTime(2).ToString());
                    package.AddProperty("Status", reader.GetString(3));

                    string preamble = reader.GetString(4).ToString().Trim().ToLower();
                    package.IsWrapped = preamble.Contains("wrapped");
                    package.AddProperty("Wrapped", package.IsWrapped ? "Yes" : "No");

                    if ((int)reader.GetDecimal(5) == 1)
                    {
                        package.ForeColor = System.Drawing.Color.Red;
                    }
                    else if (reader.GetString(3) == "INVALID")
                    {
                        package.ForeColor = System.Drawing.Color.Green;
                    }

                    discoveries.Add(package);
                }

                reader.Close();
                reader.Dispose();
                reader = null;
            }
            catch (Exception exc)
            {
                River.Orqa.Dialogs.ExceptionDialog.ShowException(exc);
            }

            cmd.Dispose();
            cmd = null;
        }