Author: anagappan
Date: 2007-02-09 08:49:06 -0500 (Fri, 09 Feb 2007)
New Revision: 72536

Modified:
   trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog
   trunk/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs
   trunk/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs
Log:
2007-02-09  Nagappan A  <[EMAIL PROTECTED]>

        * OdbcDataReader.cs (GetDecimal): Implemented new API.



Modified: trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog      2007-02-09 
13:48:28 UTC (rev 72535)
+++ trunk/mcs/class/System.Data/System.Data.Odbc/ChangeLog      2007-02-09 
13:49:06 UTC (rev 72536)
@@ -1,3 +1,7 @@
+2007-02-09  Nagappan A  <[EMAIL PROTECTED]>
+
+       * OdbcDataReader.cs (GetDecimal): Implemented new API.
+
 2007-01-08  Nagappan A  <[EMAIL PROTECTED]>
 
        * OdbcFactory.cs: Fixed compilation warning.

Modified: trunk/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs  2007-02-09 
13:48:28 UTC (rev 72535)
+++ trunk/mcs/class/System.Data/System.Data.Odbc/OdbcColumn.cs  2007-02-09 
13:49:06 UTC (rev 72536)
@@ -21,130 +21,130 @@
 // 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;
-
-namespace System.Data.Odbc
-{
-       /// <summary>
-       /// Summary description for OdbcColumn.
-       /// </summary>
-       internal class OdbcColumn
-       {
-               internal string ColumnName;
-               internal OdbcType OdbcType;
+using System;
+
+namespace System.Data.Odbc
+{
+       /// <summary>
+       /// Summary description for OdbcColumn.
+       /// </summary>
+       internal class OdbcColumn
+       {
+               internal string ColumnName;
+               internal OdbcType OdbcType;
                 private SQL_TYPE _sqlType = SQL_TYPE.UNASSIGNED;
                 private SQL_C_TYPE _sqlCType = SQL_C_TYPE.UNASSIGNED;
-               internal bool AllowDBNull;
-               internal int MaxLength;
-               internal int Digits;
-               internal object Value;
-
-               internal OdbcColumn(string Name, OdbcType Type)
-               {
-                       this.ColumnName=Name;
-                       this.OdbcType=Type;             
-                       AllowDBNull=false;
-                       MaxLength=0;
-                       Digits=0;
-                       Value=null;
-               }
+               internal bool AllowDBNull;
+               internal int MaxLength;
+               internal int Digits;
+               internal object Value;
 
-                internal OdbcColumn(string Name, SQL_TYPE type)
+               internal OdbcColumn (string Name, OdbcType Type)
                {
-                        this.ColumnName=Name;
-                       AllowDBNull=false;
-                       MaxLength=0;
-                       Digits=0;
-                       Value=null;
+                       this.ColumnName = Name;
+                       this.OdbcType = Type;           
+                       AllowDBNull = false;
+                       MaxLength = 0;
+                       Digits = 0;
+                       Value = null;
+               }
+
+                internal OdbcColumn (string Name, SQL_TYPE type)
+               {
+                        this.ColumnName = Name;
+                       AllowDBNull = false;
+                       MaxLength = 0;
+                       Digits = 0;
+                       Value = null;
                         UpdateTypes (type);
 
                }
 
-
-               internal Type DataType
-               {
-                       get
-                       {
-                               switch (OdbcType)
-                               {
-                                       case OdbcType.TinyInt:
-                                               return typeof(System.Byte);
-                                       case OdbcType.BigInt: 
-                                               return typeof(System.Int64);
-                                       case OdbcType.Image:
-                                       case OdbcType.VarBinary:
-                                       case OdbcType.Binary:
-                                               return typeof(byte[]);
-                                       case OdbcType.Bit:
-                                               return typeof(bool);
-                                       case OdbcType.NChar:
-                                       case OdbcType.Char:
-                                               return typeof(string);
-                                       case OdbcType.Time:
-                                       case OdbcType.Timestamp:
-                                       case OdbcType.DateTime:
-                                       case OdbcType.Date:
-                                       case OdbcType.SmallDateTime:
-                                               return typeof(DateTime);
-                                       case OdbcType.Decimal:
-                                               return typeof(Decimal);
-                                       case OdbcType.Numeric:
-                                       case OdbcType.Double:
-                                               return typeof(Double);
-                                       case OdbcType.Int:
-                                               return typeof(System.Int32);
-                                       case OdbcType.Text:
-                                       case OdbcType.NText:
-                                       case OdbcType.NVarChar:
-                                       case OdbcType.VarChar:
-                                               return typeof(string);
-                                       case OdbcType.Real:
-                                               return typeof(float);
-                                       case OdbcType.SmallInt:
-                                               return typeof(System.Int16);
-                                       case OdbcType.UniqueIdentifier:
-                                               return typeof(Guid);
-                               }
-                               throw new InvalidCastException();
-                       }
-               }
-
-               internal bool IsDateType
-               {
-                       get
-                       {
-                               switch (OdbcType)
-                               {
-                                       case OdbcType.Time:
-                                       case OdbcType.Timestamp:
-                                       case OdbcType.DateTime:
-                                       case OdbcType.Date:
-                                       case OdbcType.SmallDateTime:
-                                               return true;
-                                       default:
-                                               return false;
-                               }
-                       }
-               }
-
-               internal bool IsStringType
-               {
-                       get
-                       {
-                               switch (OdbcType)
-                               {
-                                       case OdbcType.Char:
-                                       case OdbcType.Text:
-                                       case OdbcType.NText:
-                                       case OdbcType.NVarChar:
-                                       case OdbcType.VarChar:
-                                               return true;
-                                       default:
-                                               return false;
-                               }
-                       }
-               }
 
+               internal Type DataType
+               {
+                       get
+                       {
+                               switch (OdbcType)
+                               {
+                                       case OdbcType.TinyInt:
+                                               return typeof (System.Byte);
+                                       case OdbcType.BigInt: 
+                                               return typeof (System.Int64);
+                                       case OdbcType.Image:
+                                       case OdbcType.VarBinary:
+                                       case OdbcType.Binary:
+                                               return typeof (byte[]);
+                                       case OdbcType.Bit:
+                                               return typeof (bool);
+                                       case OdbcType.NChar:
+                                       case OdbcType.Char:
+                                               return typeof (string);
+                                       case OdbcType.Time:
+                                       case OdbcType.Timestamp:
+                                       case OdbcType.DateTime:
+                                       case OdbcType.Date:
+                                       case OdbcType.SmallDateTime:
+                                               return typeof (DateTime);
+                                       case OdbcType.Decimal:
+                                               return typeof (Decimal);
+                                       case OdbcType.Numeric:
+                                       case OdbcType.Double:
+                                               return typeof (Double);
+                                       case OdbcType.Int:
+                                               return typeof (System.Int32);
+                                       case OdbcType.Text:
+                                       case OdbcType.NText:
+                                       case OdbcType.NVarChar:
+                                       case OdbcType.VarChar:
+                                               return typeof (string);
+                                       case OdbcType.Real:
+                                               return typeof (float);
+                                       case OdbcType.SmallInt:
+                                               return typeof (System.Int16);
+                                       case OdbcType.UniqueIdentifier:
+                                               return typeof (Guid);
+                               }
+                               throw new InvalidCastException();
+                       }
+               }
+
+               internal bool IsDateType
+               {
+                       get
+                       {
+                               switch (OdbcType)
+                               {
+                                       case OdbcType.Time:
+                                       case OdbcType.Timestamp:
+                                       case OdbcType.DateTime:
+                                       case OdbcType.Date:
+                                       case OdbcType.SmallDateTime:
+                                               return true;
+                                       default:
+                                               return false;
+                               }
+                       }
+               }
+
+               internal bool IsStringType
+               {
+                       get
+                       {
+                               switch (OdbcType)
+                               {
+                                       case OdbcType.Char:
+                                       case OdbcType.Text:
+                                       case OdbcType.NText:
+                                       case OdbcType.NVarChar:
+                                       case OdbcType.VarChar:
+                                               return true;
+                                       default:
+                                               return false;
+                               }
+                       }
+               }
+
                internal bool IsVariableSizeType {
                        get {
                                if (IsStringType)
@@ -189,8 +189,5 @@
                         OdbcType = map.OdbcType;
                         SqlCType = map.NativeType;
                 }
-                
-                
-
-       }
-}
+       }
+}

Modified: trunk/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs
===================================================================
--- trunk/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs      
2007-02-09 13:48:28 UTC (rev 72535)
+++ trunk/mcs/class/System.Data/System.Data.Odbc/OdbcDataReader.cs      
2007-02-09 13:49:06 UTC (rev 72536)
@@ -148,13 +148,12 @@
 #if NET_2_0
                 override
 #endif // NET_2_0
-                object this[int index] {
+                object this [int index] {
                        get {
                                return (object) GetValue (index);
                        }
                }
 
-                [MonoTODO]
                public
 #if NET_2_0
                 override
@@ -178,9 +177,9 @@
 
                #region Methods
                
-               private int ColIndex(string colname)
+               private int ColIndex (string colname)
                {
-                       int i=0;
+                       int i = 0;
                        foreach (OdbcColumn col in cols)
                        {
                                if (col != null) {
@@ -196,31 +195,30 @@
                }
 
                // Dynamically load column descriptions as needed.
-               private OdbcColumn GetColumn(int ordinal)
+               private OdbcColumn GetColumn (int ordinal)
                {
-                       if (cols[ordinal]==null)
-                       {
-                               short bufsize=255;
-                               byte[] colname_buffer=new byte[bufsize];
+                       if (cols [ordinal] == null) {
+                               short bufsize = 255;
+                               byte [] colname_buffer = new byte [bufsize];
                                string colname;
-                               short colname_size=0;
-                               uint ColSize=0;
-                               short DecDigits=0, Nullable=0, dt=0;
-                               OdbcReturn ret=libodbc.SQLDescribeCol(hstmt, 
Convert.ToUInt16(ordinal+1), 
-                                                                     
colname_buffer, bufsize, ref colname_size, ref dt, ref ColSize, 
-                                                                     ref 
DecDigits, ref Nullable);
-                               if ((ret!=OdbcReturn.Success) && 
(ret!=OdbcReturn.SuccessWithInfo)) 
-                                       throw new OdbcException(new 
OdbcError("SQLDescribeCol",OdbcHandleType.Stmt,hstmt));
-                               
colname=System.Text.Encoding.Default.GetString(colname_buffer);
-                               colname=colname.Replace((char) 0,' ').Trim();
-                               OdbcColumn c=new OdbcColumn(colname, (SQL_TYPE) 
dt);
-                               c.AllowDBNull=(Nullable!=0);
-                               c.Digits=DecDigits;
+                               short colname_size = 0;
+                               uint ColSize = 0;
+                               short DecDigits = 0, Nullable = 0, dt = 0;
+                               OdbcReturn ret = libodbc.SQLDescribeCol (hstmt, 
Convert.ToUInt16 (ordinal + 1), 
+                                                                        
colname_buffer, bufsize, ref colname_size, ref dt, ref ColSize, 
+                                                                        ref 
DecDigits, ref Nullable);
+                               if ((ret != OdbcReturn.Success) && (ret != 
OdbcReturn.SuccessWithInfo))
+                                       throw new OdbcException (new OdbcError 
("SQLDescribeCol", OdbcHandleType.Stmt, hstmt));
+                               colname = 
System.Text.Encoding.Default.GetString (colname_buffer);
+                               colname = colname.Replace ((char) 0, ' ').Trim 
();
+                               OdbcColumn c = new OdbcColumn (colname, 
(SQL_TYPE) dt);
+                               c.AllowDBNull = (Nullable != 0);
+                               c.Digits = DecDigits;
                                if (c.IsVariableSizeType)
-                                       c.MaxLength=(int)ColSize;
-                               cols[ordinal]=c;
+                                       c.MaxLength = (int) ColSize;
+                               cols [ordinal] = c;
                        }
-                       return cols[ordinal];
+                       return cols [ordinal];
                }
 
                public
@@ -357,11 +355,11 @@
 #endif // NET_2_0
                string GetDataTypeName (int index)
                {
-                       return GetColumn(index).OdbcType.ToString();
+                       return GetColumn (index).OdbcType.ToString ();
                }
 
-               public DateTime GetDate(int ordinal) {
-                       return GetDateTime(ordinal);
+               public DateTime GetDate (int ordinal) {
+                       return GetDateTime (ordinal);
                }
 
                public 
@@ -370,17 +368,16 @@
 #endif // NET_2_0
                DateTime GetDateTime (int ordinal)
                {
-                       return (DateTime) GetValue(ordinal);
+                       return (DateTime) GetValue (ordinal);
                }
 
-               [MonoTODO]
                public 
 #if NET_2_0
                override
 #endif // NET_2_0
                decimal GetDecimal (int ordinal)
                {
-                       throw new NotImplementedException ();
+                       return (decimal) GetValue (ordinal);
                }
 
                public 
@@ -389,7 +386,7 @@
 #endif // NET_2_0
                double GetDouble (int ordinal)
                {
-                       return (double) GetValue(ordinal);
+                       return (double) GetValue (ordinal);
                }
 
                public 
@@ -407,7 +404,7 @@
 #endif // NET_2_0
                float GetFloat (int ordinal)
                {
-                       return (float) GetValue(ordinal);
+                       return (float) GetValue (ordinal);
                }
 
                [MonoTODO]
@@ -426,7 +423,7 @@
 #endif // NET_2_0
                short GetInt16 (int ordinal)
                {
-                       return (short) GetValue(ordinal);
+                       return (short) GetValue (ordinal);
                }
 
                public 
@@ -435,7 +432,7 @@
 #endif // NET_2_0
                int GetInt32 (int ordinal)
                {
-                       return (int) GetValue(ordinal);
+                       return (int) GetValue (ordinal);
                }
 
                public 
@@ -444,7 +441,7 @@
 #endif // NET_2_0
                long GetInt64 (int ordinal)
                {
-                       return (long) GetValue(ordinal);
+                       return (long) GetValue (ordinal);
                }
 
                public 
@@ -603,7 +600,7 @@
 #endif // NET_2_0
                string GetString (int ordinal)
                {
-                       return (string) GetValue(ordinal);
+                       return (string) GetValue (ordinal);
                }
 
                [MonoTODO]
@@ -621,69 +618,69 @@
                        if (currentRow == -1)
                                throw new IndexOutOfRangeException ();
 
-                       if (ordinal>cols.Length-1 || ordinal<0)
+                       if (ordinal > cols.Length-1 || ordinal < 0)
                                throw new IndexOutOfRangeException ();
 
                        OdbcReturn ret;
-                       int outsize=0, bufsize;
+                       int outsize = 0, bufsize;
                        byte[] buffer;
-                       OdbcColumn col=GetColumn(ordinal);
-                       object DataValue=null;
-                       ushort ColIndex=Convert.ToUInt16(ordinal+1);
+                       OdbcColumn col = GetColumn (ordinal);
+                       object DataValue = null;
+                       ushort ColIndex = Convert.ToUInt16 (ordinal+1);
 
                        // Check cached values
-                       if (col.Value==null) {
+                       if (col.Value == null) {
                                 // odbc help file
                                // 
mk:@MSITStore:C:\program%20files\Microsoft%20Data%20Access%20SDK\Docs\odbc.chm::/htm/odbcc_data_types.htm
                                switch (col.OdbcType) {
                                case OdbcType.Bit:
                                        short bit_data = 0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref bit_data, 0, ref outsize);
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref bit_data, 0, ref outsize);
                                        if (outsize != (int) 
OdbcLengthIndicator.NullData)
                                                DataValue = bit_data == 0 ? 
"False" : "True";
                                        break;
                                case OdbcType.Numeric:
                                case OdbcType.Decimal:
-                                       bufsize=50;
-                                       buffer=new byte[bufsize];  // According 
to sqlext.h, use SQL_CHAR for decimal.
+                                       bufsize = 50;
+                                       buffer = new byte [bufsize];  // 
According to sqlext.h, use SQL_CHAR for decimal.
                                        // FIXME : use Numeric.
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
SQL_C_TYPE.CHAR, buffer, bufsize, ref outsize);
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, SQL_C_TYPE.CHAR, buffer, bufsize, ref outsize);
                                        if (outsize!=-1) {
-                                               byte[] temp = new byte[outsize];
-                                               for (int i=0;i<outsize;i++)
-                                                       temp[i]=buffer[i];
-                                               
DataValue=Decimal.Parse(System.Text.Encoding.Default.GetString(temp));
+                                               byte [] temp = new byte 
[outsize];
+                                               for (int i = 0;i<outsize;i++)
+                                                       temp[i] = buffer[i];
+                                               DataValue = 
Decimal.Parse(System.Text.Encoding.Default.GetString(temp));
                                        }
                                        break;
                                case OdbcType.TinyInt:
-                                       short short_data=0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref short_data, 0, ref outsize);
-                                       
DataValue=System.Convert.ToByte(short_data);
+                                       short short_data = 0;
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref short_data, 0, ref outsize);
+                                       DataValue = 
System.Convert.ToByte(short_data);
                                        break;
                                case OdbcType.Int:
-                                       int int_data=0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref int_data, 0, ref outsize);
-                                       DataValue=int_data;
+                                       int int_data = 0;
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref int_data, 0, ref outsize);
+                                       DataValue = int_data;
                                        break;
 
                                case OdbcType.SmallInt:
-                                       short sint_data=0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref sint_data, 0, ref outsize);
-                                       DataValue=sint_data;
+                                       short sint_data = 0;
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref sint_data, 0, ref outsize);
+                                       DataValue = sint_data;
                                        break;
 
                                case OdbcType.BigInt:
