SqlParameter.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. //
  2. // System.Data.SqlClient.SqlParameter.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.Runtime.InteropServices;
  15. namespace System.Data.SqlClient
  16. {
  17. /// <summary>
  18. /// Represents a parameter to a Command object, and optionally,
  19. /// its mapping to DataSet columns; and is implemented by .NET
  20. /// data providers that access data sources.
  21. /// </summary>
  22. //public sealed class SqlParameter : MarshalByRefObject,
  23. // IDbDataParameter, IDataParameter, ICloneable
  24. public sealed class SqlParameter : IDbDataParameter, IDataParameter
  25. {
  26. private string parmName;
  27. private SqlDbType dbtype;
  28. private DbType theDbType;
  29. private object objValue;
  30. private int size;
  31. private string sourceColumn;
  32. private ParameterDirection direction;
  33. private bool isNullable;
  34. private byte precision;
  35. private byte scale;
  36. private DataRowVersion sourceVersion;
  37. private int offset;
  38. [MonoTODO]
  39. public SqlParameter () {
  40. }
  41. [MonoTODO]
  42. public SqlParameter (string parameterName, object value) {
  43. this.parmName = parameterName;
  44. this.objValue = value;
  45. }
  46. [MonoTODO]
  47. public SqlParameter(string parameterName, SqlDbType dbType) {
  48. this.parmName = parameterName;
  49. this.dbtype = dbType;
  50. }
  51. [MonoTODO]
  52. public SqlParameter(string parameterName, SqlDbType dbType,
  53. int size) {
  54. this.parmName = parameterName;
  55. this.dbtype = dbType;
  56. this.size = size;
  57. }
  58. [MonoTODO]
  59. public SqlParameter(string parameterName, SqlDbType dbType,
  60. int size, string sourceColumn) {
  61. this.parmName = parameterName;
  62. this.dbtype = dbType;
  63. this.size = size;
  64. this.sourceColumn = sourceColumn;
  65. }
  66. [MonoTODO]
  67. public SqlParameter(string parameterName, SqlDbType dbType,
  68. int size, ParameterDirection direction,
  69. bool isNullable, byte precision,
  70. byte scale, string sourceColumn,
  71. DataRowVersion sourceVersion, object value) {
  72. this.parmName = parameterName;
  73. this.dbtype = dbType;
  74. this.size = size;
  75. this.sourceColumn = sourceColumn;
  76. this.direction = direction;
  77. this.isNullable = isNullable;
  78. this.precision = precision;
  79. this.scale = scale;
  80. this.sourceVersion = sourceVersion;
  81. this.objValue = value;
  82. }
  83. [MonoTODO]
  84. public DbType DbType {
  85. get {
  86. return theDbType;
  87. }
  88. set {
  89. theDbType = value;
  90. }
  91. }
  92. [MonoTODO]
  93. public ParameterDirection Direction {
  94. get {
  95. return direction;
  96. }
  97. set {
  98. direction = value;
  99. }
  100. }
  101. [MonoTODO]
  102. public bool IsNullable {
  103. get {
  104. return isNullable;
  105. }
  106. }
  107. [MonoTODO]
  108. public int Offset {
  109. get {
  110. return offset;
  111. }
  112. set {
  113. offset = value;
  114. }
  115. }
  116. string IDataParameter.ParameterName {
  117. get {
  118. return parmName;
  119. }
  120. set {
  121. parmName = value;
  122. }
  123. }
  124. public string ParameterName {
  125. get {
  126. return parmName;
  127. }
  128. set {
  129. parmName = value;
  130. }
  131. }
  132. [MonoTODO]
  133. public string SourceColumn {
  134. get {
  135. return sourceColumn;
  136. }
  137. set {
  138. sourceColumn = value;
  139. }
  140. }
  141. [MonoTODO]
  142. public DataRowVersion SourceVersion {
  143. get {
  144. return sourceVersion;
  145. }
  146. set {
  147. sourceVersion = value;
  148. }
  149. }
  150. [MonoTODO]
  151. public SqlDbType SqlDbType {
  152. get {
  153. return dbtype;
  154. }
  155. set {
  156. dbtype = value;
  157. }
  158. }
  159. [MonoTODO]
  160. public object Value {
  161. get {
  162. return objValue;
  163. }
  164. set {
  165. objValue = value;
  166. }
  167. }
  168. [MonoTODO]
  169. public byte Precision {
  170. get {
  171. return precision;
  172. }
  173. set {
  174. precision = value;
  175. }
  176. }
  177. [MonoTODO]
  178. public byte Scale {
  179. get {
  180. return scale;
  181. }
  182. set {
  183. scale = value;
  184. }
  185. }
  186. [MonoTODO]
  187. public int Size
  188. {
  189. get {
  190. return size;
  191. }
  192. set {
  193. size = value;
  194. }
  195. }
  196. [MonoTODO]
  197. public override string ToString() {
  198. return parmName;
  199. }
  200. }
  201. }