[Mono-bugs] [Bug 620860] New: Number Overflow inserting into sqlserver
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jul 8 08:51:18 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=620860
http://bugzilla.novell.com/show_bug.cgi?id=620860#c0
Summary: Number Overflow inserting into sqlserver
Classification: Mono
Product: Mono: Runtime
Version: SVN
Platform: 64bit
OS/Version: RHEL 5
Status: NEW
Severity: Major
Priority: P5 - None
Component: misc
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: srfcanada at hotmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; MS-RTC LM 8)
the following insert works on windows but fails on mono. the field is
numeric(20) so it should work. Its trying to insert a ulong.MaxValue into a
decimal(20) field which should work and does on windows but doesnt on mono. It
could be a rounding issue since just doing a ToString or format on a maxvalue
could cause it to round up so you might want to check that the actual value
inserted is ulong.Maxvalue which I suspect it isnt since that number should
work. you might want to also double check double.MaxValue and decimal.Maxvalue
to make sure they dont have rounding issues also. I think we reported and have
it fixed for Double.Maxvalue sometime in the past though.
1. create the following table:
CREATE TABLE [dbo].[EROOTTESTOBJECT1](
[ID] [uniqueidentifier] NOT NULL,
[TESTINT64] [numeric](20, 0) NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 50) ON [PRIMARY]
) ON [PRIMARY]
GO
2. compile the following test program:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
public class TestProject
{
static void Main(string[] args)
{
Console.WriteLine("Inserting");
IDbCommand command = new SqlCommand();
command.Connection = new SqlConnection("Data
Source=yourmachine;Database=yourdb;Integrated Security=False;Connection
timeout=200;User Id=sa;Password=yourpassword");
command.CommandType = CommandType.Text; command.CommandText =
command.CommandText = "INSERT INTO [EROOTTESTOBJECT1] ( [TESTINT64], [ID])
VALUES (@p0, @p1)";
command.Connection.Open();
IDbDataParameter dbParam = new SqlParameter();
dbParam = new SqlParameter();
dbParam.ParameterName = "@p0";
dbParam.DbType = DbType.Decimal;
dbParam.Value = ulong.MaxValue;
command.Parameters.Add(dbParam);
dbParam = new SqlParameter();
dbParam.ParameterName = "@p1";
dbParam.DbType = DbType.Guid;
dbParam.Value = Guid.NewGuid();
command.Parameters.Add(dbParam);
command.ExecuteNonQuery();
Console.WriteLine("Finished Inserting");
}
}
3. running the test on windows works but on mono it fails
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list