Beispiel #1
0
        public List <StoredProcedure> GetScalarFunctionCollection()
        {
            List <StoredProcedure> _fns = new List <StoredProcedure>();
            IDataReader            rdr  = GetScalarFunctionRdr();

            while (rdr.Read())
            {
                StoredProcedure sp = new StoredProcedure(
                    rdr[SqlSchemaVariable.SCHEMA_NAME].ToString(),
                    rdr[SqlSchemaVariable.NAME].ToString());
                sp.sqlType = rdr[SqlSchemaVariable.DATA_TYPE].ToString();
                sp.dbType  = GetDbType(sp.sqlType);
                _fns.Add(sp);
            }
            rdr.Close();

            foreach (StoredProcedure sp in _fns)
            {
                rdr = GetSPParams(sp.Name);
                while (rdr.Read())
                {
                    StoredProcedure.Parameter par = new StoredProcedure.Parameter();
                    SetParameter(rdr, par);
                    par.QueryParameter = MakeParam(par.Name);
                    par.DisplayName    = Utility.GetParameterName(par.Name);
                    sp.Parameters.Add(par);
                }
                rdr.Close();
            }
            return(_fns);
        }
Beispiel #2
0
        public List <StoredProcedure> GetTableFunctionCollection()
        {
            List <StoredProcedure> _fns = new List <StoredProcedure>();

            string[] fns = GetFunctionNameList();

            foreach (string s in fns)
            {
                string[]        a  = Regex.Split(s, @"\.");
                StoredProcedure sp = new StoredProcedure(a[0], a[1]);
                sp.ClassName = Db.Service.GetSchema(a[1], TableType.Function).ClassName;

                //get the params
                IDataReader rdr = GetSPParams(a[1]);
                while (rdr.Read())
                {
                    StoredProcedure.Parameter par = new StoredProcedure.Parameter();
                    SetParameter(rdr, par);
                    par.QueryParameter = MakeParam(par.Name);
                    par.DisplayName    = Utility.GetParameterName(par.Name);
                    sp.Parameters.Add(par);
                }
                for (int i = 0; i < sp.Parameters.Count; i++)
                {
                    rdr.Close();
                }
                _fns.Add(sp);
            }
            return(_fns);
        }
Beispiel #3
0
        public void SetParameter(IDataReader rdr, StoredProcedure.Parameter par)
        {
            par.SqlType = rdr[SqlSchemaVariable.DATA_TYPE].ToString();
            par.DBType  = GetDbType(par.SqlType);
            string sMode = rdr[SqlSchemaVariable.MODE].ToString();

            if (sMode == SqlSchemaVariable.MODE_INOUT)
            {
                par.Mode = ParameterDirection.InputOutput;
            }
            par.Name = rdr[SqlSchemaVariable.NAME].ToString();
        }
Beispiel #4
0
        public List <StoredProcedure> GetStoredProcedureCollection()
        {
            List <StoredProcedure> sps = GetSPList();

            foreach (var sp in sps)
            {
                var rdr = GetSPParams(sp.Name);
                while (rdr.Read())
                {
                    var par = new StoredProcedure.Parameter();
                    SetParameter(rdr, par);
                    par.QueryParameter = MakeParam(par.Name);
                    par.DisplayName    = Utility.GetParameterName(par.Name);
                    sp.Parameters.Add(par);
                }
                rdr.Close();
            }
            return(sps);
        }