diff options
author | Sureshkumar T <suresh@mono-cvs.ximian.com> | 2005-10-08 13:57:37 +0400 |
---|---|---|
committer | Sureshkumar T <suresh@mono-cvs.ximian.com> | 2005-10-08 13:57:37 +0400 |
commit | 88683eb2b226c25b3c7b059eb66356cb470b798e (patch) | |
tree | b25ab4df5c0b8ebe77a7d793b305c36342ab6e9e /mcs/class | |
parent | 3f3bceed39d7b5243b2bf2e281ecd11d949134f9 (diff) |
In System.Data.Odbc:
2005-10-08 Sureshkumar T <tsureshkumar@novell.com>
* OdbcParameterTest.cs (OdbcTypeTest): Disconnected Tests for
OdbcParameter class.
In ProviderTests/sql:
2005-10-08 Sureshkumar T <tsureshkumar@novell.com>
* mysql.sql: impact from sqlserver.sql.
In ProviderTests/System.Data.Odbc:
2005-10-08 Sureshkumar T <tsureshkumar@novell.com>
* OdbcParameterTest.cs: Corrections.
svn path=/trunk/mcs/; revision=51461
Diffstat (limited to 'mcs/class')
7 files changed, 139 insertions, 6 deletions
diff --git a/mcs/class/System.Data/Test/ProviderTests/System.Data.Connected.Tests.dll.sources b/mcs/class/System.Data/Test/ProviderTests/System.Data.Connected.Tests.dll.sources index 04ea16a08cc..cd0f8caaebc 100644 --- a/mcs/class/System.Data/Test/ProviderTests/System.Data.Connected.Tests.dll.sources +++ b/mcs/class/System.Data/Test/ProviderTests/System.Data.Connected.Tests.dll.sources @@ -5,6 +5,7 @@ System.Data.Odbc/OdbcCommandBuilderTest.cs System.Data.Odbc/OdbcCommandTest.cs System.Data.Odbc/OdbcDataReaderTest.cs System.Data.Odbc/OdbcDataAdapterTest.cs +System.Data.Odbc/OdbcParameterTest.cs System.Data.Odbc/OdbcParameterCollectionTest.cs ProviderIndependant/DataReaderTest.cs ProviderIndependant/IDbCommandTest.cs diff --git a/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/ChangeLog index 9cac4aa1392..49b604e324a 100644 --- a/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/ChangeLog +++ b/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/ChangeLog @@ -1,3 +1,7 @@ +2005-10-08 Sureshkumar T <tsureshkumar@novell.com> + + * OdbcParameterTest.cs: Corrections. + 2005-09-24 Sureshkumar T <tsureshkumar@novell.com> * OdbcParameterTest.cs: Tests for OdbcCommand class. diff --git a/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcParameterTest.cs b/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcParameterTest.cs index 84e498f8898..c2401bf06e9 100644 --- a/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcParameterTest.cs +++ b/mcs/class/System.Data/Test/ProviderTests/System.Data.Odbc/OdbcParameterTest.cs @@ -93,7 +93,7 @@ namespace MonoTests.System.Data OdbcCommand cmd = (OdbcCommand) conn.CreateCommand (); cmd.CommandText = query; - OdbcParameter param = cmd.Parameters.Add ("type_smallint", OdbcType.BigInt); + OdbcParameter param = cmd.Parameters.Add ("type_smallint", OdbcType.SmallInt); param.Value = 32767; OdbcDataReader reader = cmd.ExecuteReader (); Assert.IsTrue (reader.Read (), "#1 no data to test"); @@ -113,7 +113,7 @@ namespace MonoTests.System.Data OdbcCommand cmd = (OdbcCommand) conn.CreateCommand (); cmd.CommandText = query; - OdbcParameter param = cmd.Parameters.Add ("type_tinyint", OdbcType.BigInt); + OdbcParameter param = cmd.Parameters.Add ("type_tinyint", OdbcType.TinyInt); param.Value = 255; OdbcDataReader reader = cmd.ExecuteReader (); Assert.IsTrue (reader.Read (), "#1 no data to test"); @@ -242,6 +242,8 @@ namespace MonoTests.System.Data int count = (int) cmd.ExecuteScalar (); Assert.AreEqual (1, count, "#1 value not matching"); } finally { + ConnectionManager.Singleton.CloseConnection (); + ConnectionManager.Singleton.OpenConnection (); DBHelper.ExecuteNonQuery (conn, "delete from binary_family where id = 6000"); ConnectionManager.Singleton.CloseConnection (); } @@ -283,8 +285,11 @@ namespace MonoTests.System.Data cmd.CommandText = "select count (*) from string_family where id = 6000"; Assert.AreEqual (1,(int) cmd.ExecuteScalar (), "#1 value not matching"); } finally { + ConnectionManager.Singleton.CloseConnection (); + ConnectionManager.Singleton.OpenConnection (); DBHelper.ExecuteNonQuery (conn, "delete from string_family where id = 6000"); ConnectionManager.Singleton.CloseConnection (); + } } @@ -304,6 +309,8 @@ namespace MonoTests.System.Data cmd.CommandText = "select count (*) from string_family where id = 6000"; Assert.AreEqual (1,(int) cmd.ExecuteScalar (), "#1 value not matching"); } finally { + ConnectionManager.Singleton.CloseConnection (); + ConnectionManager.Singleton.OpenConnection (); DBHelper.ExecuteNonQuery (conn, "delete from string_family where id = 6000"); ConnectionManager.Singleton.CloseConnection (); } diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog b/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog index 7d1a0926a6a..9cebc26ef0b 100644 --- a/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog +++ b/mcs/class/System.Data/Test/ProviderTests/sql/ChangeLog @@ -1,3 +1,7 @@ +2005-10-08 Sureshkumar T <tsureshkumar@novell.com> + + * mysql.sql: impact from sqlserver.sql. + 2005-09-24 Sureshkumar T <tsureshkumar@novell.com> * sybase.sql: grant permissions on objects diff --git a/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql b/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql index f31407bcfc8..a70e59bffb0 100644 --- a/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql +++ b/mcs/class/System.Data/Test/ProviderTests/sql/mysql.sql @@ -18,13 +18,16 @@ create table numeric_family ( type_decimal decimal (38, 0) NULL, type_numeric numeric (38, 0) NULL, type_money numeric (38,0) NULL, - type_smallmoney numeric (12,0) NULL); + type_smallmoney numeric (12,0) NULL, + type_float real NULL, + type_double float NULL); -- does not have money & smallmoney types // -insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647); -insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648); -insert into numeric_family values (3,0,0,0,0,0,0,0,0,0); insert into numeric_family values (4,null,null,null,null,null,null,null,null,null); // +insert into numeric_family values (1,1,255,32767,2147483647,9223372036854775807,1000,1000,922337203685477.5807,214748.3647,3.40E+38,1.79E+308); +insert into numeric_family values (2,0,0,-32768,-2147483648,-9223372036854775808,-1000,-1000,-922337203685477.5808,-214748.3648,-3.40E+38,-1.79E+308); +insert into numeric_family values (3,0,0,0,0,0,0,0,0,0,0,0); +insert into numeric_family values (4,null,null,null,null,null,null,null,null,null,null,null); -- =================================== END OBJECT NUMERIC_FAMILY ======================== @@ -52,6 +55,49 @@ insert into binary_family values (4,null,null,null,null,null,null); -- =================================== END OBJECT BINARY_FAMILY ======================== +-- =================================== OBJECT STRING_FAMILY============================ +-- TABLE : string_family +-- data with id above 6000 is not gaurenteed to be read-only. +drop table if exists string_family; +// + +create table string_family ( + id int PRIMARY KEY NOT NULL, + type_char char(10) NULL, + type_varchar varchar(10) NULL, + type_text text NULL, + type_ntext longtext NULL); +// + +grant all privileges on string_family to monotester; +// + +insert into string_family values (1,"char","varchar","text","ntext"); +insert into string_family values (4,null,null,null,null); +// +-- =================================== END OBJECT STRING_FAMILY ======================== + +-- =================================== OBJECT DATETIME_FAMILY============================ +-- TABLE : datetime_family +-- data with id above 6000 is not gaurenteed to be read-only. + +drop table if exists datetime_family; +// + +create table datetime_family ( + id int PRIMARY KEY NOT NULL, + type_smalldatetime timestamp NULL, + type_datetime datetime NULL); + +grant all privileges on datetime_family to monotester; +// + +insert into datetime_family values (1,'2079-06-06 23:59:00','9999-12-31 23:59:59.997'); +insert into datetime_family values (4,null,null); +// + +-- =================================== END OBJECT DATETIME_FAMILY======================== + -- =================================== OBJECT EMPLOYEE ============================ -- TABLE : EMPLOYEE diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog index c5c85a3c5a9..49de3a2f6a6 100644 --- a/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog +++ b/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog @@ -1,3 +1,8 @@ +2005-10-08 Sureshkumar T <tsureshkumar@novell.com> + + * OdbcParameterTest.cs (OdbcTypeTest): Disconnected Tests for + OdbcParameter class. + 2005-09-22 Sebastien Pouliot <sebastien@ximian.com> * OdbcPermissionAttributeTest.cs: Removed *Choice security actions. diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/OdbcParameterTest.cs b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcParameterTest.cs new file mode 100644 index 00000000000..9aeb58bb2d9 --- /dev/null +++ b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcParameterTest.cs @@ -0,0 +1,66 @@ +// +// OdbcParameterTest.cs - NUnit Test Cases for testing the +// OdbcParameter class +// +// Author: +// Sureshkumar T (TSureshkumar@novell.com) +// +// Copyright (c) 2004 Novell Inc., and the individuals listed +// on the ChangeLog entries. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Text; +using System.Data; +using System.Data.Odbc; + +using NUnit.Framework; + +namespace MonoTests.System.Data.Odbc +{ + + [TestFixture] + public class OdbcParameterTest + { + [Test] + public void OdbcTypeTest () + { + OdbcParameter param = new OdbcParameter (); + Assert.AreEqual (OdbcType.VarChar, param.OdbcType, "#1"); + + // change test + param.OdbcType = OdbcType.Int; + Assert.AreEqual (OdbcType.Int, param.OdbcType, "#2"); + + param = new OdbcParameter ("test", 10); + Assert.AreEqual (OdbcType.Int, param.OdbcType, "#3"); + param.OdbcType = OdbcType.Real; + Assert.AreEqual (OdbcType.Real, param.OdbcType, "#4"); + Assert.AreEqual (10, param.Value, "#5"); + + param = new OdbcParameter ("test", OdbcType.NText); + Assert.AreEqual (null, param.Value, "#6"); + Assert.AreEqual (OdbcType.NText, param.OdbcType, "#7"); + } + + } +} |