2005-08-09 Sureshkumar T <tsureshkumar@novell.com>
authorSureshkumar T <suresh@mono-cvs.ximian.com>
Tue, 9 Aug 2005 06:46:05 +0000 (06:46 -0000)
committerSureshkumar T <suresh@mono-cvs.ximian.com>
Tue, 9 Aug 2005 06:46:05 +0000 (06:46 -0000)
* OdbcParameter.cs: setBuffer (): allocate a short int buffer for
OdbcType.SmallInt. fixes bug #75600.

svn path=/trunk/mcs/; revision=48149

mcs/class/System.Data/System.Data.Odbc/ChangeLog
mcs/class/System.Data/System.Data.Odbc/OdbcParameter.cs

index 46ba86e6fd815a2c7349b385567ab91b529e31c6..e5daf93b0be81c5ccc13456a8946b2d69b342bb7 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-09  Sureshkumar T  <tsureshkumar@novell.com>
+
+       * OdbcParameter.cs: setBuffer (): allocate a short int buffer for
+       OdbcType.SmallInt. fixes bug #75600.
+
 2005-08-08  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * OdbcConnection.cs: Marked Init helper method private.
index 92e08a406e39dcc5c9ad6de2306b7d5f52f001c4..5f4845e07eb549b8f296178531cff187b9a53935 100644 (file)
@@ -298,7 +298,7 @@ namespace System.Data.Odbc
                         
                        // Bind parameter based on type
                         int ind = -3;
-                       if (odbcType == OdbcType.Int)
+                       if (odbcType == OdbcType.Int || odbcType == OdbcType.SmallInt)
                                 ret = libodbc.SQLBindParameter(hstmt, (ushort)ParamNum, (short)paramdir,
                                                                ctype, sqltype, Convert.ToUInt32(Size),
                                                                0, ref intbuf, 0, ref ind);
@@ -315,6 +315,8 @@ namespace System.Data.Odbc
                        // Load buffer with new value
                        if (odbcType == OdbcType.Int)
                                 intbuf = Value == null ? new int () : (int) Value;
+                       else if (odbcType == OdbcType.SmallInt)
+                               intbuf = Value == null ? new short () : Convert.ToInt16(Value);
                        else if (odbcType == OdbcType.Numeric
                                 || odbcType == OdbcType.Decimal) {
                                // for numeric, the buffer is a packed decimal struct.