SQLiteParameter.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using System;
  2. using System.Data;
  3. using System.Collections;
  4. using System.Text;
  5. using System.Data.SQLiteClient.Native;
  6. namespace System.Data.SQLiteClient
  7. {
  8. sealed public class SQLiteParameter : IDbDataParameter
  9. {
  10. private DbType _DbType;
  11. private String _ParameterName;
  12. private String _SourceColumn;
  13. private DataRowVersion _SourceVersion;
  14. private Object _Value;
  15. private int _Size;
  16. public SQLiteParameter() : this(string.Empty, DbType.Object, null)
  17. {
  18. }
  19. public SQLiteParameter (String name, DbType type) : this(name, type, null)
  20. {
  21. }
  22. public SQLiteParameter(String name, DbType type, object value)
  23. {
  24. _DbType = type;
  25. _ParameterName = name;
  26. _SourceColumn = "";
  27. _SourceVersion = DataRowVersion.Default;
  28. _Value = value;
  29. _Size = 0;
  30. }
  31. public DbType DbType
  32. {
  33. get { return _DbType; }
  34. set { _DbType = value; }
  35. }
  36. public ParameterDirection Direction
  37. {
  38. get { return ParameterDirection.Input; }
  39. set
  40. {
  41. if (value != ParameterDirection.Input) throw new SQLiteException("Only ParameterDirection=Input is allowed.");
  42. }
  43. }
  44. public bool IsNullable
  45. {
  46. get { return false; }
  47. }
  48. public String ParameterName
  49. {
  50. get { return _ParameterName; }
  51. set { _ParameterName = value; }
  52. }
  53. public String SourceColumn
  54. {
  55. get { return _SourceColumn; }
  56. set
  57. {
  58. if (value == null) throw new ArgumentNullException("SourceColumn cannot be null.");
  59. _SourceColumn = value;
  60. }
  61. }
  62. public DataRowVersion SourceVersion
  63. {
  64. get { return _SourceVersion; }
  65. set { _SourceVersion = value; }
  66. }
  67. public Object Value
  68. {
  69. get { return _Value; }
  70. set { _Value = value; }
  71. }
  72. public Byte Precision
  73. {
  74. get { throw new NotSupportedException(); }
  75. set { throw new NotSupportedException(); }
  76. }
  77. public Byte Scale
  78. {
  79. get { throw new NotSupportedException(); }
  80. set { throw new NotSupportedException(); }
  81. }
  82. public int Size
  83. {
  84. get { return _Size; }
  85. set { _Size = value; }
  86. }
  87. }
  88. }