OleDbCommand.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //
  2. // System.Data.OleDb.OleDbCommand
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. //
  7. // Copyright (C) Rodrigo Moya, 2002
  8. //
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Data.Common;
  12. namespace System.Data.OleDb
  13. {
  14. /// <summary>
  15. /// Represents an SQL statement or stored procedure to execute against a data source.
  16. /// </summary>
  17. public sealed class OleDbCommand : Component, ICloneable, IDbCommand
  18. {
  19. private string m_command_string = null;
  20. private OleDbConnection m_connection = null;
  21. private OleDbTransaction m_transaction = null;
  22. private int m_timeout = 30; // 30 is the default, as per .NET docs
  23. private CommandType m_type = CommandType.Text;
  24. private OleDbParameterCollection m_parameters;
  25. public OleDbCommand ()
  26. {
  27. m_parameters = new OleDbParameterCollection ();
  28. }
  29. public OleDbCommand (string s) : this ()
  30. {
  31. m_command_string = s;
  32. }
  33. public OleDbCommand (string s, OleDbConnection cnc) : this ()
  34. {
  35. m_command_string = s;
  36. m_connection = cnc;
  37. }
  38. public OleDbCommand (string s,
  39. OleDbConnection cnc,
  40. OleDbTransaction xtrans) : this ()
  41. {
  42. m_command_string = s;
  43. m_connection = cnc;
  44. m_transaction = xtrans;
  45. }
  46. string IDbCommand.CommandText
  47. {
  48. get {
  49. return m_command_string;
  50. }
  51. set {
  52. m_command_string = value;
  53. }
  54. }
  55. int IDbCommand.CommandTimeout
  56. {
  57. get {
  58. return m_timeout;
  59. }
  60. set {
  61. m_timeout = value;
  62. }
  63. }
  64. CommandType IDbCommand.CommandType
  65. {
  66. get {
  67. return m_type;
  68. }
  69. set {
  70. m_type = value;
  71. }
  72. }
  73. public OleDbConnection Connection
  74. {
  75. get {
  76. return m_connection;
  77. }
  78. set {
  79. m_connection = value;
  80. }
  81. }
  82. public bool DesignTimeVisible
  83. {
  84. [MonoTODO]
  85. get {
  86. throw new NotImplementedException ();
  87. }
  88. [MonoTODO]
  89. set {
  90. throw new NotImplementedException ();
  91. }
  92. }
  93. public OleDbParameterCollection Parameters
  94. {
  95. get {
  96. return m_parameters;
  97. }
  98. }
  99. public OleDbTransaction Transaction
  100. {
  101. get {
  102. return m_transaction;
  103. }
  104. set {
  105. m_transaction = value;
  106. }
  107. }
  108. UpdateRowSource IDbCommand.UpdatedRowSource
  109. {
  110. [MonoTODO]
  111. get {
  112. throw new NotImplementedException ();
  113. }
  114. [MonoTODO]
  115. set {
  116. throw new NotImplementedException ();
  117. }
  118. }
  119. [MonoTODO]
  120. void IDbCommand.Cancel ()
  121. {
  122. throw new NotImplementedException ();
  123. }
  124. IDbDataParameter IDbCommand.CreateParameter ()
  125. {
  126. return new OleDbParameter ();
  127. }
  128. int IDbCommand.ExecuteNonQuery ()
  129. {
  130. if (m_command_string == null)
  131. return -1;
  132. // FIXME
  133. return 0;
  134. }
  135. [MonoTODO]
  136. IDataReader IDbCommand.ExecuteReader ()
  137. {
  138. throw new NotImplementedException ();
  139. }
  140. [MonoTODO]
  141. IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
  142. {
  143. throw new NotImplementedException ();
  144. }
  145. [MonoTODO]
  146. object IDbCommand.ExecuteScalar ()
  147. {
  148. throw new NotImplementedException ();
  149. }
  150. void IDbCommand.Prepare ()
  151. {
  152. // FIXME: prepare string with parameters
  153. }
  154. public void ResetCommandTimeout ()
  155. {
  156. m_timeout = 30;
  157. }
  158. }
  159. }