private DBForeignKey(DBColumn column) { this.ColumnName = column.ColumnName; this.DbType = column.DbType; this.Length = column.Length; this.AllowNull = column.AllowNull; }
public DBPrimaryKey(DBColumn column, bool isIdentity, int seed, int currentValue, int step) : this(column) { this.IsIdentity = isIdentity; this.Seed = seed; this.CurrentValue = currentValue; this.Step = step; }
public JField(DBColumn column) { this.FieldName = column.ColumnName; this.ValueType = JField.GetJValueType(column.DbType); this.FirstOperand = new JOperateNum(this.FieldName, this.ValueType); this.AllowNull = column.AllowNull; if (column is DBPrimaryKey) { DBPrimaryKey pk = column as DBPrimaryKey; this.FirstOperand.ValueCategroy = JValueCategroy.Sequence; this.FirstOperand.MinValue = pk.CurrentValue + pk.Step; this.FirstOperand.Step = pk.Step; } if (column is DBForeignKey) { DBForeignKey fk = column as DBForeignKey; this.FirstOperand.ValueCategroy = JValueCategroy.FromTable; this.FirstOperand.ReferenceTableName = fk.ReferenceTableName; this.FirstOperand.ReferenceColumnName = fk.ReferenceColumnName; } this.Visible = false; this.Order = 0; }
private DBPrimaryKey(DBColumn column) { this.ColumnName = column.ColumnName; this.DbType = column.DbType; this.Length = column.Length; }
public DBForeignKey(DBColumn column, string reftableName, string refColumnName) : this(column) { this.ReferenceColumnName = refColumnName; this.ReferenceTableName = reftableName; }
public void SetPrimaryKey(DBColumn column, bool isIdentity, int seed, int currentValue, int step) { this.PrimaryKey = new DBPrimaryKey(column, isIdentity, seed, currentValue, step); this.Columns.Remove(column); }
public void AddForeignKey(DBColumn column, string refTableName, string refColumnName) { this.ForeignKeys.Add(new DBForeignKey(column, refTableName, refColumnName)); this.Columns.Remove(column); }
private void FillFields(DBTable table) { SqlDataReader rd = SqlHelper.ExecuteReader(new SqlConnection(this.ConnStr), CommandType.Text, string.Format(format_getAllFields, table.TableName), null); List<DBColumn> fields = new List<DBColumn>(); while (rd.Read()) { try { DBColumn column = new DBColumn(rd["fieldName"].ToString()); string sqlDBType = rd["fieldType"].ToString(); column.DbType = (SqlDbType)Enum.Parse(typeof(SqlDbType), sqlDBType, true); column.Length = int.Parse(rd["fieldLength"].ToString()); column.AllowNull = rd["allowNull"].ToString() == "1" ? true : false; fields.Add(column); } catch (Exception ex) { } } rd.Close(); rd.Dispose(); table.Columns = fields; }