2004-01-10 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.Data / System.Data.Common / DbCommand.cs
1 //
2 // System.Data.Common.DbCommand
3 //
4 // Author:
5 //   Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2003
8 //
9
10 #if NET_1_2
11
12 using System.ComponentModel;
13 using System.Data;
14
15 namespace System.Data.Common {
16         public abstract class DbCommand : Component, IDbCommand, IDisposable
17         {
18                 protected DbCommand ()
19                 {
20                 }
21
22                 #region Properties
23
24                 public abstract string CommandText { get; set; }
25                 public abstract int CommandTimeout { get; set; }
26                 public abstract CommandType CommandType { get; set; }
27
28                 public DbConnection Connection {
29                         get { return DbConnection; }
30                         set { DbConnection = value; }
31                 }
32
33                 protected abstract DbConnection DbConnection { get; set; }
34                 protected abstract DbParameterCollection DbParameterCollection { get; set; }
35                 protected abstract DbTransaction DbTransaction { get; set; }
36                 public abstract bool DesignTimeVisible { get; set; }
37
38                 IDbConnection IDbCommand.Connection {
39                         get { return Connection; }
40                         set { Connection = (DbConnection) value; }
41                 }
42
43                 IDataParameterCollection IDbCommand.Parameters {
44                         get { return Parameters; }
45                 }
46
47                 IDbTransaction IDbCommand.Transaction {
48                         get { return Transaction; }
49                         set { Transaction = (DbTransaction) value; }
50                 }
51
52                 [MonoTODO]
53                 public virtual DbCommandOptionalFeatures OptionalFeatures { 
54                         get { throw new NotImplementedException (); }
55                 }
56
57                 public DbParameterCollection Parameters {
58                         get { return DbParameterCollection; }
59                 }
60
61                 public DbTransaction Transaction {
62                         get { return DbTransaction; }
63                         set { DbTransaction = value; }
64                 }
65
66                 public abstract UpdateRowSource UpdatedRowSource { get; set; }
67
68                 #endregion // Properties
69
70                 #region Methods
71
72                 public abstract void Cancel ();
73                 protected abstract DbParameter CreateDbParameter ();
74
75                 public DbParameter CreateParameter ()
76                 {
77                         return CreateDbParameter ();
78                 }
79
80                 protected abstract DbDataReader ExecuteDbDataReader (CommandBehavior behavior);
81
82                 [MonoTODO]
83                 protected virtual DbDataReader ExecuteDbPageReader (CommandBehavior behavior, int startRecord, int maxRecords)
84                 {
85                         throw new NotImplementedException ();
86                 }
87
88                 public abstract int ExecuteNonQuery ();
89                 public DbDataReader ExecutePageReader (CommandBehavior behavior, int startRecord, int maxRecords)
90                 {
91                         return ExecuteDbPageReader (behavior, startRecord, maxRecords);
92                 }
93
94                 [MonoTODO]
95                 public DbDataReader ExecuteReader ()
96                 {
97                         throw new NotImplementedException ();
98                 }
99
100                 [MonoTODO]
101                 public DbDataReader ExecuteReader (CommandBehavior behavior)
102                 {
103                         throw new NotImplementedException ();
104                 }
105
106                 public abstract object ExecuteScalar ();
107
108                 IDbDataParameter IDbCommand.CreateParameter ()
109                 {
110                         return CreateParameter ();
111                 }
112
113                 IDataReader IDbCommand.ExecuteReader ()
114                 {
115                         return ExecuteReader ();
116                 }
117
118                 IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
119                 {
120                         return ExecuteReader (behavior);
121                 }
122
123                 public abstract void Prepare ();
124                 
125                 #endregion // Methods
126
127         }
128 }
129
130 #endif