mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	## v0.4.9
- 修复 pgsql Enum 类型 formatSql bug; - 补充 表达式解析 Equals 为 = #28 #29;
This commit is contained in:
		@@ -306,6 +306,14 @@ namespace FreeSql.Internal {
 | 
			
		||||
					return $"case when {ExpressionLambdaToSql(condExp.Test, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} then {ExpressionLambdaToSql(condExp.IfTrue, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} else {ExpressionLambdaToSql(condExp.IfFalse, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} end";
 | 
			
		||||
				case ExpressionType.Call:
 | 
			
		||||
					var exp3 = exp as MethodCallExpression;
 | 
			
		||||
					var callType = exp3.Object?.Type ?? exp3.Method.DeclaringType;
 | 
			
		||||
					switch (callType.FullName) {
 | 
			
		||||
						case "System.String": return ExpressionLambdaToSqlCallString(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.Math": return ExpressionLambdaToSqlCallMath(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.DateTime": return ExpressionLambdaToSqlCallDateTime(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.TimeSpan": return ExpressionLambdaToSqlCallTimeSpan(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.Convert": return ExpressionLambdaToSqlCallConvert(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
					}
 | 
			
		||||
					if (exp3.Method.Name == "Equals" && exp3.Object != null && exp3.Arguments.Count > 0) {
 | 
			
		||||
						var tmptryoper = "=";
 | 
			
		||||
						var tmpleft = ExpressionLambdaToSql(exp3.Object, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
@@ -318,14 +326,6 @@ namespace FreeSql.Internal {
 | 
			
		||||
						if (tmpright == "NULL") tmptryoper = " IS ";
 | 
			
		||||
						return $"{tmpleft}{tmptryoper}{tmpright}";
 | 
			
		||||
					}
 | 
			
		||||
					var callType = exp3.Object?.Type ?? exp3.Method.DeclaringType;
 | 
			
		||||
					switch (callType.FullName) {
 | 
			
		||||
						case "System.String": return ExpressionLambdaToSqlCallString(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.Math": return ExpressionLambdaToSqlCallMath(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.DateTime": return ExpressionLambdaToSqlCallDateTime(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.TimeSpan": return ExpressionLambdaToSqlCallTimeSpan(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
						case "System.Convert": return ExpressionLambdaToSqlCallConvert(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);
 | 
			
		||||
					}
 | 
			
		||||
					if (callType.FullName.StartsWith("FreeSql.ISelectGroupingAggregate`")) {
 | 
			
		||||
						switch (exp3.Method.Name) {
 | 
			
		||||
							case "Count": return "count(1)";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user