Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit e943068

Browse files
mythzilyalukyanov
authored andcommitted
Change SqlVerifyFragment to accept IEnumerable
1 parent d5ae48e commit e943068

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/ServiceStack.OrmLite/OrmLiteUtilExtensions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,17 @@ public static string SqlVerifyFragment(this string sqlFragment)
181181
return SqlVerifyFragment(sqlFragment, IllegalSqlFragmentTokens);
182182
}
183183

184-
public static string SqlVerifyFragment(this string sqlFragment, string[] illegalFragments)
184+
public static string SqlVerifyFragment(this string sqlFragment, IEnumerable<string> illegalFragments)
185185
{
186186
var fragmentToVerify = sqlFragment
187187
.StripQuotedStrings('\'')
188188
.StripQuotedStrings('"')
189189
.ToLower();
190190

191-
for (int i = 0; i <= illegalFragments.Length - 1; i++)
191+
foreach (var illegalFragment in illegalFragments)
192192
{
193-
if ((fragmentToVerify.IndexOf(illegalFragments[i], StringComparison.Ordinal) >= 0))
194-
{
193+
if ((fragmentToVerify.IndexOf(illegalFragment, StringComparison.Ordinal) >= 0))
195194
throw new ArgumentException("Potential illegal fragment detected: " + sqlFragment);
196-
}
197195
}
198196

199197
return sqlFragment;

0 commit comments

Comments
 (0)