Esempio n. 1
0
        public virtual void SetCGColumn(CGColumn column)
        {
            column.Comment = column.Row["COLUMN_COMMENT"].ToString();
            column.Name = column.Row["COLUMN_NAME"].ToString();
            column.IsNullable = column.Row["IS_NULLABLE"].ToString() == "NO" ? false : true;
            column.IsPK = column.Row["COLUMN_KEY"].ToString() == "PRI" ? true : false;
            switch (column.Row["DATA_TYPE"].ToString().ToUpper())
            {
                case "VARCHAR":
                case "CHAR":
                case "TEXT":
                case "MEDIUMTEXT":
                case "TINYBLOB":
                case "TINYTEXT":
                case "BLOB":
                case "MEDIUMBLOB":
                case "LOGNGBLOB":
                case "LONGTEXT":
                    column.Type = "string";
                    break;

                case "BIT":
                    column.Type = "bool";
                    break;

                case "DATE":
                case "TIME":
                case "YEAR":
                case "DATETIME":
                case "TIMESTAMP":
                    column.Type = "DateTime";
                    break;

                case "FLOAT":
                case "DOUBLE":
                    column.Type = "double";
                    break;

                case "DECIMAL":
                    column.Type = "decimal";
                    break;

                case "TINYINT":
                case "SMALLINT":
                case "MEDIUMINT":
                case "INT":
                case "INTEGER":
                case "BIGINT":
                case "ENUM":
                    column.Type = "int";
                    break;

                default:
                    break;
            }
        }
Esempio n. 2
0
        public override void SetCGColumn(CGColumn column)
        {
            column.Name = column.Row["COLUMN_NAME"].ToString();
            column.IsNullable = column.Row["IS_NULLABLE"].ToString() == "NO" ? false : true;
            switch (column.Row["DATA_TYPE"].ToString().ToLower())
            {
                case "char":
                case "varchar":
                case "text":
                case "nchar":
                case "nvarchar":
                case "ntext":
                    column.Type = "string";
                    break;

                case "bit":
                    column.Type = "bool";
                    break;

                case "binary":
                case "varbinary":
                case "image":
                    column.Type = "object";
                    break;

                case "uniqueidentifier":
                    column.Type = "Guid";
                    break;

                case "datetime":
                case "smalldatetime":
                case "timestamp":
                    column.Type = "DateTime";
                    break;

                case "real":
                case "float":
                case "double":
                    column.Type = "double";
                    break;

                case "numeric":
                case "decimal":
                case "money":
                case "smallmoney":
                    column.Type = "decimal";
                    break;

                case "int":
                case "smallint":
                case "tinyint":
                case "bigint":
                    column.Type = "int";
                    break;

                default:
                    break;
            }
        }