3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 /// DB2DriverCS - A DB2 driver for .Net
\r
24 /// Copyright 2003 By Christopher Bockner
\r
25 /// Released under the terms of the MIT/X11 Licence
\r
26 /// Please refer to the Licence.txt file that should be distributed with this package
\r
27 /// This software requires that DB2 client software be installed correctly on the machine
\r
28 /// (or instance) on which the driver is running.
\r
32 using System.Collections;
\r
33 using System.Globalization;
\r
36 namespace DB2ClientCS
\r
39 /// Summary description for DB2ClientParameterCollection.
\r
41 public class DB2ClientParameterCollection : ArrayList, IDataParameterCollection
\r
43 public object this[string index]
\r
47 return this[IndexOf(index)];
\r
51 this[IndexOf(index)] = value;
\r
54 public bool Contains(string paramName)
\r
56 return(-1 != IndexOf(paramName));
\r
59 public int IndexOf(string paramName)
\r
62 foreach(DB2ClientParameter item in this)
\r
64 if (0 == _cultureAwareCompare(item.ParameterName, paramName))
\r
73 public void RemoveAt(string paramName)
\r
75 RemoveAt(IndexOf(paramName));
\r
78 public override int Add(object value)
\r
80 return Add((DB2ClientParameter)value);
\r
83 public int Add(DB2ClientParameter value)
\r
85 if (((DB2ClientParameter)value).ParameterName != null)
\r
87 return base.Add(value);
\r
90 throw new ArgumentException("parameter must be named");
\r
93 public int Add(string paramName, DbType type)
\r
95 return Add(new DB2ClientParameter(paramName, type));
\r
98 public int Add(string paramName, object value)
\r
100 return Add(new DB2ClientParameter(paramName, value));
\r
103 public int Add(string paramName, DbType dbType, string sourceColumn)
\r
105 return Add(new DB2ClientParameter(paramName, dbType, sourceColumn));
\r
108 private int _cultureAwareCompare(string strA, string strB)
\r
110 return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase);
\r