Permalink
Browse files

Release 0.6.3

  • Loading branch information...
markrendle committed May 16, 2011
1 parent 9a31683 commit 28804298f7aebedbc72538f511460edfdac3545a
Showing with 989 additions and 921 deletions.
  1. +37 −28 Simple.Data.Ado/CommandBuilder.cs
  2. +36 −28 Simple.Data.Ado/CommandTemplate.cs
  3. 0 Simple.Data.Ado/{DelegatingConnectionBase`1.cs → DelegatingConnectionBase1.cs}
  4. +256 −256 Simple.Data.Ado/{OptimizedDictionary`2.cs → OptimizedDictionary2.cs}
  5. +2 −2 Simple.Data.Ado/Simple.Data.Ado.csproj
  6. +2 −2 Simple.Data.Ado/Simple.Data.Ado.nuspec
  7. +2 −2 Simple.Data.Mocking/Simple.Data.Mocking.nuspec
  8. +2 −2 Simple.Data.SqlCe40/Simple.Data.SqlCe40.nuspec
  9. +2 −2 Simple.Data.SqlServer/Simple.Data.SqlServer.nuspec
  10. +6 −0 Simple.Data.SqlTest/DbImage.cs
  11. +15 −0 Simple.Data.SqlTest/InsertTests.cs
  12. +11 −1 Simple.Data.SqlTest/Resources/DatabaseReset.txt
  13. +22 −0 Simple.Data.SqlTest/UpdateTests.cs
  14. +1 −1 Simple.Data.TestHelper/DatabaseInternalsEx.cs
  15. +1 −1 Simple.Data.TestHelper/DatabaseSchemaTestsBase.cs
  16. BIN Simple.Data.sln.docstates
  17. +205 −205 Simple.Data/{BufferedEnumerable`1.cs → BufferedEnumerable1.cs}
  18. +1 −1 Simple.Data/Commands/AllCommand.cs
  19. +2 −2 Simple.Data/Commands/FindAllByCommand.cs
  20. +1 −1 Simple.Data/Commands/FindAllCommand.cs
  21. +1 −1 Simple.Data/Commands/FindByCommand.cs
  22. +1 −1 Simple.Data/Commands/QueryByCommand.cs
  23. +1 −1 Simple.Data/Commands/UpdateCommand.cs
  24. +2 −4 Simple.Data/DataStrategy.cs
  25. +1 −1 Simple.Data/Database.cs
  26. +177 −177 Simple.Data/{Maybe`1.cs → Maybe.cs}
  27. +103 −103 Simple.Data/{Range`1.cs → Range1.cs}
  28. +4 −4 Simple.Data/Simple.Data.csproj
  29. +1 −1 Simple.Data/Simple.Data.nuspec
  30. +91 −91 Simple.Data/{SimpleRecord.Dictionary`2.cs → SimpleRecord.Dictionary2.cs}
  31. +1 −1 Simple.Data/SimpleRecord.cs
  32. +2 −2 Simple.Data/SimpleTransaction.cs
