Ejemplo n.º 1
0
        //private void ProcessProsWithTempReferences(List<StoredProcDef> storedProcs)
        //{
        //    bool added = true;

        //    while (added)
        //    {
        //        added = false;

        //        for (int i = 0; i < storedProcs.Count; i++)
        //        {
        //            string name = storedProcs[i].Name;
        //            name = name.Substring(0, name.IndexOf("|"));

        //            if (StoredProcsWithTempReferences.BinarySearch(name) >= 0)
        //            {
        //                continue;
        //            }

        //            for (int procCounter = 0; procCounter < StoredProcsWithTempReferences.Count; procCounter++)
        //            {
        //                string badProc = StoredProcsWithTempReferences[procCounter];

        //                if (storedProcs[i].Body.IndexOf(badProc) > 0)
        //                {
        //                    StoredProcsWithTempReferences.Add(name);
        //                    StoredProcsWithTempReferences.Sort();
        //                    added = true;
        //                    break;
        //                }
        //            }
        //        }
        //    }
        //}

        private Model.StoredProcedure GetNewStoredProcedure(string storedProcedureName, string schema)
        {
            if (string.IsNullOrEmpty(schema))
            {
                throw new ArgumentException("Schema must be specified to get stored proc.");
            }

            Interfaces.Events.RaiseObjectBeingProcessedEvent(storedProcedureName, "SP");
            //_columns = null;
            //_parameters = null;
            Model.StoredProcedure storedProcedure = new Model.StoredProcedure(storedProcedureName, false);
            storedProcedure.Enabled = false;


            storedProcedure.Schema = schema;

            DataRow[] parameterRows = Parameters.Select(string.Format("ProcedureName = '{0}'", storedProcedureName));
            foreach (DataRow parameterRow in parameterRows)
            {
                Model.StoredProcedure.Parameter parameter = new Model.StoredProcedure.Parameter(
                    parameterRow["PARAMETER_NAME"].ToString().Replace("@", ""),
                    parameterRow["DATA_TYPE"].ToString(),
                    parameterRow["PARAMETER_MODE"].ToString(),
                    int.Parse(parameterRow["ORDINAL_POSITION"].ToString()),
                    parameterRow.IsNull("CHARACTER_MAXIMUM_LENGTH") ? 0 : int.Parse(parameterRow["CHARACTER_MAXIMUM_LENGTH"].ToString()),
                    parameterRow.IsNull("NUMERIC_PRECISION") ? 0 : int.Parse(parameterRow["NUMERIC_PRECISION"].ToString()),
                    parameterRow.IsNull("NUMERIC_SCALE") ? 0 : int.Parse(parameterRow["NUMERIC_SCALE"].ToString()));
                storedProcedure.AddParameter(parameter);
            }
            FillStoredProcedureColumns(storedProcedure);

            return(storedProcedure);
        }
Ejemplo n.º 2
0
        private Model.StoredProcedure GetNewStoredProcedure(string storedProcedureName)
        {
            ArchAngel.Interfaces.ProjectHelper.RaiseObjectBeingProcessedEvent(storedProcedureName, "SP");
            _parameters = null;
            Model.StoredProcedure storedProcedure = new Model.StoredProcedure(storedProcedureName, false);
            storedProcedure.Enabled = false;

            DataRow[] parameterRows = Parameters.Select(string.Format("ProcedureName = '{0}'", storedProcedureName));
            foreach (DataRow parameterRow in parameterRows)
            {
                Model.StoredProcedure.Parameter parameter = new Model.StoredProcedure.Parameter(parameterRow["PARAMETER_NAME"].ToString(), parameterRow["DATA_TYPE"].ToString(),
                                                                                                parameterRow["PARAMETER_MODE"].ToString(), System.Convert.ToInt32(parameterRow["ORDINAL_POSITION"]), parameterRow.IsNull("CHARACTER_MAXIMUM_LENGTH") ? 0 : System.Convert.ToInt32(parameterRow["CHARACTER_MAXIMUM_LENGTH"]));
                storedProcedure.AddParameter(parameter);
            }

            return(storedProcedure);
        }
