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

Commit ce5bf47

Browse files
committed
Change to isUnsafeSql
1 parent 0a7c8f0 commit ce5bf47

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/ServiceStack.OrmLite/OrmLiteUtils.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,15 @@ public static string SqlValue(this object value)
465465

466466
public static Func<string,string> SqlVerifyFragmentFn { get; set; }
467467

468-
public static bool IsSqlSafe(string sql)
468+
public static bool isUnsafeSql(string sql)
469469
{
470470
if (sql == null)
471-
return true;
471+
return false;
472472

473473
if (SqlVerifyFragmentFn != null)
474474
{
475475
SqlVerifyFragmentFn(sql);
476-
return true;
476+
return false;
477477
}
478478

479479
var fragmentToVerify = sql
@@ -483,12 +483,12 @@ public static bool IsSqlSafe(string sql)
483483
.ToLower();
484484

485485
var match = VerifyFragmentRegEx.Match(fragmentToVerify);
486-
return !match.Success;
486+
return match.Success;
487487
}
488488

489489
public static string SqlVerifyFragment(this string sqlFragment)
490490
{
491-
if (!IsSqlSafe(sqlFragment))
491+
if (isUnsafeSql(sqlFragment))
492492
throw new ArgumentException("Potential illegal fragment detected: " + sqlFragment);
493493

494494
return sqlFragment;

src/ServiceStack.OrmLite/TemplateDbFilters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public int dbExec(TemplateScopeContext scope, string sql, Dictionary<string, obj
8484
public string sqlTake(int? limit) => padCondition(OrmLiteConfig.DialectProvider.SqlLimit(null, limit));
8585
public string ormliteVar(string name) => OrmLiteConfig.DialectProvider.Variables.TryGetValue(name, out var value) ? value : null;
8686

87-
public bool isSqlSafe(string sql) => OrmLiteUtils.IsSqlSafe(sql);
87+
public bool isUnsafeSql(string sql) => OrmLiteUtils.isUnsafeSql(sql);
8888

8989
private string padCondition(string text) => string.IsNullOrEmpty(text) ? "" : " " + text;
9090
}

src/ServiceStack.OrmLite/TemplateDbFiltersAsync.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public Task<object> dbExec(TemplateScopeContext scope, string sql, Dictionary<st
8686
public string sqlTake(int? limit) => padCondition(OrmLiteConfig.DialectProvider.SqlLimit(null, limit));
8787
public string ormliteVar(string name) => OrmLiteConfig.DialectProvider.Variables.TryGetValue(name, out var value) ? value : null;
8888

89-
public bool isSqlSafe(string sql) => OrmLiteUtils.IsSqlSafe(sql);
89+
public bool isUnsafeSql(string sql) => OrmLiteUtils.isUnsafeSql(sql);
9090

9191
private string padCondition(string text) => string.IsNullOrEmpty(text) ? "" : " " + text;
9292
}

0 commit comments

Comments
 (0)