You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NpgSqlCommand does not substitute parameters when there is a string with escaped apostrophe #240
When NpgSqlCommand is created with a string that contains escaped apostrophe, the parameters in the query after this string are not substitued even though the valid values are provided. Such parameters placed before the string with apostrophe are substitued correctly.
Following example creates a SQL "INSERT INTO TestTable (StringColumn, ByteaColumn) VALUES ('b''la', @someValue)" - the SomeValue is not substitued for the provided parameter value. If the @someValue would be placed before the 'b''la' string, everything would work.
using (var cmd = DbConnection.CreateCommand())
{
cmd.CommandText = "INSERT INTO TestTable (StringColumn, ByteaColumn) VALUES ('b''la', @SomeValue)";
cmd.Parameters.AddWithValue("SomeValue", new byte[] { 1, });
cmd.ExecuteNonQuery();
}
Activity
augi commentedon May 12, 2014
I think it could be problem in
NpgsqlCommand.AppendCommandReplacingParameterValuesmethod.glenebob commentedon Aug 2, 2014
Check out PR #307 ;)
Merge pull request #307 from glenebob/bug_296
glenebob commentedon Aug 4, 2014
PR #307 merged. Please have a look.
Simplfied repro unit test bugs #240 and #296
Fix for bugs #240 and #296
franciscojunior commentedon Aug 17, 2014
This is fixed in Npgsql 2.2.0-rc1. Please, give it a try and let us know if you find any other problem.