2 // System.Data.OracleClient.OracleConnection
\r
5 // Konstantin Triger <kostat@mainsoft.com>
6 // Boris Kirzner <borisk@mainsoft.com>
8 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
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:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
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.
35 using System.Data.Common;
\r
36 using System.Data.ProviderBase;
\r
37 using System.Collections;
\r
41 using System.Configuration;
\r
42 using Mainsoft.Data.Configuration;
\r
43 using Mainsoft.Data.Jdbc.Providers;
\r
45 namespace System.Data.OracleClient {
\r
46 public sealed class OracleConnection : AbstractDBConnection, System.ICloneable {
\r
49 public event OracleInfoMessageEventHandler InfoMessage;
\r
51 #endregion // Events
\r
53 #region Constructors
\r
55 public OracleConnection() : this(null) {
\r
58 public OracleConnection(String connectionString) : base(connectionString) {
\r
61 #endregion // Constructors
\r
65 protected override IConnectionProvider GetConnectionProvider() {
\r
66 IDictionary conProviderDict = ConnectionStringDictionary.Parse(ConnectionString);
\r
67 string provider = (string)conProviderDict["Provider"];
\r
68 if (provider == null)
\r
69 provider = "ORACLECLIENT";
\r
71 return GetConnectionProvider("Mainsoft.Data.Configuration/OracleClientProviders", provider);
\r
74 public new OracleTransaction BeginTransaction(IsolationLevel level) {
\r
75 return new OracleTransaction(level, this);
\r
78 public new OracleTransaction BeginTransaction() {
\r
79 return BeginTransaction(IsolationLevel.ReadCommitted);
\r
82 public new OracleCommand CreateCommand() {
\r
83 return new OracleCommand(this);
\r
86 protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) {
\r
87 return BeginTransaction();
\r
90 protected override DbCommand CreateDbCommand() {
\r
91 return CreateCommand();
\r
94 protected sealed override SystemException CreateException(SQLException e) {
\r
95 return new OracleException(e,this);
\r
98 protected sealed override SystemException CreateException(string message) {
\r
99 return new OracleException(message, null, this);
\r
102 protected sealed override void OnSqlWarning(SQLWarning warning) {
\r
103 OracleErrorCollection col = new OracleErrorCollection(warning, this);
\r
104 OnOracleInfoMessage(new OracleInfoMessageEventArgs(col));
\r
107 private void OnOracleInfoMessage (OracleInfoMessageEventArgs value) {
108 if (InfoMessage != null) {
109 InfoMessage (this, value);
113 #endregion // Methods
\r