2007-06-06 Amit Biswas <amit@amitbiswas.com>
[mono.git] / mcs / class / System.Data / System.Data.Odbc / OdbcParameter.cs
index e9412347d93f33b67e78f342f6fd9b184a5c82c6..0cc330ebcd340e3a1cc77dcbcab491b41917fee6 100644 (file)
@@ -35,27 +35,21 @@ using System;
 using System.Text;
 using System.Data;
 using System.Data.Common;
-
 using System.Runtime.InteropServices;
 using System.Globalization;
-
-#if NET_2_0
-using System.Data.ProviderBase;
-#endif // NET_2_0
 using System.ComponentModel;
 
 namespace System.Data.Odbc
 {
        [TypeConverterAttribute (typeof (OdbcParameterConverter))]
 #if NET_2_0
-        public sealed class OdbcParameter : DbParameterBase, ICloneable
+        public sealed class OdbcParameter : DbParameter, ICloneable
 #else
-               public sealed class OdbcParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+       public sealed class OdbcParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
 #endif // NET_2_0
        {
                #region Fields
 
-#if ONLY_1_1
                string name;
                ParameterDirection direction;
                bool isNullable;
@@ -65,7 +59,6 @@ namespace System.Data.Odbc
                byte _precision;
                byte _scale;
                object _value;
-#endif // ONLY_1_1
 
                private OdbcTypeMap _typeMap;
                private NativeBuffer _nativeBuffer = new NativeBuffer ();
@@ -80,10 +73,10 @@ namespace System.Data.Odbc
                {
                        _cbLengthInd = new NativeBuffer ();
                        ParameterName = String.Empty;
-                       IsNullable = true;
+                       IsNullable = false;
                        SourceColumn = String.Empty;
                        Direction = ParameterDirection.Input;
-                       _typeMap = OdbcTypeConverter.GetTypeMap (OdbcType.VarChar);
+                       _typeMap = OdbcTypeConverter.GetTypeMap (OdbcType.NVarChar);
                }
 
                public OdbcParameter (string name, object value) 
@@ -91,6 +84,7 @@ namespace System.Data.Odbc
                {
                        this.ParameterName = name;
                        Value = value;
+                       //FIXME: MS.net does not infer OdbcType from value unless a type is provided
                        _typeMap = OdbcTypeConverter.InferFromValue (value);
                        if (value != null && !value.GetType ().IsValueType) {
                                Type type = value.GetType ();
@@ -152,7 +146,7 @@ namespace System.Data.Odbc
                public 
 #if NET_2_0
                 override 
-#endif // NET_2_0
+#endif
                 DbType DbType {
                        get { return _typeMap.DbType; }
                        set { 
@@ -163,11 +157,14 @@ namespace System.Data.Odbc
                        }
                }
                
-#if ONLY_1_1
                [OdbcCategory ("Data")]
                [OdbcDescriptionAttribute ("Input, output, or bidirectional parameter")]  
                [DefaultValue (ParameterDirection.Input)]
-               public ParameterDirection Direction {
+               public 
+#if NET_2_0
+                override 
+#endif
+               ParameterDirection Direction {
                        get { return direction; }
                        set { direction = value; }
                }
@@ -177,11 +174,14 @@ namespace System.Data.Odbc
                 [DesignOnlyAttribute (true)]
                 [EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
                 [DefaultValue (false)]
-               public bool IsNullable {
+               public 
+#if NET_2_0
+                override 
+#endif
+               bool IsNullable {
                        get { return isNullable; }
                        set { isNullable = value; }
                }
-#endif // ONLY_1_1
 
 
                [DefaultValue (OdbcType.NChar)]
@@ -198,10 +198,13 @@ namespace System.Data.Odbc
                        }
                }
                
-#if ONLY_1_1
                [OdbcDescription ("DataParameter_ParameterName")]
                 [DefaultValue ("")]    
-               public string ParameterName {
+               public 
+#if NET_2_0
+                override 
+#endif
+               string ParameterName {
                        get { return name; }
                        set { name = value; }
                }
@@ -225,7 +228,11 @@ namespace System.Data.Odbc
                [OdbcDescription ("DbDataParameter_Size")]
                 [OdbcCategory ("DataCategory_Data")]
                 [DefaultValue (0)]
-               public int Size {
+               public 
+#if NET_2_0
+                override 
+#endif
+               int Size {
                        get { return size; }
                        set { size = value; }
                }
@@ -233,7 +240,11 @@ namespace System.Data.Odbc
                [OdbcDescription ("DataParameter_SourceColumn")]
                 [OdbcCategory ("DataCategory_Data")]
                 [DefaultValue ("")]
-               public string SourceColumn {
+               public 
+#if NET_2_0
+                override 
+#endif
+               string SourceColumn {
                        get { return sourceColumn; }
                        set { sourceColumn = value; }
                }
@@ -241,7 +252,11 @@ namespace System.Data.Odbc
                 [OdbcDescription ("DataParameter_SourceVersion")]
                 [OdbcCategory ("DataCategory_Data")]
                 [DefaultValue ("Current")]                     
-               public DataRowVersion SourceVersion {
+               public 
+#if NET_2_0
+                override 
+#endif
+               DataRowVersion SourceVersion {
                        get { return sourceVersion; }
                        set { sourceVersion = value; }
                }
@@ -250,7 +265,11 @@ namespace System.Data.Odbc
                 [OdbcDescription ("DataParameter_Value")]
                 [OdbcCategory ("DataCategory_Data")]
                 [DefaultValue (null)]          
-               public  object Value {
+               public 
+#if NET_2_0
+                override 
+#endif
+               object Value {
                        get { 
                                return _value;
                        }
@@ -259,8 +278,6 @@ namespace System.Data.Odbc
                        }
                }
 
-#endif // ONLY_1_1
-
                #endregion // Properties
 
                #region Methods
@@ -478,42 +495,17 @@ namespace System.Data.Odbc
                }
 
 #if NET_2_0
-               [MonoTODO]
                public override bool SourceColumnNullMapping {
                        get {return false;}
                        set {}
                }
 
-                [MonoTODO]
-                public override void PropertyChanging () 
-                {
-                }
-                
-                [MonoTODO]
-               protected override byte ValuePrecision (object value) 
+               public override void ResetDbType () 
                 {
                         throw new NotImplementedException ();
                 }
+#endif
 
-                [MonoTODO]
-                protected override byte ValueScale (object value)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                [MonoTODO]
-               protected override int ValueSize (object value)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                [MonoTODO]
-                public override void ResetDbType () 
-                {
-                        throw new NotImplementedException ();
-                }
-
-#endif // NET_2_0
                #endregion
        }
 }