aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs')
-rw-r--r--OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs432
1 files changed, 216 insertions, 216 deletions
diff --git a/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs b/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs
index 6a7d787..cae864b 100644
--- a/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs
+++ b/OpenSim/Data/MSSQL/AutoClosingSqlCommand.cs
@@ -1,216 +1,216 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.Data.SqlClient; 31using System.Data.SqlClient;
32using System.Data; 32using System.Data;
33 33
34namespace OpenSim.Data.MSSQL 34namespace OpenSim.Data.MSSQL
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Encapsulates a SqlCommand object but ensures that when it is disposed, its connection is closed and disposed also. 37 /// Encapsulates a SqlCommand object but ensures that when it is disposed, its connection is closed and disposed also.
38 /// </summary> 38 /// </summary>
39 internal class AutoClosingSqlCommand : IDbCommand 39 internal class AutoClosingSqlCommand : IDbCommand
40 { 40 {
41 private SqlCommand realCommand; 41 private SqlCommand realCommand;
42 42
43 public AutoClosingSqlCommand(SqlCommand cmd) 43 public AutoClosingSqlCommand(SqlCommand cmd)
44 { 44 {
45 realCommand = cmd; 45 realCommand = cmd;
46 } 46 }
47 47
48 #region IDbCommand Members 48 #region IDbCommand Members
49 49
50 public void Cancel() 50 public void Cancel()
51 { 51 {
52 realCommand.Cancel(); 52 realCommand.Cancel();
53 } 53 }
54 54
55 public string CommandText 55 public string CommandText
56 { 56 {
57 get 57 get
58 { 58 {
59 return realCommand.CommandText; 59 return realCommand.CommandText;
60 } 60 }
61 set 61 set
62 { 62 {
63 realCommand.CommandText = value; 63 realCommand.CommandText = value;
64 } 64 }
65 } 65 }
66 66
67 public int CommandTimeout 67 public int CommandTimeout
68 { 68 {
69 get 69 get
70 { 70 {
71 return realCommand.CommandTimeout; 71 return realCommand.CommandTimeout;
72 } 72 }
73 set 73 set
74 { 74 {
75 realCommand.CommandTimeout = value; 75 realCommand.CommandTimeout = value;
76 } 76 }
77 } 77 }
78 78
79 public CommandType CommandType 79 public CommandType CommandType
80 { 80 {
81 get 81 get
82 { 82 {
83 return realCommand.CommandType; 83 return realCommand.CommandType;
84 } 84 }
85 set 85 set
86 { 86 {
87 realCommand.CommandType = value; 87 realCommand.CommandType = value;
88 } 88 }
89 } 89 }
90 90
91 IDbConnection IDbCommand.Connection 91 IDbConnection IDbCommand.Connection
92 { 92 {
93 get 93 get
94 { 94 {
95 return realCommand.Connection; 95 return realCommand.Connection;
96 } 96 }
97 set 97 set
98 { 98 {
99 realCommand.Connection = (SqlConnection) value; 99 realCommand.Connection = (SqlConnection) value;
100 } 100 }
101 } 101 }
102 102
103 public SqlConnection Connection 103 public SqlConnection Connection
104 { 104 {
105 get 105 get
106 { 106 {
107 return realCommand.Connection; 107 return realCommand.Connection;
108 } 108 }
109 } 109 }
110 110
111 IDbDataParameter IDbCommand.CreateParameter() 111 IDbDataParameter IDbCommand.CreateParameter()
112 { 112 {
113 return realCommand.CreateParameter(); 113 return realCommand.CreateParameter();
114 } 114 }
115 115
116 public SqlParameter CreateParameter() 116 public SqlParameter CreateParameter()
117 { 117 {
118 return realCommand.CreateParameter(); 118 return realCommand.CreateParameter();
119 } 119 }
120 120
121 public int ExecuteNonQuery() 121 public int ExecuteNonQuery()
122 { 122 {
123 return realCommand.ExecuteNonQuery(); 123 return realCommand.ExecuteNonQuery();
124 } 124 }
125 125
126 IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior) 126 IDataReader IDbCommand.ExecuteReader(CommandBehavior behavior)
127 { 127 {
128 return realCommand.ExecuteReader(behavior); 128 return realCommand.ExecuteReader(behavior);
129 } 129 }
130 130
131 public SqlDataReader ExecuteReader(CommandBehavior behavior) 131 public SqlDataReader ExecuteReader(CommandBehavior behavior)
132 { 132 {
133 return realCommand.ExecuteReader(behavior); 133 return realCommand.ExecuteReader(behavior);
134 } 134 }
135 135
136 IDataReader IDbCommand.ExecuteReader() 136 IDataReader IDbCommand.ExecuteReader()
137 { 137 {
138 return realCommand.ExecuteReader(); 138 return realCommand.ExecuteReader();
139 } 139 }
140 140
141 public SqlDataReader ExecuteReader() 141 public SqlDataReader ExecuteReader()
142 { 142 {
143 return realCommand.ExecuteReader(); 143 return realCommand.ExecuteReader();
144 } 144 }
145 145
146 public object ExecuteScalar() 146 public object ExecuteScalar()
147 { 147 {
148 return realCommand.ExecuteScalar(); 148 return realCommand.ExecuteScalar();
149 } 149 }
150 150
151 IDataParameterCollection IDbCommand.Parameters 151 IDataParameterCollection IDbCommand.Parameters
152 { 152 {
153 get { return realCommand.Parameters; } 153 get { return realCommand.Parameters; }
154 } 154 }
155 155
156 public SqlParameterCollection Parameters 156 public SqlParameterCollection Parameters
157 { 157 {
158 get { return realCommand.Parameters; } 158 get { return realCommand.Parameters; }
159 } 159 }
160 160
161 public void Prepare() 161 public void Prepare()
162 { 162 {
163 realCommand.Prepare(); 163 realCommand.Prepare();
164 } 164 }
165 165
166 IDbTransaction IDbCommand.Transaction 166 IDbTransaction IDbCommand.Transaction
167 { 167 {
168 get 168 get
169 { 169 {
170 return realCommand.Transaction; 170 return realCommand.Transaction;
171 } 171 }
172 set 172 set
173 { 173 {
174 realCommand.Transaction = (SqlTransaction) value; 174 realCommand.Transaction = (SqlTransaction) value;
175 } 175 }
176 } 176 }
177 177
178 UpdateRowSource IDbCommand.UpdatedRowSource 178 UpdateRowSource IDbCommand.UpdatedRowSource
179 { 179 {
180 get 180 get
181 { 181 {
182 return realCommand.UpdatedRowSource; 182 return realCommand.UpdatedRowSource;
183 } 183 }
184 set 184 set
185 { 185 {
186 realCommand.UpdatedRowSource = value; 186 realCommand.UpdatedRowSource = value;
187 } 187 }
188 } 188 }
189 189
190 #endregion 190 #endregion
191 191
192 #region IDisposable Members 192 #region IDisposable Members
193 193
194 public void Dispose() 194 public void Dispose()
195 { 195 {
196 SqlConnection conn = realCommand.Connection; 196 SqlConnection conn = realCommand.Connection;
197 try 197 try
198 { 198 {
199 realCommand.Dispose(); 199 realCommand.Dispose();
200 } 200 }
201 finally 201 finally
202 { 202 {
203 try 203 try
204 { 204 {
205 conn.Close(); 205 conn.Close();
206 } 206 }
207 finally 207 finally
208 { 208 {
209 conn.Dispose(); 209 conn.Dispose();
210 } 210 }
211 } 211 }
212 } 212 }
213 213
214 #endregion 214 #endregion
215 } 215 }
216} 216}