示例#1
0
        private bool Load()
        {
            bool      retval = false;
            QDatabase dbObj  = QInstance.Environments.GetDatabase(databaseName);

            if (dbObj != null)
            {
                schema = new QDBTableSchema();
                if (schema.Load(dbObj, tableName))
                {
                    loadNeeded = false;
                    retval     = true;
                }
            }
            return(retval);
        }
示例#2
0
        private bool ColumnExists()
        {
            bool result = true;

            try
            {
                QDatabase      database = QInstance.Environments.GetDatabase(DatabaseName);
                QDBTableSchema schema   = ((QAlterViewCR)Parent).GetSchema(false);
                schema.Load(database, ViewName);
                if (schema.ContainsColumn(ColumnName))
                {
                    QCRAction check = new QCRAction()
                    {
                        State        = QCRActionState.WellImplemented,
                        ActionType   = QCRActionType.NoActionNeeded,
                        Description  = string.Format("Add field {0} in view {1}", ColumnName, ViewName),
                        DatabaseName = this.DatabaseName
                    };
                    Actions.Add(check);
                }
                else
                {
                    QCRAction check = new QCRAction()
                    {
                        State        = QCRActionState.NeedsAction,
                        ActionType   = QCRActionType.AddColumn,
                        Description  = string.Format("Add field {0} in view {1}", ColumnName, ViewName),
                        DatabaseName = this.DatabaseName
                    };
                    Actions.Add(check);
                }
            }
            catch (Exception ex)
            {
                QCRAction check = new QCRAction()
                {
                    State        = QCRActionState.NeedsAction,
                    ActionType   = QCRActionType.AddColumn,
                    Description  = string.Format(ex.Message),
                    DatabaseName = this.DatabaseName
                };
                Actions.Add(check);
                result = false;
            }
            return(result);
        }
示例#3
0
        private bool CheckFieldInTable()
        {
            bool result = true;

            try
            {
                QDatabase      database = QInstance.Environments.GetDatabase(DatabaseName);
                QDBTableSchema schema   = ((QAlterTableCR)Parent).GetSchema(false);
                schema.Load(database, TableName);
                if (schema.ContainsColumn(ColumnName))
                {
                    QCRAction check = new QCRAction()
                    {
                        State        = QCRActionState.WellImplemented,
                        ActionType   = QCRActionType.NoActionNeeded,
                        Description  = this.Description,
                        DatabaseName = this.DatabaseName
                    };
                    Actions.Add(check);
                }
                else
                {
                    QCRAction check = new QCRAction()
                    {
                        State        = QCRActionState.NeedsAction,
                        ActionType   = QCRActionType.AddColumn,
                        Description  = this.Description,
                        DatabaseName = this.DatabaseName
                    };
                    Actions.Add(check);
                }
            }
            catch (Exception ex)
            {
                QCRAction check = new QCRAction()
                {
                    State        = QCRActionState.NeedsAction,
                    ActionType   = QCRActionType.AddColumn,
                    Description  = ex.Message,
                    DatabaseName = this.DatabaseName
                };
                Actions.Add(check);
                result = false;
            }
            return(result);
        }