Synchronization code

This commit is contained in:
sunkaixuan
2024-03-27 15:00:41 +08:00
parent d1dda492ab
commit 428b6129bd
4 changed files with 25 additions and 3 deletions

View File

@@ -440,7 +440,10 @@ namespace SqlSugar
DependencyManagement.TryPostgreSQL();
break;
case DbType.OpenGauss:
config.DbType = DbType.PostgreSQL;
config.DbType = DbType.PostgreSQL;
if (this.CurrentConnectionConfig.MoreSettings == null)
this.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings();
this.CurrentConnectionConfig.MoreSettings.DatabaseModel = DbType.OpenGauss;
break;
case DbType.HG:
InstanceFactory.CustomDllName = SugarCompatible.IsFramework ? throw new Exception("Only.NET CORE is supported") : "SqlSugar.HGCore";
@@ -489,7 +492,10 @@ namespace SqlSugar
InstanceFactory.CustomDllName = SugarCompatible.IsFramework ? "SqlSugar.OceanBaseForOracle" : "SqlSugar.OceanBaseForOracleCore";
break;
case DbType.GaussDB:
config.DbType = DbType.PostgreSQL;
config.DbType = DbType.PostgreSQL;
if (this.CurrentConnectionConfig.MoreSettings == null)
this.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings();
this.CurrentConnectionConfig.MoreSettings.DatabaseModel = DbType.GaussDB;
break;
case DbType.Vastbase:
config.DbType = DbType.PostgreSQL;

View File

@@ -14,6 +14,7 @@ namespace SqlSugar
public Expression Expression { get; set; }
public Expression BaseExpression { get; set; }
public List<SugarParameter> Parameters { get; set; }
public ExpressionContext Conext { get; set; }
}
public class MethodCallExpressionArgs

View File

@@ -662,7 +662,8 @@ namespace SqlSugar
return this.Context.DbMehtods.HasNumber(model);
case "HasValue":
return this.Context.DbMehtods.HasValue(model);
case "IsNullOrEmpty":
case "IsNullOrEmpty":
model.Conext = this.Context;
return this.Context.DbMehtods.IsNullOrEmpty(model);
case "ToLower":
return this.Context.DbMehtods.ToLower(model);

View File

@@ -373,6 +373,20 @@ namespace SqlSugar
var parameter = model.Args[0];
return string.Format(" LENGTH({0})", parameter.MemberName);
}
public override string IsNullOrEmpty(MethodCallExpressionModel model)
{
if (model.Conext?.SugarContext?.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.OpenGauss ||
model.Conext?.SugarContext?.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.Vastbase||
model.Conext?.SugarContext?.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.GaussDB)
{
var parameter = model.Args[0];
return string.Format("( {0} IS NULL )", parameter.MemberName);
}
else
{
return base.IsNullOrEmpty(model);
}
}
public override string MergeString(params string[] strings)
{
var key = Guid.NewGuid() + "";