/// <summary> /// /// </summary> /// <param name="attribute"></param> /// <param name="valueStr"></param> /// <returns></returns> protected virtual bool setDBFieldAttribute(DBField dbField, string attribute, string valueStr) { int tmp; switch (attribute) { case ConstInterface.MG_ATTR_ISN: IntUtil.TryParse(valueStr, out tmp); dbField.Isn = tmp; break; case ConstInterface.MG_ATTR_ATTR: dbField.Attr = valueStr[0]; break; case ConstInterface.MG_ATTR_ALLOW_NULL: dbField.AllowNull = valueStr[0] == '1'; break; case ConstInterface.MG_ATTR_DEFAULT_NULL: dbField.DefaultNull = valueStr[0] == '1'; break; case ConstInterface.MG_ATTR_STORAGE: IntUtil.TryParse(valueStr, out tmp); dbField.Storage = (FldStorage)tmp; break; case ConstInterface.MG_ATTR_LENGTH: IntUtil.TryParse(valueStr, out tmp); dbField.Length = tmp; break; case ConstInterface.MG_ATTR_DATASOURCE_DEFINITION: IntUtil.TryParse(valueStr, out tmp); dbField.DataSourceDefinition = (DatabaseDefinitionType)tmp; break; case ConstInterface.MG_ATTR_DIFF_UPDATE: dbField.DiffUpdate = valueStr[0]; break; case ConstInterface.MG_ATTR_DEC: IntUtil.TryParse(valueStr, out tmp); dbField.Dec = tmp; break; case ConstInterface.MG_ATTR_WHOLE: IntUtil.TryParse(valueStr, out tmp); dbField.Whole = tmp; break; case ConstInterface.MG_ATTR_PART_OF_DATETIME: IntUtil.TryParse(valueStr, out tmp); dbField.PartOfDateTime = tmp; break; case ConstInterface.MG_ATTR_DEFAULT_STORAGE: dbField.DefaultStorage = valueStr[0] == '1'; break; case ConstInterface.MG_ATTR_CONTENT: IntUtil.TryParse(valueStr, out tmp); dbField.BlobContent = (BlobContent)BlobType.ParseContentType(tmp); break; case ConstInterface.MG_ATTR_PICTURE: dbField.Picture = XmlParser.unescape(valueStr); break; case ConstInterface.MG_ATTR_DB_DEFAULT_VALUE: dbField.DbDefaultValue = XmlParser.unescape(valueStr); break; case ConstInterface.MG_ATTR_FLD_DB_INFO: dbField.DbInfo = XmlParser.unescape(valueStr); break; case ConstInterface.MG_ATTR_DB_NAME: dbField.DbName = XmlParser.unescape(valueStr); break; case ConstInterface.MG_ATTR_DB_TYPE: dbField.DbType = XmlParser.unescape(valueStr); break; case ConstInterface.MG_ATTR_USER_TYPE: dbField.UserType = XmlParser.unescape(valueStr); break; case ConstInterface.MG_ATTR_NULL_DISPLAY: dbField.NullDisplay = XmlParser.unescape(valueStr); break; case XMLConstants.MG_ATTR_DEFAULTVALUE: dbField.DefaultValue = valueStr; if (dbField.Attr == (char)StorageAttribute.ALPHA || dbField.Attr == (char)StorageAttribute.UNICODE) { dbField.DefaultValue = XmlParser.unescape(valueStr); dbField.DefaultValue = StrUtil.padStr(dbField.DefaultValue, dbField.Length); } else if (dbField.DefaultValue.Length == 0 && dbField.Attr != (char)StorageAttribute.BLOB && dbField.Attr != (char)StorageAttribute.BLOB_VECTOR) { dbField.DefaultValue = null; } else if (dbField.Attr == (char)StorageAttribute.BLOB) { dbField.DefaultValue = BlobType.createFromString(dbField.DefaultValue, (char)dbField.BlobContent); } break; case ConstInterface.MG_ATTR_FIELD_NAME: dbField.Name = XmlParser.unescape(valueStr); break; default: return(false); } return(true); }