-                                       long long_data=0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref long_data, 0, ref outsize);
-                                       DataValue=long_data;
+                                       long long_data = 0;
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref long_data, 0, ref outsize);
+                                       DataValue = long_data;
                                        break;
                                case OdbcType.NText:
                                case OdbcType.NVarChar:
-                                       bufsize=(col.MaxLength < 127 ? 
(col.MaxLength*2+1) : 255);
-                                       buffer=new byte[bufsize];  // According 
to sqlext.h, use SQL_CHAR for both char and varchar
+                                       bufsize = (col.MaxLength < 127 ? 
(col.MaxLength*2+1) : 255);
+                                       buffer = new byte[bufsize];  // 
According to sqlext.h, use SQL_CHAR for both char and varchar
                                        StringBuilder sb = new StringBuilder ();
                                        do { 
-                                               ret=libodbc.SQLGetData(hstmt, 
ColIndex, col.SqlCType, buffer, bufsize, ref outsize);
+                                               ret = libodbc.SQLGetData 
(hstmt, ColIndex, col.SqlCType, buffer, bufsize, ref outsize);
                                                if (ret == OdbcReturn.Error)
                                                        break;
                                                if (ret != OdbcReturn.NoData && 
outsize!=-1) {
@@ -697,11 +694,11 @@
                                        break;
                                case OdbcType.Text:
                                case OdbcType.VarChar:
-                                       bufsize=(col.MaxLength < 255 ? 
(col.MaxLength+1) : 255);
-                                       buffer=new byte[bufsize];  // According 
to sqlext.h, use SQL_CHAR for both char and varchar
+                                       bufsize = (col.MaxLength < 255 ? 
(col.MaxLength+1) : 255);
+                                       buffer = new byte[bufsize];  // 
According to sqlext.h, use SQL_CHAR for both char and varchar
                                        StringBuilder sb1 = new StringBuilder 
();
                                        do { 
-                                               ret=libodbc.SQLGetData(hstmt, 
ColIndex, col.SqlCType, buffer, bufsize, ref outsize);
+                                               ret = libodbc.SQLGetData 
(hstmt, ColIndex, col.SqlCType, buffer, bufsize, ref outsize);
                                                if (ret == OdbcReturn.Error)
                                                        break;
                                                if (ret != OdbcReturn.NoData && 
outsize!=-1) {
@@ -714,32 +711,32 @@
                                        DataValue = sb1.ToString ();
                                        break;
                                case OdbcType.Real:
-                                       float float_data=0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref float_data, 0, ref outsize);
-                                       DataValue=float_data;
+                                       float float_data = 0;
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref float_data, 0, ref outsize);
+                                       DataValue = float_data;
                                        break;
                                case OdbcType.Double:
-                                       double double_data=0;
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref double_data, 0, ref outsize);
-                                       DataValue=double_data;
+                                       double double_data = 0;
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref double_data, 0, ref outsize);
+                                       DataValue = double_data;
                                        break;
                                case OdbcType.Timestamp:
                                case OdbcType.DateTime:
                                case OdbcType.Date:
                                case OdbcType.Time:
