Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-greedy match for comments regex #625

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Dapper.SqlBuilder/SqlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Clauses : List<Clause>
{
private readonly string _joiner;
private readonly string _prefix;
private readonly string _postfix;
private readonly string _postfix;

public Clauses(string joiner, string prefix = "", string postfix = "")
{
Expand Down Expand Up @@ -55,16 +55,16 @@ public class Template
private readonly string _sql;
private readonly SqlBuilder _builder;
private readonly object _initParams;
private int _dataSeq = -1; // Unresolved
private int _dataSeq = -1; // Unresolved

public Template(SqlBuilder builder, string sql, dynamic parameters)
{
_initParams = parameters;
_sql = sql;
_builder = builder;
}

private static readonly Regex _regex = new Regex(@"\/\*\*.+\*\*\/", RegexOptions.Compiled | RegexOptions.Multiline);
private static readonly Regex _regex = new Regex(@"\/\*\*.+?\*\*\/", RegexOptions.Compiled | RegexOptions.Multiline);

void ResolveSql()
{
Expand Down Expand Up @@ -136,7 +136,7 @@ public SqlBuilder RightJoin(string sql, dynamic parameters = null)
}

public SqlBuilder Where(string sql, dynamic parameters = null)
{
{
AddClause("where", sql, parameters, " AND ", "WHERE ", "\n", false);
return this;
}
Expand All @@ -148,13 +148,13 @@ public SqlBuilder OrWhere(string sql, dynamic parameters = null)
}

public SqlBuilder OrderBy(string sql, dynamic parameters = null)
{
{
AddClause("orderby", sql, parameters, " , ", "ORDER BY ", "\n", false);
return this;
}

public SqlBuilder Select(string sql, dynamic parameters = null)
{
{
AddClause("select", sql, parameters, " , ", "", "\n", false);
return this;
}
Expand All @@ -178,7 +178,7 @@ public SqlBuilder GroupBy(string sql, dynamic parameters = null)
}

public SqlBuilder Having(string sql, dynamic parameters = null)
{
{
AddClause("having", sql, parameters, "\nAND ", "HAVING ", "\n", false);
return this;
}
Expand Down