Example #1
0
 /// <summary>
 /// Does a quick name match between columns
 /// </summary>
 /// <param name="c">The column to match with</param>
 /// <returns>True if the names match</returns>
 public bool Match(DBMLColumn c)
 {
     if (_name == c._name || _name == ("[" + c._name + "]"))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 /// <summary>
 /// Compare interface for sorting
 /// </summary>
 /// <param name="obj">The obj to compare to</param>
 public int CompareTo(object obj)
 {
     if (obj is DBMLColumn)
     {
         DBMLColumn col = obj as DBMLColumn;
         return(Comparer.Default.Compare(_position, col._position));
     }
     else
     {
         throw new ArgumentException("obj must be of type DBMLColumn for comparison");
     }
 }
Example #3
0
 /// <summary>
 /// Updates the details of a column to match those in the database
 /// </summary>
 /// <param name="col"></param>
 public void Update(DBMLColumn col)
 {
     _dbType       = col._dbType;
     _maxLen       = col._maxLen;
     _precision    = col._precision;
     _scale        = col._scale;
     _isIdentity   = col._isIdentity;
     _canBeNull    = col._canBeNull;
     _isPrimaryKey = col._isPrimaryKey;
     _dbGenerated  = col._dbGenerated;
     _position     = col._position;
     _found        = true;
 }
Example #4
0
        /// <summary>
        /// Updates the table with information from the sql connection
        /// </summary>
        /// <param name="conn">The sql Connection</param>
        public void DBUpdate(SqlConnection conn)
        {
            string schemaName, tableName;

            UnqualifyName(out schemaName, out tableName);
            DataSet        ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(string.Format(SQL_COLSELECT, schemaName, tableName), conn);

            da.Fill(ds);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                DBMLColumn col   = new DBMLColumn(dr);
                DBMLColumn match = _cols.MatchCol(col);
                if (match != null)
                {
                    match.Update(col);
                }
                else
                {
                    _cols.Add(col);
                }
            }
        }