Ejemplo n.º 3
0
        //private void ProcessProsWithTempReferences(List<StoredProcDef> storedProcs)
        //{
        //    bool added = true;
        //    while (added)
        //    {
        //        added = false;
        //        for (int i = 0; i < storedProcs.Count; i++)
        //        {
        //            string name = storedProcs[i].Name;
        //            name = name.Substring(0, name.IndexOf("|"));
        //            if (StoredProcsWithTempReferences.BinarySearch(name) >= 0)
        //            {
        //                continue;
        //            }
        //            for (int procCounter = 0; procCounter < StoredProcsWithTempReferences.Count; procCounter++)
        //            {
        //                string badProc = StoredProcsWithTempReferences[procCounter];
        //                if (storedProcs[i].Body.IndexOf(badProc) > 0)
        //                {
        //                    StoredProcsWithTempReferences.Add(name);
        //                    StoredProcsWithTempReferences.Sort();
        //                    added = true;
        //                    break;
        //                }
        //            }
        //        }
        //    }
        //}
        private Model.StoredProcedure GetNewStoredProcedure(string storedProcedureName, string schema)
        {
            if (string.IsNullOrEmpty(schema))
                throw new ArgumentException("Schema must be specified to get stored proc.");

            Interfaces.Events.RaiseObjectBeingProcessedEvent(storedProcedureName, "SP");
            //_columns = null;
            //_parameters = null;
            Model.StoredProcedure storedProcedure = new Model.StoredProcedure(storedProcedureName, false);
            storedProcedure.Enabled = false;

            storedProcedure.Schema = schema;

            DataRow[] parameterRows = Parameters.Select(string.Format("ProcedureName = '{0}'", storedProcedureName));
            foreach (DataRow parameterRow in parameterRows)
            {
                Model.StoredProcedure.Parameter parameter = new Model.StoredProcedure.Parameter(
                    parameterRow["PARAMETER_NAME"].ToString().Replace("@", ""),
                    parameterRow["DATA_TYPE"].ToString(),
                    parameterRow["PARAMETER_MODE"].ToString(),
                    int.Parse(parameterRow["ORDINAL_POSITION"].ToString()),
                    parameterRow.IsNull("CHARACTER_MAXIMUM_LENGTH") ? 0 : int.Parse(parameterRow["CHARACTER_MAXIMUM_LENGTH"].ToString()),
                    parameterRow.IsNull("NUMERIC_PRECISION") ? 0 : int.Parse(parameterRow["NUMERIC_PRECISION"].ToString()),
                    parameterRow.IsNull("NUMERIC_SCALE") ? 0 : int.Parse(parameterRow["NUMERIC_SCALE"].ToString()));
                storedProcedure.AddParameter(parameter);
            }
            FillStoredProcedureColumns(storedProcedure);

            return storedProcedure;
        }
Ejemplo n.º 4
0
        private Model.StoredProcedure GetNewStoredProcedure(string storedProcedureName)
        {
            ArchAngel.Interfaces.ProjectHelper.RaiseObjectBeingProcessedEvent(storedProcedureName, "SP");
            _parameters = null;
            Model.StoredProcedure storedProcedure = new Model.StoredProcedure(storedProcedureName, false);
            storedProcedure.Enabled = false;

            DataRow[] parameterRows = Parameters.Select(string.Format("ProcedureName = '{0}'", storedProcedureName));
            foreach (DataRow parameterRow in parameterRows)
            {
                Model.StoredProcedure.Parameter parameter = new Model.StoredProcedure.Parameter(parameterRow["PARAMETER_NAME"].ToString(), parameterRow["DATA_TYPE"].ToString(),
                    parameterRow["PARAMETER_MODE"].ToString(), System.Convert.ToInt32(parameterRow["ORDINAL_POSITION"]), parameterRow.IsNull("CHARACTER_MAXIMUM_LENGTH") ? 0 : System.Convert.ToInt32(parameterRow["CHARACTER_MAXIMUM_LENGTH"]));
                storedProcedure.AddParameter(parameter);
            }

            return storedProcedure;
        }