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

Revert "Escape column names" #171

Merged
merged 1 commit into from
Sep 15, 2014
Merged
Show file tree
Hide file tree
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
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