-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FindInSet_Handler Only For MySQL
- Loading branch information
1 parent
e5b69b8
commit 98994f9
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#region | ||
/*---------------------------------------------------------------- | ||
Copyright (C) 2024 Sheldon | ||
文件名:ZSiteConfigModel | ||
文件功能描述: | ||
创建标识:Sheldon - 2024/04/11 11:19 | ||
修改标识:Sheldon - 2024/04/11 11:19 | ||
修改描述:[v1.0.1] 添加“xx”功能: () | ||
修改标识:LG - 2024/04/11 11:19 | ||
修改描述:处理偶然出现的 xxx 问题 | ||
----------------------------------------------------------------*/ | ||
#endregion | ||
|
||
using Chloe.DbExpressions; | ||
using Chloe.RDBMS; | ||
using Chloe.RDBMS.MethodHandlers; | ||
|
||
namespace Chloe.MySql.MethodHandlers | ||
{ | ||
class FindInSet_Handler: FindInSet_HandlerBase | ||
{ | ||
public override void Process(DbMethodCallExpression exp, SqlGeneratorBase generator) | ||
{ | ||
generator.SqlBuilder.Append(" FIND_IN_SET("); | ||
exp.Arguments[1].Accept(generator); | ||
generator.SqlBuilder.Append(","); | ||
exp.Arguments[0].Accept(generator); | ||
generator.SqlBuilder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#region | ||
/*---------------------------------------------------------------- | ||
Copyright (C) 2024 Sheldon | ||
文件名:ZSiteConfigModel | ||
文件功能描述: | ||
创建标识:Sheldon - 2024/04/11 11:19 | ||
修改标识:Sheldon - 2024/04/11 11:19 | ||
修改描述:[v1.0.1] 添加“xx”功能: () | ||
修改标识:LG - 2024/04/11 11:19 | ||
修改描述:处理偶然出现的 xxx 问题 | ||
----------------------------------------------------------------*/ | ||
#endregion | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Chloe.Extensions | ||
{ | ||
public static class StringExtension | ||
{ | ||
public static bool FindInSet(this string str, string value) | ||
{ | ||
return str.Split(',').Contains(value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Chloe.Annotations; | ||
using Chloe.DbExpressions; | ||
using System.Collections; | ||
using System.Data; | ||
using System.Reflection; | ||
|
||
namespace Chloe.RDBMS.MethodHandlers | ||
{ | ||
public class FindInSet_HandlerBase : MethodHandlerBase | ||
{ | ||
|
||
public override bool CanProcess(DbMethodCallExpression exp) => exp.Method.IsDefined(typeof(DbFunctionAttribute)); | ||
|
||
|
||
} | ||
} |