Beispiel #1
0
        public CommandResult DROP_SCHEMA(IConnectToDB _Connect, string SchemaName)
        {
            CommandResult _result  = new CommandResult();
            ER_Tools      er_tools = new ER_Tools();
            ER_Query      er_query = new ER_Query();
            ER_DML        er_dml   = new ER_DML();

            StringBuilder SQLBuffer = new StringBuilder();

            string _Schema = ER_DB.GetSchema(_Connect);

            SQLBuffer.Append("DROP SCHEMA " + SchemaName);

            string SuccessMessage = "Success " + SchemaName + " has been dropped.";

            _result._Response   = er_query.RUN_NON_QUERY(_Connect, SQLBuffer.ToString(), SuccessMessage).ToString();
            _result._Successful = _result._Response.IndexOf(SuccessMessage) > -1 ? true : false;
            _result._EndTime    = DateTime.Now;

            if (_result._Successful)
            {
                er_dml.DROP_Dictionary_View(_Connect, SchemaName);
            }

            return(_result);
        }
Beispiel #2
0
        public static List <CommandResult> CREATE_OBJECT_FROM_FILE(IConnectToDB _NewConnect, sqlCreateObject thisModel, List <CommandResult> _Results)
        {
            string _objectName = thisModel.objectName;
            string _Schema     = _NewConnect.Schema;
            string SQLFilePath = thisModel.SqlFilePath;
            string ServerPath  = SQLFilePath;

            ER_DB _dbio = new ER_DB();

            StringBuilder _sqlIn  = new StringBuilder();
            CommandResult _Result = new CommandResult();

            if (!thisModel.registerObjectToDictionary || !ER_Tools.checkIfTableExist(_NewConnect, _NewConnect.Schema, _objectName))
            {
                _sqlIn = new StringBuilder();

                _Result = RUN_SQL_FILE(_NewConnect, ServerPath, "Success - " + _objectName + " SQL Ran.", _sqlIn);
                _Results.Add(_Result);

                //TODO: FIx this to make insert into DB. Might need type of object as well.
                //_CSAInputProcedures CSA_IPH = new _CSAInputProcedures();

                //if (thisModel.registerObjectToDictionary)
                //{
                //    VDbModel this_InstallModel = CSA_IPH.InitVApp(_Schema, thisModel.DBOBJTypeID, _objectName, "Y", "N", thisModel._selectedTemplateID);
                //    _Results.AddRange(CSA_IPH.InsertInstallation(_NewConnect, this_InstallModel));
                //}
            }
            else
            {
                _Result             = new CommandResult();
                _Result._StartTime  = DateTime.Now;
                _Result._Response   = "Warning - " + _objectName + " Object already exists.";
                _Result._Successful = _Result._Response.IndexOf("Warning") != -1 ? true : false;
                _Result._EndTime    = DateTime.Now;
                _Results.Add(_Result);
            }

            return(_Results);
        }