mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 调整 Firebird CodeFirst string->varchar(200)、拆开执行 DDL statements;#1346
This commit is contained in:
		@@ -33,7 +33,7 @@ namespace FreeSql.Firebird
 | 
			
		||||
                { typeof(double).FullName, CsToDb.New(FbDbType.Double, "double precision","double precision NOT NULL", false, false, 0) },{ typeof(double?).FullName, CsToDb.New(FbDbType.Double, "double precision", "double precision", false, true, null) },
 | 
			
		||||
                { typeof(decimal).FullName, CsToDb.New(FbDbType.Decimal, "decimal", "decimal(10,2) NOT NULL", false, false, 0) },{ typeof(decimal?).FullName, CsToDb.New(FbDbType.Numeric, "decimal", "decimal(10,2)", false, true, null) },
 | 
			
		||||
 | 
			
		||||
                { typeof(string).FullName, CsToDb.New(FbDbType.VarChar, "varchar", "varchar(255)", false, null, "") },
 | 
			
		||||
                { typeof(string).FullName, CsToDb.New(FbDbType.VarChar, "varchar", "varchar(200)", false, null, "") },
 | 
			
		||||
 | 
			
		||||
                { typeof(TimeSpan).FullName, CsToDb.New(FbDbType.Time, "time","time NOT NULL", false, false, 0) },{ typeof(TimeSpan?).FullName, CsToDb.New(FbDbType.Time, "time", "time",false, true, null) },
 | 
			
		||||
                { typeof(DateTime).FullName, CsToDb.New(FbDbType.TimeStamp, "timestamp", "timestamp NOT NULL", false, false, new DateTime(1970,1,1)) },{ typeof(DateTime?).FullName, CsToDb.New(FbDbType.TimeStamp, "timestamp", "timestamp", false, true, null) },
 | 
			
		||||
@@ -269,5 +269,18 @@ where d.rdb$index_type = 0 and trim(d.rdb$relation_name) = {0}", tboldname ?? tb
 | 
			
		||||
            }
 | 
			
		||||
            return sb.Length == 0 ? null : sb.ToString();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override int ExecuteDDLStatements(string ddl)
 | 
			
		||||
        {
 | 
			
		||||
            if (string.IsNullOrEmpty(ddl)) return 0;
 | 
			
		||||
            var scripts = ddl.Split(new string[] { ";\r\n" }, StringSplitOptions.None).Where(a => string.IsNullOrEmpty(a.Trim()) == false).ToArray();
 | 
			
		||||
 | 
			
		||||
            if (scripts.Any() == false) return 0;
 | 
			
		||||
 | 
			
		||||
            var affrows = 0;
 | 
			
		||||
            foreach (var script in scripts)
 | 
			
		||||
                affrows += base.ExecuteDDLStatements(script);
 | 
			
		||||
            return affrows;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user