+2010-07-06 Veerapuram Varadhan <vvaradhan@novell.com>
+
+ ** Fixes #609109
+ * TdsComm.cs (Append[DateTime]): Handle datetime values sanely that are less than epoch.
+ (Append[string]): Fix boundary checking for availability of enough buffer
+
2010-07-03 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #609935
{
DateTime epoch = new DateTime (1900,1,1);
- TimeSpan span = t - epoch;
- int days = span.Days ;
+ TimeSpan span = t - epoch; //new TimeSpan (t.Ticks - epoch.Ticks);
+ int days, hours, minutes, secs;
+ long msecs;
int val = 0;
+ days = span.Days;
+ hours = span.Hours;
+ minutes = span.Minutes;
+ secs = span.Seconds;
+ msecs = span.Milliseconds;
+
+ if (epoch > t) {
+ hours = t.Hour - epoch.Hour;
+ minutes = t.Minute - epoch.Minute;
+ secs = t.Second - epoch.Second;
+ msecs = t.Millisecond - epoch.Millisecond;
+ days--;
+ }
+
SendIfFull (bytes);
if (bytes == 8) {
- long ms = (span.Hours * 3600 + span.Minutes * 60 + span.Seconds)*1000L + (long)span.Milliseconds;
+ long ms = (hours * 3600 + minutes * 60 + secs)*1000L + (long)msecs;
val = (int) ((ms*300)/1000);
AppendInternal ((int) days);
AppendInternal ((int) val);
int lenToWrite = s.Length * ssize;
// if nextOutBufferLength points to the last buffer in outBuffer,
// we would get a DivisionByZero while calculating remBufLen
- if (outBufferLength - nextOutBufferIndex < 1)
+ if (outBufferLength - nextOutBufferIndex < ssize)
SendIfFull (ssize);
int remBufLen = outBufferLength - nextOutBufferIndex;
+2010-07-06 Veerapuram Varadhan <vvaradhan@novell.com>
+
+ * TdsMetaParameter.cs (Prepare): Use the count of characters in nvarchar
+ param as the size, to match .NET implementation.
+
2010-07-03 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #609935
break;
case "nvarchar":
case "xml":
- int paramSize = GetActualSize ();
- result.Append (paramSize > 0 ? (paramSize > 8000 ? "(max)" : String.Format ("({0})", paramSize)) : "(4000)");
+ int paramSize = GetActualSize () / 2;
+ result.Append (paramSize > 0 ? (paramSize > 4000 ? "(max)" : String.Format ("({0})", paramSize)) : "(4000)");
break;
case "char":
case "nchar":