DbCommandBuilder.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. //
  2. // System.Data.Common.DbCommandBuilder
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2003
  8. //
  9. //
  10. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  11. //
  12. // Permission is hereby granted, free of charge, to any person obtaining
  13. // a copy of this software and associated documentation files (the
  14. // "Software"), to deal in the Software without restriction, including
  15. // without limitation the rights to use, copy, modify, merge, publish,
  16. // distribute, sublicense, and/or sell copies of the Software, and to
  17. // permit persons to whom the Software is furnished to do so, subject to
  18. // the following conditions:
  19. //
  20. // The above copyright notice and this permission notice shall be
  21. // included in all copies or substantial portions of the Software.
  22. //
  23. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. //
  31. #if NET_2_0 || TARGET_JVM
  32. using System.ComponentModel;
  33. using System.Data;
  34. namespace System.Data.Common {
  35. public abstract class DbCommandBuilder : Component
  36. {
  37. bool _setAllValues = false;
  38. DbDataAdapter _dbDataAdapter;
  39. #region Constructors
  40. [MonoTODO]
  41. protected DbCommandBuilder ()
  42. {
  43. }
  44. #endregion // Constructors
  45. #region Properties
  46. [MonoTODO]
  47. [DefaultValue (CatalogLocation.Start)]
  48. public virtual CatalogLocation CatalogLocation {
  49. get { throw new NotImplementedException (); }
  50. set { throw new NotImplementedException (); }
  51. }
  52. [MonoTODO]
  53. [DefaultValue (".")]
  54. public virtual string CatalogSeparator {
  55. get { throw new NotImplementedException (); }
  56. set { throw new NotImplementedException (); }
  57. }
  58. [MonoTODO]
  59. [DefaultValue (ConflictOption.CompareAllSearchableValues)]
  60. public virtual ConflictOption ConflictOption {
  61. get { throw new NotImplementedException (); }
  62. set { throw new NotImplementedException (); }
  63. }
  64. [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
  65. [Browsable (false)]
  66. public DbDataAdapter DataAdapter {
  67. get { return _dbDataAdapter; }
  68. set { _dbDataAdapter = value; }
  69. }
  70. [MonoTODO]
  71. [DefaultValue ("")]
  72. public virtual string QuotePrefix {
  73. get { throw new NotImplementedException (); }
  74. set { throw new NotImplementedException (); }
  75. }
  76. [MonoTODO]
  77. [DefaultValue ("")]
  78. public virtual string QuoteSuffix {
  79. get { throw new NotImplementedException (); }
  80. set { throw new NotImplementedException (); }
  81. }
  82. [MonoTODO]
  83. [DefaultValue (".")]
  84. public virtual string SchemaSeparator {
  85. get { throw new NotImplementedException (); }
  86. set { throw new NotImplementedException (); }
  87. }
  88. [DefaultValue (false)]
  89. public bool SetAllValues {
  90. get { return _setAllValues; }
  91. set { _setAllValues = value; }
  92. }
  93. #endregion // Properties
  94. #region Methods
  95. protected abstract void ApplyParameterInfo (DbParameter parameter,
  96. DataRow row,
  97. StatementType statementType,
  98. bool whereClause);
  99. [MonoTODO]
  100. protected override void Dispose (bool disposing)
  101. {
  102. throw new NotImplementedException ();
  103. }
  104. [MonoTODO]
  105. public DbCommand GetDeleteCommand ()
  106. {
  107. return (DbCommand) _dbDataAdapter._deleteCommand;
  108. }
  109. [MonoTODO]
  110. public DbCommand GetDeleteCommand (bool option)
  111. {
  112. throw new NotImplementedException ();
  113. }
  114. [MonoTODO]
  115. public DbCommand GetInsertCommand ()
  116. {
  117. return (DbCommand) _dbDataAdapter._insertCommand;
  118. }
  119. [MonoTODO]
  120. public DbCommand GetInsertCommand (bool option)
  121. {
  122. throw new NotImplementedException ();
  123. }
  124. protected abstract string GetParameterName (int parameterOrdinal);
  125. protected abstract string GetParameterName (String parameterName);
  126. protected abstract string GetParameterPlaceholder (int parameterOrdinal);
  127. [MonoTODO]
  128. public DbCommand GetUpdateCommand ()
  129. {
  130. return (DbCommand) _dbDataAdapter._updateCommand;
  131. }
  132. [MonoTODO]
  133. public DbCommand GetUpdateCommand (bool option)
  134. {
  135. throw new NotImplementedException ();
  136. }
  137. [MonoTODO]
  138. protected virtual DbCommand InitializeCommand (DbCommand command)
  139. {
  140. throw new NotImplementedException ();
  141. }
  142. [MonoTODO]
  143. public virtual string QuoteIdentifier (string unquotedIdentifier)
  144. {
  145. throw new NotImplementedException ();
  146. }
  147. [MonoTODO]
  148. public virtual void RefreshSchema ()
  149. {
  150. throw new NotImplementedException ();
  151. }
  152. [MonoTODO]
  153. protected void RowUpdatingHandler (RowUpdatingEventArgs rowUpdatingEvent)
  154. {
  155. throw new NotImplementedException ();
  156. }
  157. protected abstract void SetRowUpdatingHandler (DbDataAdapter adapter);
  158. [MonoTODO]
  159. public virtual string UnquoteIdentifier (string quotedIdentifier)
  160. {
  161. throw new NotImplementedException ();
  162. }
  163. protected virtual DataTable GetSchemaTable (DbCommand cmd)
  164. {
  165. using (DbDataReader rdr = cmd.ExecuteReader ())
  166. return rdr.GetSchemaTable ();
  167. }
  168. #endregion // Methods
  169. }
  170. }
  171. #endif