IntranetFactory / migratordotnet

Automatically exported from code.google.com/p/migratordotnet
0 stars 0 forks source link

Insert of string with Quotes #178

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write an up migration that inserts a string value containing quotes in the 
DB:

1. string nonquery = @"insert into Map(Mapping) values ('test:""MyTest""')";
 Database.ExecuteNonQuery(nonquery);
2. Try to run migration via Migrator.Console.exe 

What is the expected output? What do you see instead?
I expect that the migration will succeed -- it does succeed via the Migrate 
Build task. Instead, I get the following error:

Input string was not in a correct format.
   at System.Text.StringBuilder.FormatError()
   at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String fo
rmat, Object[] args)
   at System.String.Format(IFormatProvider provider, String format, Object[] arg
s)
   at System.IO.TextWriter.WriteLine(String format, Object[] arg)
   at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object[] arg)

   at System.Console.WriteLine(String format, Object[] arg)
   at Migrator.Framework.Loggers.ConsoleWriter.WriteLine(String message, Object[
] args) in c:\work\other_projects\migratordotnet\migratordotnet-trunk\src\Migrat
or.Framework\Loggers\ConsoleWriter.cs:line 25
   at Migrator.Framework.Loggers.Logger.WriteLine(String message, Object[] args)
 in c:\work\other_projects\migratordotnet\migratordotnet-trunk\src\Migrator.Fram
ework\Loggers\Logger.cs:line 151
   at Migrator.Framework.Loggers.Logger.Log(String format, Object[] args) in c:\
work\other_projects\migratordotnet\migratordotnet-trunk\src\Migrator.Framework\L
oggers\Logger.cs:line 122
   at Migrator.Framework.Loggers.Logger.ApplyingDBChange(String sql) in c:\work\
other_projects\migratordotnet\migratordotnet-trunk\src\Migrator.Framework\Logger
s\Logger.cs:line 78
   at Migrator.Providers.TransformationProvider.ExecuteNonQuery(String sql) in ...

What version of the product are you using? On what operating system? With what 
.NET implementation/version?
Win 7 and Win XP. .Net 3.5 Sp1
What database and version are you seeing this issue on?
SQL Server 2005 though from the stack trace it appears that the exception 
happens before the command is sent to the DB

Please provide any additional information below.

Original issue reported on code.google.com by Yana.Kad...@gmail.com on 5 Dec 2011 at 10:16