[System.Net] Add support for .pac proxy config scripts on mac
[mono.git] / mcs / class / System.Data.OracleClient / System.Data.OracleClient.jvm / OracleConnection.cs
1 //\r
2 // System.Data.OracleClient.OracleConnection\r
3 //
4 // Authors:
5 //      Konstantin Triger <kostat@mainsoft.com>
6 //      Boris Kirzner <borisk@mainsoft.com>
7 //      
8 // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
9 //
10
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 //\r
31 \r
32 \r
33 \r
34 using System.Data;\r
35 using System.Data.Common;\r
36 using System.Data.ProviderBase;\r
37 using System.Collections;\r
38 \r
39 using java.sql;\r
40 \r
41 using System.Configuration;\r
42 using Mainsoft.Data.Configuration;\r
43 using Mainsoft.Data.Jdbc.Providers;\r
44 \r
45 namespace System.Data.OracleClient {\r
46         public sealed class OracleConnection : AbstractDBConnection, System.ICloneable {\r
47                 #region Events\r
48 \r
49                 public event OracleInfoMessageEventHandler InfoMessage;\r
50 \r
51                 #endregion // Events\r
52                 \r
53                 #region Constructors\r
54 \r
55                 public OracleConnection() : this(null) {\r
56                 }\r
57 \r
58                 public OracleConnection(String connectionString) : base(connectionString) {                     \r
59                 }\r
60 \r
61                 #endregion // Constructors\r
62 \r
63                 #region Methods\r
64 \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
70 \r
71                         return GetConnectionProvider("Mainsoft.Data.Configuration/OracleClientProviders", provider);\r
72                 }\r
73 \r
74                 public new OracleTransaction BeginTransaction(IsolationLevel level) {\r
75                         return new OracleTransaction(level, this);\r
76                 }\r
77 \r
78                 public new OracleTransaction BeginTransaction() {\r
79                         return BeginTransaction(IsolationLevel.ReadCommitted);\r
80                 }\r
81 \r
82                 public new OracleCommand CreateCommand() {\r
83                         return new OracleCommand(this);\r
84                 }\r
85 \r
86                 protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) {\r
87                         return BeginTransaction();\r
88                 }\r
89 \r
90                 protected override DbCommand CreateDbCommand() {\r
91                         return CreateCommand();\r
92                 }\r
93 \r
94                 protected sealed override SystemException CreateException(SQLException e) {\r
95                         return new OracleException(e,this);             \r
96                 }\r
97 \r
98                 protected sealed override SystemException CreateException(string message) {\r
99                         return new OracleException(message, null, this);        \r
100                 }\r
101 \r
102                 protected sealed override void OnSqlWarning(SQLWarning warning) {\r
103                         OracleErrorCollection col = new OracleErrorCollection(warning, this);\r
104                         OnOracleInfoMessage(new OracleInfoMessageEventArgs(col));\r
105                 }\r
106 \r
107                 private void OnOracleInfoMessage (OracleInfoMessageEventArgs value) {
108                         if (InfoMessage != null) {
109                                 InfoMessage (this, value);
110                         }
111                 }\r
112 \r
113                 #endregion // Methods\r
114 \r
115         }\r
116 }