@@ -109,50 +109,59 @@ private void SetParameters(IDbCommand command)
private static IEnumerable<IDbDataParameter> CreateParameterComplex(ParameterTemplate template, object value, IDbCommand command)
{
- var str = value as string;
- if (str != null)
+ if (template.DbType == DbType.Binary)
{
yield return CreateSingleParameter(value, command, template.Name, template.DbType);
}
else
{
- var range = value as IRange;
- if (range != null)
+ var str = value as string;
+ if (str != null)
{
- yield return CreateSingleParameter(range.Start, command, template.Name + "_start", template.DbType);
- yield return CreateSingleParameter(range.End, command, template.Name + "_end", template.DbType);
- SetBetweenInCommandText(command, template.Name);
+ yield return CreateSingleParameter(value, command, template.Name, template.DbType);
}
else
{
- var list = value as IEnumerable;
- if (list != null)
+ var range = value as IRange;
+ if (range != null)
{
- var builder = new StringBuilder();
- var array = list.Cast<object>().ToArray();
- for (int i = 0; i < array.Length; i++)
- {
- builder.AppendFormat(",{0}_{1}", template.Name, i);
- yield return
- CreateSingleParameter(array[i], command, template.Name + "_" + i, template.DbType);
- }
- if (command.CommandText.Contains("!= " + template.Name))
+ yield return
+ CreateSingleParameter(range.Start, command, template.Name + "_start", template.DbType);
+ yield return CreateSingleParameter(range.End, command, template.Name + "_end", template.DbType);
+ SetBetweenInCommandText(command, template.Name);
+ }
+ else
+ {
+ var list = value as IEnumerable;
+ if (list != null)
{
- command.CommandText = command.CommandText.Replace("!= " + template.Name,
- "NOT IN (" +
- builder.ToString().Substring(1) + ")");
+ var builder = new StringBuilder();
+ var array = list.Cast<object>().ToArray();
+ for (int i = 0; i < array.Length; i++)
+ {
+ builder.AppendFormat(",{0}_{1}", template.Name, i);
+ yield return
+ CreateSingleParameter(array[i], command, template.Name + "_" + i, template.DbType);
+ }
+ if (command.CommandText.Contains("!= " + template.Name))
+ {
+ command.CommandText = command.CommandText.Replace("!= " + template.Name,
+ "NOT IN (" +
+ builder.ToString().Substring(1) + ")");
+ }
+ else
+ {
+ command.CommandText = command.CommandText.Replace("= " + template.Name,
+ "IN (" +
+ builder.ToString().Substring(1) +
+ ")");
+ }
}
else
{
- command.CommandText = command.CommandText.Replace("= " + template.Name,
- "IN (" + builder.ToString().Substring(1) +
- ")");
+ yield return CreateSingleParameter(value, command, template.Name, template.DbType);
}
}
- else
- {
- yield return CreateSingleParameter(value, command, template.Name, template.DbType);
- }
}
}
}
@@ -46,50 +46,58 @@ private IEnumerable<IDbDataParameter> CreateParameters(IDbCommand command, IEnum
private static IEnumerable<IDbDataParameter> CreateParameters(IDbCommand command, ParameterTemplate parameterTemplate, object value)
{
- var str = value as string;
- if (str != null)
+ if (parameterTemplate.DbType == DbType.Binary)
{
yield return CreateParameter(command, parameterTemplate, value);
}
else
{
- var range = value as IRange;
- if (range != null)
+ var str = value as string;
+ if (str != null)
{
- yield return CreateParameter(command, parameterTemplate, range.Start, "_start");
- yield return CreateParameter(command, parameterTemplate, range.End, "_end");
- CommandBuilder.SetBetweenInCommandText(command, parameterTemplate.Name);
+ yield return CreateParameter(command, parameterTemplate, value);
}
else
{
- var list = value as IEnumerable;
- if (list != null)
+ var range = value as IRange;
+ if (range != null)
{
- var builder = new StringBuilder();
- var array = list.Cast<object>().ToArray();
- for (int i = 0; i < array.Length; i++)
- {
- builder.AppendFormat(",{0}_{1}", parameterTemplate.Name, i);
- yield return CreateParameter(command, parameterTemplate, array[i], "_" + i);
- }
- if (command.CommandText.Contains("!= " + parameterTemplate.Name))
+ yield return CreateParameter(command, parameterTemplate, range.Start, "_start");
+ yield return CreateParameter(command, parameterTemplate, range.End, "_end");
+ CommandBuilder.SetBetweenInCommandText(command, parameterTemplate.Name);
+ }
+ else
+ {
+ var list = value as IEnumerable;
+ if (list != null)
{
- command.CommandText = command.CommandText.Replace("!= " + parameterTemplate.Name,
- "NOT IN (" +
- builder.ToString().Substring(1) +
- ")");
+ var builder = new StringBuilder();
+ var array = list.Cast<object>().ToArray();
+ for (int i = 0; i < array.Length; i++)
+ {
+ builder.AppendFormat(",{0}_{1}", parameterTemplate.Name, i);
+ yield return CreateParameter(command, parameterTemplate, array[i], "_" + i);
+ }
+ if (command.CommandText.Contains("!= " + parameterTemplate.Name))
+ {
+ command.CommandText = command.CommandText.Replace("!= " + parameterTemplate.Name,
+ "NOT IN (" +
+ builder.ToString().Substring(1) +
+ ")");
+ }
+ else
+ {
+ command.CommandText = command.CommandText.Replace("= " + parameterTemplate.Name,
+ "IN (" +
+ builder.ToString().Substring(1) +
+ ")");
+ }
}
else
{
- command.CommandText = command.CommandText.Replace("= " + parameterTemplate.Name,
- "IN (" + builder.ToString().Substring(1) +
- ")");
+ yield return CreateParameter(command, parameterTemplate, value);
}
}
- else
- {
- yield return CreateParameter(command, parameterTemplate, value);
- }
}
}
}
Oops, something went wrong.

0 comments on commit 2880429

Please sign in to comment.