Skip to content

Commit

Permalink
Revert "Escape column names"
Browse files Browse the repository at this point in the history
  • Loading branch information
mgravell committed Sep 15, 2014
1 parent a47c131 commit 7262a51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dapper.Rainbow/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public string TableName
List<string> paramNames = GetParamNames(o);
paramNames.Remove("Id");

string cols = string.Join(",", paramNames.Select(p => "[" + p + "]"));
string cols = string.Join(",", paramNames);
string cols_params = string.Join(",", paramNames.Select(p => "@" + p));
var sql = "set nocount on insert " + TableName + " (" + cols + ") values (" + cols_params + ") select cast(scope_identity() as int)";

Expand All @@ -75,7 +75,7 @@ public int Update(TId id, dynamic data)

var builder = new StringBuilder();
builder.Append("update ").Append(TableName).Append(" set ");
builder.AppendLine(string.Join(",", paramNames.Where(n => n != "Id").Select(p => "[" + p + "] = @" + p)));
builder.AppendLine(string.Join(",", paramNames.Where(n => n != "Id").Select(p => p + "= @" + p)));
builder.Append("where Id = @Id");

DynamicParameters parameters = new DynamicParameters(data);
Expand Down
2 changes: 1 addition & 1 deletion Dapper.Rainbow/SqlCompactDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public SqlCompactTable(Database<TDatabase> database, string likelyTableName)
List<string> paramNames = GetParamNames(o);
paramNames.Remove("Id");

string cols = string.Join(",", paramNames.Select(p => "[" + p + "]"));
string cols = string.Join(",", paramNames);
string cols_params = string.Join(",", paramNames.Select(p => "@" + p));

var sql = "insert " + TableName + " (" + cols + ") values (" + cols_params + ")";
Expand Down

0 comments on commit 7262a51

Please sign in to comment.