Browse Source

Update dm & oracle (exp to sql)

pull/33/head
sunkaixuan 1 year ago
parent
commit
b9c19ba4e5
  1. 5
      Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs
  2. 1
      Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmExpressionContext.cs
  3. 1
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleExpressionContext.cs

5
Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/DefaultDbMethod.cs

@ -9,6 +9,7 @@ namespace SqlSugar
{
public partial class DefaultDbMethod : IDbMethods
{
public virtual string ParameterKeyWord { get; set; }= "@";
public virtual string RowNumber(MethodCallExpressionModel model)
{
if (model.Args.Count == 1)
@ -901,7 +902,7 @@ namespace SqlSugar
}
}
//Regex regex = new Regex("\@");
if (!sql.Contains("@"))
if (!sql.Contains(ParameterKeyWord))
{
sql = sql.Replace(" =)", $" = {newValue})");
if (!sql.Contains(newValue))
@ -911,7 +912,7 @@ namespace SqlSugar
}
else
{
Regex reg = new Regex(@"@MethodConst\d+");
Regex reg = new Regex(ParameterKeyWord + @"MethodConst\d+");
sql = reg.Replace(sql, it =>
{
return " " + newValue + " ";

1
Src/Asp.Net/SqlSugar/Realization/Dm/SqlBuilder/DmExpressionContext.cs

@ -54,6 +54,7 @@ namespace SqlSugar
}
public partial class DmMethod : DefaultDbMethod, IDbMethods
{
public override string ParameterKeyWord { get; set; } = ":";
public override string GetStringJoinSelector(string result, string separator)
{
return $"listagg(to_char({result}),'{separator}') within group(order by {result}) ";

1
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleExpressionContext.cs

@ -72,6 +72,7 @@ namespace SqlSugar
}
public partial class OracleMethod : DefaultDbMethod, IDbMethods
{
public override string ParameterKeyWord { get; set; } = ":";
public override string Modulo(MethodCallExpressionModel model)
{
return " MOD(" + model.Args[0].MemberName+ " , " + model.Args[1].MemberName+")";

Loading…
Cancel
Save