protected override Column CreateColumn(DataRow row)
 {
     Column column = new Column();
     column.Name = row["attname"].ToString();
     column.Type = row["atttype"].ToString();
     int length = Convert.ToInt32( row["attlen"] );
     column.Length = length >= 0? length : Convert.ToInt32(row["atttypmod"]) - 4;
     column.Nullable = !Convert.ToBoolean( row["attnotnull"] );
     column.Default = row["attdef"].ToString();
     return column;
 }
		private void RunExpressionsReplace(Column column, object columns, ref string columnInputText)
		{
			Context columnContext = new Context();
			columnContext.Extra = columns;
			foreach(Expression expression in _expressions)
			{																					
				columnContext.Input = columnInputText;						
				expression.Parameter = column;
				expression.Interpret(columnContext);
				columnInputText = columnContext.Output;
			}
		}
		private bool IsValidColumn(Column column, string selectionString)
		{
			if(selectionString == PRIMARY && !column.IsPrimaryKey)
			{
				return false;
			}
			else
			{
				if( selectionString == NOPRIMARY && column.IsPrimaryKey)
				{
					return false;
				}
			}
			return true;
		}
        protected override Column CreateColumn(DataRow row)
        {
            Column column = new Column();
            column.Name = row["COLUMN_NAME"].ToString();
            column.Type = row["DATA_TYPE"].ToString();
            column.Length = Convert.ToInt16(row["DATA_LENGTH"].ToString());

            if (row["NULLABLE"].ToString() == "Y")
            {
                column.Nullable = true;
            }
            else
            {
                column.Nullable = false;
            }

            column.Default = "";
            return column;
        }
        protected override Column CreateColumn(DataRow row)
        {
            Column column = new Column();
            column.Name = row["COLUMN_NAME"].ToString();

            string type = row["TYPE_NAME"].ToString();
            if(type.IndexOf("identity") != -1)
            {

                column.Type = type.Substring(0,type.IndexOf("identity")).Trim();
            }
            else
            {
                column.Type = type;
            }

            column.Length = Convert.ToInt32(row["LENGTH"]);
            column.Nullable = Convert.ToBoolean( row["Nullable"] );
            column.Default = row["COLUMN_DEF"].ToString();
            return column;
        }
        protected override Column CreateColumn(DataRow row)
        {
            Column column = new Column();
            column.Name = row["Field"].ToString();
            bool IsParenthesisFound = row["Type"].ToString().IndexOf("(") != -1;
            if(IsParenthesisFound)
            {
                column.Type = row["Type"].ToString().Substring(0,row["Type"].ToString().IndexOf("("));
            }
            else
            {
                column.Type = row["Type"].ToString().Trim();
            }
            if(IsParenthesisFound)
            {
                int start = row["Type"].ToString().IndexOf("(")+1;
                int end = row["Type"].ToString().IndexOf(")");
                string length = row["Type"].ToString().Substring(start,end-start);
                int comaPosition = length.IndexOf(',');
                if(comaPosition != -1)
                {
                    length = length.Substring(0,comaPosition);
                }
                if( !Regex.IsMatch(length,"^[0-9]+$") )
                {
                    length = "0";
                }
                column.Length = Convert.ToInt32( length );
            }
            else
            {
                column.Length = 0;
            }

            column.Nullable = (row["Null"].ToString() != null && row["Null"].ToString().Length == 0) ?  false: true;
            column.Default = row["Default"].ToString();
            return column;
        }
예제 #7
0
		public bool Contains(Column column)
		{
			return List.Contains(column);
		}
예제 #8
0
		public void Remove(Column column)
		{
			List.Remove(column);
		}
예제 #9
0
		public int IndexOf(Column column)
		{
			return List.IndexOf(column);
		}
예제 #10
0
		public void Add(Column column)
		{
			List.Add(column);
		}
예제 #11
0
 public ColumnEventArgs(Column column)
 {
     _column = column;
 }
 private static string CamelReplacement(Column column)
 {
     string replacement;
     replacement = column.Name.Replace("_",String.Empty);
     replacement = replacement.Substring(0, 1).ToLower() + replacement.Substring(1);
     return replacement;
 }
 private static string UpperReplacement(Column column)
 {
     string replacement;
     replacement = column.Name.ToUpper();
     return replacement;
 }
        private static string RemovePrefixUpperReplacement(Column column)
        {
            //MD_AC_Sometext -> SOMETEXT
            string[] split = column.Name.Split('_');
            string name = split[split.Length - 1].ToUpper();

            return name;
        }
        private static string RemovePrefixLowerFirstUpperReplacement(Column column)
        {
            //MD_AC_SOMETEXT -> Sometext
            string[] split = column.Name.Split('_');
            string name = split[split.Length - 1];
            name = name.Substring(0, 1).ToUpper() + name.Substring(1, name.Length - 1).ToLower();

            return name;
        }