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

The Sql Server Command Builder has apparently never been usable, but … #156

Merged
merged 1 commit into from
Dec 17, 2024
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
12 changes: 6 additions & 6 deletions src/Weasel.SqlServer.Tests/CommandBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void append_parameters_with_one_at_the_end()
builder.AppendWithParameters("foo = ?")
.Length.ShouldBe(1);

builder.ToString().ShouldBe("select data from table where foo = :p0");
builder.ToString().ShouldBe("select data from table where foo = @p0");
}

[Fact]
Expand All @@ -27,7 +27,7 @@ public void append_parameters_with_multiples_at_end()
builder.AppendWithParameters("foo = ? and bar = ?")
.Length.ShouldBe(2);

builder.ToString().ShouldBe("select data from table where foo = :p0 and bar = :p1");
builder.ToString().ShouldBe("select data from table where foo = @p0 and bar = @p1");
}


Expand All @@ -40,7 +40,7 @@ public void append_parameters_with_multiples_in_the_middle()
builder.AppendWithParameters("foo = ? and bar = ? order by baz")
.Length.ShouldBe(2);

builder.ToString().ShouldBe("select data from table where foo = :p0 and bar = :p1 order by baz");
builder.ToString().ShouldBe("select data from table where foo = @p0 and bar = @p1 order by baz");
}


Expand All @@ -55,7 +55,7 @@ public void append_parameters_with_one_at_the_end_with_caret()
builder.AppendWithParameters("foo = ^", '^')
.Length.ShouldBe(1);

builder.ToString().ShouldBe("select data from table where foo = :p0");
builder.ToString().ShouldBe("select data from table where foo = @p0");
}

[Fact]
Expand All @@ -67,7 +67,7 @@ public void append_parameters_with_multiples_at_end_with_caret()
builder.AppendWithParameters("foo = ^ and bar = ^", '^')
.Length.ShouldBe(2);

builder.ToString().ShouldBe("select data from table where foo = :p0 and bar = :p1");
builder.ToString().ShouldBe("select data from table where foo = @p0 and bar = @p1");
}


Expand All @@ -80,6 +80,6 @@ public void append_parameters_with_multiples_in_the_middle_with_caret()
builder.AppendWithParameters("foo = ^ and bar = ^ order by baz", '^')
.Length.ShouldBe(2);

builder.ToString().ShouldBe("select data from table where foo = :p0 and bar = :p1 order by baz");
builder.ToString().ShouldBe("select data from table where foo = @p0 and bar = @p1 order by baz");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public void apply()
dbParameter.Value.ShouldBe(parameter.Value);
dbParameter.SqlDbType.ShouldBe(parameter.DbType);

builder.ToString().ShouldEndWith(":" + dbParameter.ParameterName);
builder.ToString().ShouldEndWith("@" + dbParameter.ParameterName);
}
}
2 changes: 1 addition & 1 deletion src/Weasel.SqlServer/CommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public CommandBuilder(): this(new SqlCommand())
{
}

public CommandBuilder(SqlCommand command): base(SqlServerProvider.Instance, ':', command)
public CommandBuilder(SqlCommand command): base(SqlServerProvider.Instance, '@', command)
{
}
}
Expand Down
Loading