-                                       OdbcTimestamp ts_data=new 
OdbcTimestamp();
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
col.SqlCType, ref ts_data, 0, ref outsize);
+                                       OdbcTimestamp ts_data = new 
OdbcTimestamp();
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, col.SqlCType, ref ts_data, 0, ref outsize);
                                        if (outsize!=-1) // This means 
SQL_NULL_DATA 
-                                               DataValue=new 
DateTime(ts_data.year,ts_data.month,ts_data.day,ts_data.hour,
+                                               DataValue = new 
DateTime(ts_data.year,ts_data.month,ts_data.day,ts_data.hour,
                                                                       
ts_data.minute,ts_data.second,Convert.ToInt32(ts_data.fraction));
                                        break;
                                case OdbcType.VarBinary :
                                case OdbcType.Image :
-                                       bufsize= (col.MaxLength < 255 ? 
col.MaxLength : 255);
+                                       bufsize =  (col.MaxLength < 255 ? 
col.MaxLength : 255);
                                        buffer= new byte [bufsize];
                                        ArrayList al = new ArrayList ();
                                        do { 
-                                               ret=libodbc.SQLGetData (hstmt, 
ColIndex, SQL_C_TYPE.BINARY, buffer, bufsize, ref outsize);
+                                               ret = libodbc.SQLGetData 
(hstmt, ColIndex, SQL_C_TYPE.BINARY, buffer, bufsize, ref outsize);
                                                if (ret == OdbcReturn.Error)
                                                        break;
                                                if (ret != OdbcReturn.NoData && 
outsize!=-1) {
@@ -761,13 +758,13 @@
                                        DataValue = buffer;
                                        break;
                                default:
-                                       bufsize=255;
-                                       buffer=new byte[bufsize];
-                                       ret=libodbc.SQLGetData(hstmt, ColIndex, 
SQL_C_TYPE.CHAR, buffer, bufsize, ref outsize);
+                                       bufsize = 255;
+                                       buffer = new byte[bufsize];
+                                       ret = libodbc.SQLGetData (hstmt, 
ColIndex, SQL_C_TYPE.CHAR, buffer, bufsize, ref outsize);
                                        if (outsize != (int) 
OdbcLengthIndicator.NullData)
                                                if (! (ret == 
OdbcReturn.SuccessWithInfo
                                                       && outsize == (int) 
OdbcLengthIndicator.NoTotal))
-                                                       
DataValue=System.Text.Encoding.Default.GetString(buffer, 0, outsize);
+                                                       DataValue = 
System.Text.Encoding.Default.GetString(buffer, 0, outsize);
                                        break;
                                }
 
@@ -775,9 +772,9 @@
                                        throw new OdbcException(new 
OdbcError("SQLGetData",OdbcHandleType.Stmt,hstmt));
 
                                if (outsize==-1) // This means SQL_NULL_DATA 
-                                       col.Value=DBNull.Value;
+                                       col.Value = DBNull.Value;
                                else
-                                       col.Value=DataValue;
+                                       col.Value = DataValue;
                        }
                        return col.Value;
                }
@@ -793,7 +790,7 @@
                        // copy values
                        for (int i = 0; i < values.Length; i++) {
                                if (i < FieldCount) {
-                                       values[i] = GetValue(i);
+                                       values[i] = GetValue (i);
                                }
                                else {
                                        values[i] = null;
@@ -858,7 +855,7 @@
 #endif // NET_2_0
                 bool IsDBNull (int ordinal)
                {
-                       return (GetValue(ordinal) is DBNull);
+                       return (GetValue (ordinal) is DBNull);
                }
 
                /// <remarks>

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to