2 // System.Data.ProviderBase.DbParameterBase
5 // Sureshkumar T (tsureshkumar@novell.com)
6 // Tim Coleman (tim@timcoleman.com)
7 // Boris Kirzner <borisk@mainsoft.com>
9 // Copyright (C) Tim Coleman, 2003
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
13 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 #if NET_2_0 || TARGET_JVM
37 using System.Data.Common;
39 namespace System.Data.ProviderBase {
40 public abstract class DbParameterBase : DbParameter
43 string _parameterName;
44 ParameterDirection _direction = ParameterDirection.Input;
49 DataRowVersion _sourceVersion;
55 DbParameterCollection _parent = null;
62 protected DbParameterBase ()
66 protected DbParameterBase (DbParameterBase source)
69 throw ExceptionHelper.ArgumentNull ("source");
72 ICloneable cloneable = source._value as ICloneable;
73 if (cloneable != null)
74 _value = cloneable.Clone ();
77 #endregion // Constructors
82 protected object CoercedValue {
83 get { throw new NotImplementedException (); }
86 public override ParameterDirection Direction {
87 get { return _direction; }
89 if (_direction != value) {
91 case ParameterDirection.Input:
92 case ParameterDirection.Output:
93 case ParameterDirection.InputOutput:
94 case ParameterDirection.ReturnValue:
101 throw ExceptionHelper.InvalidParameterDirection (value);
106 public override bool IsNullable {
107 get { return _isNullable; }
108 set { _isNullable = value; }
112 public virtual int Offset {
113 get { return _offset; }
114 set { _offset = value; }
117 public override string ParameterName {
119 if (_parameterName == null)
122 return _parameterName;
125 if (_parameterName != value) {
127 _parameterName = value;
132 public override int Size {
133 get { return _size; }
136 if (_size != value) {
138 throw ExceptionHelper.InvalidSizeValue (value);
147 public override string SourceColumn {
149 if (_sourceColumn == null)
152 return _sourceColumn;
155 set { _sourceColumn = value; }
159 public override DataRowVersion SourceVersion {
160 get { return _sourceVersion; }
161 set { _sourceVersion = value; }
166 public override object Value {
167 get { return _value; }
168 set { _value = value; }
171 internal DbParameterCollection Parent
173 get { return _parent; }
174 set { _parent = value; }
177 #endregion // Properties
182 public virtual void CopyTo (DbParameter destination)
184 if (destination == null)
185 throw ExceptionHelper.ArgumentNull ("destination");
187 DbParameterBase t = (DbParameterBase)destination;
188 t._parameterName = _parameterName;
191 t._isNullable = _isNullable;
192 t._sourceColumn = _sourceColumn;
193 t._direction = _direction;
195 if (_value is ICloneable)
196 t._value = ((ICloneable) _value).Clone ();
198 t._value = this._value;
201 public virtual void PropertyChanging ()
208 protected void ResetCoercedValue ()
210 throw new NotImplementedException ();
214 protected void ResetScale ()
216 throw new NotImplementedException ();
220 protected void SetCoercedValue ()
222 throw new NotImplementedException ();
226 protected bool ShouldSerializePrecision ()
228 throw new NotImplementedException ();
232 protected bool ShouldSerializeScale ()
234 throw new NotImplementedException ();
238 protected bool ShouldSerializeSize ()
245 public override string ToString ()
247 throw new NotImplementedException ();
251 protected virtual byte ValuePrecision (object value)
253 throw new NotImplementedException ();
257 protected virtual byte ValueScale (object value)
259 throw new NotImplementedException ();
263 protected virtual int ValueSize (object value)
265 throw new NotImplementedException ();
269 #endregion // Methods