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); }
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); }
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); }