SqlParameterCollection.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. //
  2. // System.Data.SqlClient.SqlParameterCollection.cs
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. // Daniel Morgan ([email protected])
  7. //
  8. // (C) Ximian, Inc 2002
  9. //
  10. using System;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Data.Common;
  14. using System.Collections;
  15. namespace System.Data.SqlClient
  16. {
  17. /// <summary>
  18. /// Collects all parameters relevant to a Command object
  19. /// and their mappings to DataSet columns.
  20. /// </summary>
  21. // public sealed class SqlParameterCollection : MarshalByRefObject,
  22. // IDataParameterCollection, IList, ICollection, IEnumerable
  23. public sealed class SqlParameterCollection : IDataParameterCollection
  24. {
  25. private ArrayList parameterList = new ArrayList();
  26. private Hashtable parameterNames = new Hashtable();
  27. /*
  28. [MonoTODO]
  29. public void RemoveAt(string parameterName)
  30. {
  31. throw new NotImplementedException ();
  32. }
  33. [MonoTODO]
  34. public int IndexOf(string parameterName)
  35. {
  36. throw new NotImplementedException ();
  37. }
  38. [MonoTODO]
  39. public bool Contains(string parameterName)
  40. {
  41. return parameterNames.ContainsKey(parameterName);
  42. }
  43. */
  44. [MonoTODO]
  45. public IEnumerator GetEnumerator()
  46. {
  47. throw new NotImplementedException ();
  48. }
  49. [MonoTODO]
  50. public int Add( object value)
  51. {
  52. throw new NotImplementedException ();
  53. }
  54. [MonoTODO]
  55. public SqlParameter Add(SqlParameter value)
  56. {
  57. parameterList.Add(value);
  58. parameterNames.Add(value.ParameterName, parameterList.Add(value));
  59. return value;
  60. }
  61. [MonoTODO]
  62. public SqlParameter Add(string parameterName, object value)
  63. {
  64. throw new NotImplementedException ();
  65. }
  66. [MonoTODO]
  67. public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
  68. {
  69. throw new NotImplementedException ();
  70. }
  71. [MonoTODO]
  72. public SqlParameter Add(string parameterName,
  73. SqlDbType sqlDbType, int size)
  74. {
  75. throw new NotImplementedException ();
  76. }
  77. [MonoTODO]
  78. public SqlParameter Add(string parameterName,
  79. SqlDbType sqlDbType, int size, string sourceColumn)
  80. {
  81. throw new NotImplementedException ();
  82. }
  83. [MonoTODO]
  84. public void Clear()
  85. {
  86. throw new NotImplementedException ();
  87. }
  88. [MonoTODO]
  89. public bool Contains(object value)
  90. {
  91. throw new NotImplementedException ();
  92. }
  93. [MonoTODO]
  94. public bool Contains(string value)
  95. {
  96. return parameterNames.ContainsKey(value);
  97. }
  98. [MonoTODO]
  99. public void CopyTo(Array array, int index)
  100. {
  101. throw new NotImplementedException ();
  102. }
  103. [MonoTODO]
  104. public int IndexOf(object value)
  105. {
  106. throw new NotImplementedException ();
  107. }
  108. [MonoTODO]
  109. public int IndexOf(string parameterName)
  110. {
  111. throw new NotImplementedException ();
  112. }
  113. [MonoTODO]
  114. public void Insert(int index, object value)
  115. {
  116. throw new NotImplementedException ();
  117. }
  118. [MonoTODO]
  119. public void Remove(object value)
  120. {
  121. throw new NotImplementedException ();
  122. }
  123. [MonoTODO]
  124. public void RemoveAt(int index)
  125. {
  126. throw new NotImplementedException ();
  127. }
  128. [MonoTODO]
  129. public void RemoveAt(string parameterName)
  130. {
  131. throw new NotImplementedException ();
  132. }
  133. [MonoTODO]
  134. public int Count {
  135. get {
  136. return parameterList.Count;
  137. }
  138. }
  139. object IList.this[int index] {
  140. [MonoTODO]
  141. get {
  142. return (SqlParameter) this[index];
  143. }
  144. [MonoTODO]
  145. set {
  146. this[index] = (SqlParameter) value;
  147. }
  148. }
  149. public SqlParameter this[int index] {
  150. get {
  151. return (SqlParameter) parameterList[index];
  152. }
  153. set {
  154. parameterList[index] = (SqlParameter) value;
  155. }
  156. }
  157. object IDataParameterCollection.this[string parameterName] {
  158. [MonoTODO]
  159. get {
  160. return (SqlParameter) this[parameterName];
  161. }
  162. [MonoTODO]
  163. set {
  164. this[parameterName] = (SqlParameter) value;
  165. }
  166. }
  167. public SqlParameter this[string parameterName] {
  168. get {
  169. if(parameterNames.ContainsKey(parameterName))
  170. return (SqlParameter) parameterList[(int)parameterNames[parameterName]];
  171. else
  172. throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
  173. }
  174. set {
  175. if(parameterNames.ContainsKey(parameterName))
  176. parameterList[(int)parameterNames[parameterName]] = (SqlParameter) value;
  177. else
  178. throw new IndexOutOfRangeException("The specified name does not exist: " + parameterName);
  179. }
  180. }
  181. bool IList.IsFixedSize {
  182. get {
  183. throw new NotImplementedException ();
  184. }
  185. }
  186. bool IList.IsReadOnly {
  187. get {
  188. throw new NotImplementedException ();
  189. }
  190. }
  191. bool ICollection.IsSynchronized {
  192. get {
  193. throw new NotImplementedException ();
  194. }
  195. }
  196. object ICollection.SyncRoot {
  197. get {
  198. throw new NotImplementedException ();
  199. }
  200. }
  201. }
  202. }