Exemplo n.º 1
0
        public Dictionary.DropView DROP_Dictionary_View(IConnectToDB _Connect, string ViewName)
        {
            List <DBParameters> EntryProcedureParameters = new List <DBParameters>();

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run
            {
                sqlIn         = "Select * from CSA.ER_VIEWS where UPPER(VIEW_NAME) = @VIEW_NAME",
                _dbParameters = new List <DBParameters> {
                    new DBParameters {
                        ParamName = "VIEW_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = ViewName.ToUpper()
                    }
                }
            };

            DataTable            _DT = ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin);
            DataColumnCollection DCC = _DT.Columns;

            Dictionary.DropView thisModel = new Dictionary.DropView();

            if (_DT.Rows.Count > 0 && DCC.Contains("ER_VIEWS_ID"))
            {
                thisModel = new Dictionary.DropView {
                    I_ER_VIEWS_ID = _DT.Rows[0].Field <long?>("ER_VIEWS_ID")
                };
                Universal_Call <Dictionary.DropView> dv = new Universal_Call <Dictionary.DropView>();
                thisModel = dv.GenericInputProcedure(_Connect, thisModel);
            }

            return(thisModel);
        }
Exemplo n.º 2
0
        public DataTable GET_COLUMNS_VIA_TABLENAME(IConnectToDB _Connect, string TableName)
        {
            StringBuilder SQLin = new StringBuilder();

            SQLin.Append("Select COLUMN_NAME, DATA_TYPE, ");

            switch (_Connect.Platform)
            {
            case "Microsoft":
            case "MICROSOFT":
                SQLin.Append("CHARACTER_OCTET_LENGTH DATA_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE ");
                SQLin.Append("from INFORMATION_SCHEMA.COLUMNS ");
                SQLin.Append("where upper(TABLE_NAME) = upper(@TABLE_NAME) ");
                SQLin.Append("order by ORDINAL_POSITION ASC ");

                ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run
                {
                    sqlIn         = SQLin.ToString(),
                    _dbParameters = new List <DBParameters> {
                        new DBParameters {
                            ParamName = "TABLE_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = TableName
                        }
                    }
                };

                return(ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin));

            default:
                return(new DataTable());
            }
        }
Exemplo n.º 3
0
        public static CommandResult RUN_SQL_FILE(IConnectToDB _NewConnect, string ServerPath, string ResultMessage, StringBuilder _sqlIn)
        {
            _sqlIn = convertStringArray(System.IO.File.ReadAllLines(ServerPath), _sqlIn);

            CommandResult _Result = new CommandResult();

            _Result._StartTime  = DateTime.Now;
            _Result._Response   = ER_Query._RUN_NON_QUERY(_NewConnect, _sqlIn.ToString(), ResultMessage);
            _Result._Successful = _Result._Response.IndexOf("Success") != -1 ? true : false;
            _Result._EndTime    = DateTime.Now;

            return(_Result);
        }
Exemplo n.º 4
0
        public static bool checkIfTableExist(IConnectToDB _Connect, string schema, string tablename)
        {
            string _sqlIn = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = @TABLE_SCHEMA AND  TABLE_NAME = @TABLE_NAME";

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run
            {
                sqlIn         = _sqlIn,
                _dbParameters = new List <DBParameters> {
                    new DBParameters {
                        ParamName = "TABLE_SCHEMA", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = schema
                    },
                    new DBParameters {
                        ParamName = "TABLE_NAME", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = tablename
                    }
                }
            };

            DataTable            _DT = ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin);
            DataColumnCollection DCC = _DT.Columns;

            return(_DT.Rows.Count > 0 && DCC.Contains("TABLE_SCHEMA") ? true : false);
        }
Exemplo n.º 5
0
        public static DataTable _RUN_PARAMETER_QUERY(IConnectToDB _Connect, Parameter_Run ParamCall)
        {
            ER_Query eq = new ER_Query();

            return(eq.RUN_PARAMETER_QUERY(_Connect, ParamCall));
        }
Exemplo n.º 6
0
        public static DataTable _RUN_QUERY(IConnectToDB _Connect, string SQLin)
        {
            ER_Query er_query = new ER_Query();

            return(er_query.RUN_QUERY(_Connect, SQLin));
        }
Exemplo n.º 7
0
        public static string _RUN_NON_QUERY(IConnectToDB _Connect, string SQLin, string SuccessMessage)
        {
            ER_Query query = new ER_Query();

            return(query.RUN_NON_QUERY(_Connect, SQLin, SuccessMessage));
        }