wasCSharpSQLite – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | // |
2 | // System.Data.Common.DbConnection |
||
3 | // |
||
4 | // Author: |
||
5 | // Tim Coleman (tim@timcoleman.com) |
||
6 | // |
||
7 | // Copyright (C) Tim Coleman, 2003 |
||
8 | // |
||
9 | |||
10 | // |
||
11 | // Copyright (C) 2004 Novell, Inc (http://www.novell.com) |
||
12 | // |
||
13 | // Permission is hereby granted, free of charge, to any person obtaining |
||
14 | // a copy of this software and associated documentation files (the |
||
15 | // "Software"), to deal in the Software without restriction, including |
||
16 | // without limitation the rights to use, copy, modify, merge, publish, |
||
17 | // distribute, sublicense, and/or sell copies of the Software, and to |
||
18 | // permit persons to whom the Software is furnished to do so, subject to |
||
19 | // the following conditions: |
||
20 | // |
||
21 | // The above copyright notice and this permission notice shall be |
||
22 | // included in all copies or substantial portions of the Software. |
||
23 | // |
||
24 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||
25 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||
26 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||
27 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
||
28 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
||
29 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||
30 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
31 | // |
||
32 | |||
33 | |||
34 | |||
35 | using System.ComponentModel; |
||
36 | using System.Data; |
||
37 | |||
38 | |||
39 | namespace System.Data.Common { |
||
40 | public abstract class DbConnection : IDbConnection, IDisposable |
||
41 | { |
||
42 | #region Constructors |
||
43 | |||
44 | protected DbConnection () |
||
45 | { |
||
46 | } |
||
47 | |||
48 | #endregion // Constructors |
||
49 | |||
50 | #region Properties |
||
51 | |||
52 | [DefaultValue ("")] |
||
53 | public abstract string ConnectionString { get; set; } |
||
54 | |||
55 | public abstract string Database { get; } |
||
56 | public abstract string DataSource { get; } |
||
57 | #if !(WINDOWS_PHONE || NETFX_CORE) |
||
58 | [Browsable (false)] |
||
59 | #endif |
||
60 | public abstract string ServerVersion { get; } |
||
61 | #if !(WINDOWS_PHONE || NETFX_CORE) |
||
62 | [Browsable (false)] |
||
63 | #endif |
||
64 | public abstract ConnectionState State { get; } |
||
65 | |||
66 | public virtual int ConnectionTimeout { |
||
67 | get { return 15; } |
||
68 | } |
||
69 | |||
70 | #endregion // Properties |
||
71 | |||
72 | #region Methods |
||
73 | |||
74 | protected abstract DbTransaction BeginDbTransaction (IsolationLevel isolationLevel); |
||
75 | |||
76 | public DbTransaction BeginTransaction () |
||
77 | { |
||
78 | return BeginDbTransaction (IsolationLevel.Unspecified); |
||
79 | } |
||
80 | |||
81 | public DbTransaction BeginTransaction (IsolationLevel isolationLevel) |
||
82 | { |
||
83 | return BeginDbTransaction (isolationLevel); |
||
84 | } |
||
85 | |||
86 | public abstract void ChangeDatabase (string databaseName); |
||
87 | public abstract void Close (); |
||
88 | |||
89 | public DbCommand CreateCommand () |
||
90 | { |
||
91 | return CreateDbCommand (); |
||
92 | } |
||
93 | |||
94 | protected abstract DbCommand CreateDbCommand (); |
||
95 | |||
96 | //#if NET_2_0 && !TARGET_JVM |
||
97 | // public virtual void EnlistTransaction (Transaction transaction) |
||
98 | // { |
||
99 | // throw new NotSupportedException (); |
||
100 | // } |
||
101 | //#endif |
||
102 | |||
103 | |||
104 | static class DataTypes |
||
105 | { |
||
106 | static readonly ColumnInfo [] columns = { |
||
107 | new ColumnInfo ("TypeName", typeof(string)), |
||
108 | new ColumnInfo ("ProviderDbType", typeof(int)), |
||
109 | new ColumnInfo ("ColumnSize", typeof(long)), |
||
110 | new ColumnInfo ("CreateFormat", typeof(string)), |
||
111 | new ColumnInfo ("CreateParameters", typeof(string)), |
||
112 | new ColumnInfo ("DataType", typeof(string)), |
||
113 | new ColumnInfo ("IsAutoIncrementable", typeof(bool)), |
||
114 | new ColumnInfo ("IsBestMatch", typeof(bool)), |
||
115 | new ColumnInfo ("IsCaseSensitive", typeof(bool)), |
||
116 | new ColumnInfo ("IsFixedLength", typeof(bool)), |
||
117 | new ColumnInfo ("IsFixedPrecisionScale", typeof(bool)), |
||
118 | new ColumnInfo ("IsLong", typeof(bool)), |
||
119 | new ColumnInfo ("IsNullable", typeof(bool)), |
||
120 | new ColumnInfo ("IsSearchable", typeof(bool)), |
||
121 | new ColumnInfo ("IsSearchableWithLike", typeof(bool)), |
||
122 | new ColumnInfo ("IsUnsigned", typeof(bool)), |
||
123 | new ColumnInfo ("MaximumScale", typeof(short)), |
||
124 | new ColumnInfo ("MinimumScale", typeof(short)), |
||
125 | new ColumnInfo ("IsConcurrencyType", typeof(bool)), |
||
126 | new ColumnInfo ("IsLiteralSupported", typeof(bool)), |
||
127 | new ColumnInfo ("LiteralPrefix", typeof(string)), |
||
128 | new ColumnInfo ("LiteralSuffix", typeof(string)) |
||
129 | }; |
||
130 | |||
131 | static readonly object [][] rows = { |
||
132 | new object [] {"smallint", 16, 5, "smallint", null, "System.Int16", true, true, |
||
133 | false, true, true, false, true, true, false, false, null, |
||
134 | null, false, null, null, null}, |
||
135 | new object [] {"int", 8, 10, "int", null, "System.Int32", |
||
136 | true, true, false, true, true, false, true, true, false, |
||
137 | false, null, null, false, null, null, null}, |
||
138 | new object [] {"real", 13, 7, "real", null, |
||
139 | "System.Single", false, true, false, true, false, false, |
||
140 | true, true, false, false, null, null, false, null, null, null}, |
||
141 | new object [] {"float", 6, 53, "float({0})", |
||
142 | "number of bits used to store the mantissa", "System.Double", |
||
143 | false, true, false, true, false, false, true, true, |
||
144 | false, false, null, null, false, null, null, null}, |
||
145 | new object [] {"money", 9, 19, "money", null, |
||
146 | "System.Decimal", false, false, false, true, true, |
||
147 | false, true, true, false, false, null, null, false, |
||
148 | null, null, null}, |
||
149 | new object [] {"smallmoney", 17, 10, "smallmoney", null, |
||
150 | "System.Decimal", false, false, false, true, true, false, |
||
151 | true, true, false, false, null, null, false, null, null, null}, |
||
152 | new object [] {"bit", 2, 1, "bit", null, "System.Boolean", |
||
153 | false, false, false, true, false, false, true, true, |
||
154 | false, null, null, null, false, null, null, null}, |
||
155 | new object [] {"tinyint", 20, 3, "tinyint", null, |
||
156 | "System.SByte", true, true, false, true, true, false, |
||
157 | true, true, false, true, null, null, false, null, null, null}, |
||
158 | new object [] {"bigint", 0, 19, "bigint", null, |
||
159 | "System.Int64", true, true, false, true, true, false, |
||
160 | true, true, false, false, null, null, false, null, null, null}, |
||
161 | new object [] {"timestamp", 19, 8, "timestamp", null, |
||
162 | "System.Byte[]", false, false, false, true, false, false, |
||
163 | false, true, false, null, null, null, true, null, "0x", null}, |
||
164 | new object [] {"binary", 1, 8000, "binary({0})", "length", |
||
165 | "System.Byte[]", false, true, false, true, false, false, |
||
166 | true, true, false, null, null, null, false, null, "0x", null}, |
||
167 | new object [] {"image", 7, 2147483647, "image", null, |
||
168 | "System.Byte[]", false, true, false, false, false, true, |
||
169 | true, false, false, null, null, null, false, null, "0x", null}, |
||
170 | new object [] {"text", 18, 2147483647, "text", null, |
||
171 | "System.String", false, true, false, false, false, true, |
||
172 | true, false, true, null, null, null, false, null, "'", "'"}, |
||
173 | new object [] {"ntext", 11, 1073741823, "ntext", null, |
||
174 | "System.String", false, true, false, false, false, true, |
||
175 | true, false, true, null, null, null, false, null, "N'", "'"}, |
||
176 | new object [] {"decimal", 5, 38, "decimal({0}, {1})", |
||
177 | "precision,scale", "System.Decimal", true, true, false, |
||
178 | true, false, false, true, true, false, false, 38, 0, |
||
179 | false, null, null, null}, |
||
180 | new object [] {"numeric", 5, 38, "numeric({0}, {1})", |
||
181 | "precision,scale", "System.Decimal", true, true, false, |
||
182 | true, false, false, true, true, false, false, 38, 0, |
||
183 | false, null, null, null}, |
||
184 | new object [] {"datetime", 4, 23, "datetime", null, |
||
185 | "System.DateTime", false, true, false, true, false, false, |
||
186 | true, true, true, null, null, null, false, null, "{ts '", "'}"}, |
||
187 | new object [] {"smalldatetime", 15, 16, "smalldatetime", null, |
||
188 | "System.DateTime", false, true, false, true, false, false, |
||
189 | true, true, true, null, null, null, false, null, "{ts '", "'}"}, |
||
190 | new object [] {"sql_variant", 23, null, "sql_variant", |
||
191 | null, "System.Object", false, true, false, false, false, |
||
192 | false, true, true, false, null, null, null, false, false, |
||
193 | null, null}, |
||
194 | new object [] {"xml", 25, 2147483647, "xml", null, |
||
195 | "System.String", false, false, false, false, false, true, |
||
196 | true, false, false, null, null, null, false, false, null, null}, |
||
197 | new object [] {"varchar", 22, 2147483647, "varchar({0})", |
||
198 | "max length", "System.String", false, true, false, false, |
||
199 | false, false, true, true, true, null, null, null, false, |
||
200 | null, "'", "'"}, |
||
201 | new object [] {"char", 3, 2147483647, "char({0})", "length", |
||
202 | "System.String", false, true, false, true, false, false, |
||
203 | true, true, true, null, null, null, false, null, "'", "'"}, |
||
204 | new object [] {"nchar", 10, 1073741823, "nchar({0})", "length", |
||
205 | "System.String", false, true, false, true, false, false, |
||
206 | true, true, true, null, null, null, false, null, "N'", "'"}, |
||
207 | new object [] {"nvarchar", 12, 1073741823, "nvarchar({0})", "max length", |
||
208 | "System.String", false, true, false, false, false, false, true, true, |
||
209 | true, null, null, null, false, null, "N'", "'"}, |
||
210 | new object [] {"varbinary", 21, 1073741823, "varbinary({0})", |
||
211 | "max length", "System.Byte[]", false, true, false, false, |
||
212 | false, false, true, true, false, null, null, null, false, |
||
213 | null, "0x", null}, |
||
214 | new object [] {"uniqueidentifier", 14, 16, "uniqueidentifier", null, |
||
215 | "System.Guid", false, true, false, true, false, false, true, |
||
216 | true, false, null, null, null, false, null, "'", "'"} |
||
217 | }; |
||
218 | |||
219 | //static DataTable instance; |
||
220 | //static public DataTable Instance { |
||
221 | // get { |
||
222 | // if (instance == null) { |
||
223 | // instance = new DataTable ("DataTypes"); |
||
224 | // foreach (ColumnInfo c in columns) |
||
225 | // instance.Columns.Add (c.name, c.type); |
||
226 | // foreach (object [] row in rows) |
||
227 | // instance.LoadDataRow (row, true); |
||
228 | // } |
||
229 | // return instance; |
||
230 | // } |
||
231 | //} |
||
232 | } |
||
233 | |||
234 | struct ColumnInfo { |
||
235 | public string name; |
||
236 | public Type type; |
||
237 | public ColumnInfo (string name, Type type) |
||
238 | { |
||
239 | this.name = name; this.type = type; |
||
240 | } |
||
241 | } |
||
242 | |||
243 | internal static class MetaDataCollections |
||
244 | { |
||
245 | static readonly ColumnInfo [] columns = { |
||
246 | new ColumnInfo ("CollectionName", typeof (string)), |
||
247 | new ColumnInfo ("NumberOfRestrictions", typeof (int)), |
||
248 | new ColumnInfo ("NumberOfIdentifierParts", typeof (int)) |
||
249 | }; |
||
250 | |||
251 | static readonly object [][] rows = { |
||
252 | new object [] {"MetaDataCollections", 0, 0}, |
||
253 | new object [] {"DataSourceInformation", 0, 0}, |
||
254 | new object [] {"DataTypes", 0, 0}, |
||
255 | new object [] {"Restrictions", 0, 0}, |
||
256 | new object [] {"ReservedWords", 0, 0}, |
||
257 | new object [] {"Users", 1, 1}, |
||
258 | new object [] {"Databases", 1, 1}, |
||
259 | new object [] {"Tables", 4, 3}, |
||
260 | new object [] {"Columns", 4, 4}, |
||
261 | new object [] {"Views", 3, 3}, |
||
262 | new object [] {"ViewColumns", 4, 4}, |
||
263 | new object [] {"ProcedureParameters", 4, 1}, |
||
264 | new object [] {"Procedures", 4, 3}, |
||
265 | new object [] {"ForeignKeys", 4, 3}, |
||
266 | new object [] {"IndexColumns", 5, 4}, |
||
267 | new object [] {"Indexes", 4, 3}, |
||
268 | new object [] {"UserDefinedTypes", 2, 1} |
||
269 | }; |
||
270 | |||
271 | //static DataTable instance; |
||
272 | //static public DataTable Instance { |
||
273 | // get { |
||
274 | // if (instance == null) { |
||
275 | // instance = new DataTable ("GetSchema"); |
||
276 | // foreach (ColumnInfo c in columns) |
||
277 | // instance.Columns.Add (c.name, c.type); |
||
278 | // foreach (object [] row in rows) |
||
279 | // instance.LoadDataRow (row, true); |
||
280 | // } |
||
281 | // return instance; |
||
282 | // } |
||
283 | //} |
||
284 | } |
||
285 | |||
286 | static class Restrictions |
||
287 | { |
||
288 | static readonly ColumnInfo [] columns = { |
||
289 | new ColumnInfo ("CollectionName", typeof (string)), |
||
290 | new ColumnInfo ("RestrictionName", typeof(string)), |
||
291 | new ColumnInfo ("ParameterName", typeof(string)), |
||
292 | new ColumnInfo ("RestrictionDefault", typeof(string)), |
||
293 | new ColumnInfo ("RestrictionNumber", typeof(int)) |
||
294 | }; |
||
295 | |||
296 | static readonly object [][] rows = { |
||
297 | new object [] {"Users", "User_Name", "@Name", "name", 1}, |
||
298 | new object [] {"Databases", "Name", "@Name", "Name", 1}, |
||
299 | |||
300 | new object [] {"Tables", "Catalog", "@Catalog", "TABLE_CATALOG", 1}, |
||
301 | new object [] {"Tables", "Owner", "@Owner", "TABLE_SCHEMA", 2}, |
||
302 | new object [] {"Tables", "Table", "@Name", "TABLE_NAME", 3}, |
||
303 | new object [] {"Tables", "TableType", "@TableType", "TABLE_TYPE", 4}, |
||
304 | |||
305 | new object [] {"Columns", "Catalog", "@Catalog", "TABLE_CATALOG", 1}, |
||
306 | new object [] {"Columns", "Owner", "@Owner", "TABLE_SCHEMA", 2}, |
||
307 | new object [] {"Columns", "Table", "@Table", "TABLE_NAME", 3}, |
||
308 | new object [] {"Columns", "Column", "@Column", "COLUMN_NAME", 4}, |
||
309 | |||
310 | new object [] {"Views", "Catalog", "@Catalog", "TABLE_CATALOG", 1}, |
||
311 | new object [] {"Views", "Owner", "@Owner", "TABLE_SCHEMA", 2}, |
||
312 | new object [] {"Views", "Table", "@Table", "TABLE_NAME", 3}, |
||
313 | |||
314 | new object [] {"ViewColumns", "Catalog", "@Catalog", "VIEW_CATALOG", 1}, |
||
315 | new object [] {"ViewColumns", "Owner", "@Owner", "VIEW_SCHEMA", 2}, |
||
316 | new object [] {"ViewColumns", "Table", "@Table", "VIEW_NAME", 3}, |
||
317 | new object [] {"ViewColumns", "Column", "@Column", "COLUMN_NAME", 4}, |
||
318 | |||
319 | new object [] {"ProcedureParameters", "Catalog", "@Catalog", "SPECIFIC_CATALOG", 1}, |
||
320 | new object [] {"ProcedureParameters", "Owner", "@Owner", "SPECIFIC_SCHEMA", 2}, |
||
321 | new object [] {"ProcedureParameters", "Name", "@Name", "SPECIFIC_NAME", 3}, |
||
322 | new object [] {"ProcedureParameters", "Parameter", "@Parameter", "PARAMETER_NAME", 4}, |
||
323 | |||
324 | new object [] {"Procedures", "Catalog", "@Catalog", "SPECIFIC_CATALOG", 1}, |
||
325 | new object [] {"Procedures", "Owner", "@Owner", "SPECIFIC_SCHEMA", 2}, |
||
326 | new object [] {"Procedures", "Name", "@Name", "SPECIFIC_NAME", 3}, |
||
327 | new object [] {"Procedures", "Type", "@Type", "ROUTINE_TYPE", 4}, |
||
328 | |||
329 | new object [] {"IndexColumns", "Catalog", "@Catalog", "db_name(}", 1}, |
||
330 | new object [] {"IndexColumns", "Owner", "@Owner", "user_name(}", 2}, |
||
331 | new object [] {"IndexColumns", "Table", "@Table", "o.name", 3}, |
||
332 | new object [] {"IndexColumns", "ConstraintName", "@ConstraintName", "x.name", 4}, |
||
333 | new object [] {"IndexColumns", "Column", "@Column", "c.name", 5}, |
||
334 | |||
335 | new object [] {"Indexes", "Catalog", "@Catalog", "db_name(}", 1}, |
||
336 | new object [] {"Indexes", "Owner", "@Owner", "user_name(}", 2}, |
||
337 | new object [] {"Indexes", "Table", "@Table", "o.name", 3}, |
||
338 | new object [] {"Indexes", "Name", "@Name", "x.name", 4}, |
||
339 | |||
340 | new object [] {"UserDefinedTypes", "assembly_name", "@AssemblyName", "assemblies.name", 1}, |
||
341 | new object [] {"UserDefinedTypes", "udt_name", "@UDTName", "types.assembly_class", 2}, |
||
342 | |||
343 | new object [] {"ForeignKeys", "Catalog", "@Catalog", "CONSTRAINT_CATALOG", 1}, |
||
344 | new object [] {"ForeignKeys", "Owner", "@Owner", "CONSTRAINT_SCHEMA", 2}, |
||
345 | new object [] {"ForeignKeys", "Table", "@Table", "TABLE_NAME", 3}, |
||
346 | new object [] {"ForeignKeys", "Name", "@Name", "CONSTRAINT_NAME", 4} |
||
347 | }; |
||
348 | |||
349 | //static DataTable instance; |
||
350 | //static public DataTable Instance { |
||
351 | // get { |
||
352 | // if (instance == null) { |
||
353 | // instance = new DataTable ("Restrictions"); |
||
354 | // foreach (ColumnInfo c in columns) |
||
355 | // instance.Columns.Add (c.name, c.type); |
||
356 | // foreach (object [] row in rows) |
||
357 | // instance.LoadDataRow (row, true); |
||
358 | // } |
||
359 | // return instance; |
||
360 | // } |
||
361 | //} |
||
362 | } |
||
363 | |||
364 | static class ReservedWords |
||
365 | { |
||
366 | static readonly string [] reservedWords = |
||
367 | { |
||
368 | "ADD", "EXCEPT", "PERCENT", "ALL", "EXEC", "PLAN", "ALTER", |
||
369 | "EXECUTE", "PRECISION", "AND", "EXISTS", "PRIMARY", "ANY", |
||
370 | "EXIT", "PRINT", "AS", "FETCH", "PROC", "ASC", "FILE", |
||
371 | "PROCEDURE", "AUTHORIZATION", "FILLFACTOR", "PUBLIC", |
||
372 | "BACKUP", "FOR", "RAISERROR", "BEGIN", "FOREIGN", "READ", |
||
373 | "BETWEEN", "FREETEXT", "READTEXT", "BREAK", "FREETEXTTABLE", |
||
374 | "RECONFIGURE", "BROWSE", "FROM", "REFERENCES", "BULK", |
||
375 | "FULL", "REPLICATION", "BY", "FUNCTION", "RESTORE", |
||
376 | "CASCADE", "GOTO", "RESTRICT", "CASE", "GRANT", "RETURN", |
||
377 | "CHECK", "GROUP", "REVOKE", "CHECKPOINT", "HAVING", "RIGHT", |
||
378 | "CLOSE", "HOLDLOCK", "ROLLBACK", "CLUSTERED", "IDENTITY", |
||
379 | "ROWCOUNT", "COALESCE", "IDENTITY_INSERT", "ROWGUIDCOL", |
||
380 | "COLLATE", "IDENTITYCOL", "RULE", "COLUMN", "IF", "SAVE", |
||
381 | "COMMIT", "IN", "SCHEMA", "COMPUTE", "INDEX", "SELECT", |
||
382 | "CONSTRAINT", "INNER", "SESSION_USER", "CONTAINS", "INSERT", |
||
383 | "SET", "CONTAINSTABLE", "INTERSECT", "SETUSER", "CONTINUE", |
||
384 | "INTO", "SHUTDOWN", "CONVERT", "IS", "SOME", "CREATE", |
||
385 | "JOIN", "STATISTICS", "CROSS", "KEY", "SYSTEM_USER", |
||
386 | "CURRENT", "KILL", "TABLE", "CURRENT_DATE", "LEFT", |
||
387 | "TEXTSIZE", "CURRENT_TIME", "LIKE", "THEN", |
||
388 | "CURRENT_TIMESTAMP", "LINENO", "TO", "CURRENT_USER", "LOAD", |
||
389 | "TOP", "CURSOR", "NATIONAL", "TRAN", "DATABASE", "NOCHECK", |
||
390 | "TRANSACTION", "DBCC", "NONCLUSTERED", "TRIGGER", |
||
391 | "DEALLOCATE", "NOT", "TRUNCATE", "DECLARE", "NULL", |
||
392 | "TSEQUAL", "DEFAULT", "NULLIF", "UNION", "DELETE", "OF", |
||
393 | "UNIQUE", "DENY", "OFF", "UPDATE", "DESC", "OFFSETS", |
||
394 | "UPDATETEXT", "DISK", "ON", "USE", "DISTINCT", "OPEN", |
||
395 | "USER", "DISTRIBUTED", "OPENDATASOURCE", "VALUES", "DOUBLE", |
||
396 | "OPENQUERY", "VARYING", "DROP", "OPENROWSET", "VIEW", |
||
397 | "DUMMY", "OPENXML", "WAITFOR", "DUMP", "OPTION", "WHEN", |
||
398 | "ELSE", "OR", "WHERE", "END", "ORDER", "WHILE", "ERRLVL", |
||
399 | "OUTER", "WITH", "ESCAPE", "OVER", "WRITETEXT", "ABSOLUTE", |
||
400 | "FOUND", "PRESERVE", "ACTION", "FREE", "PRIOR", "ADMIN", |
||
401 | "GENERAL", "PRIVILEGES", "AFTER", "GET", "READS", |
||
402 | "AGGREGATE", "GLOBAL", "REAL", "ALIAS", "GO", "RECURSIVE", |
||
403 | "ALLOCATE", "GROUPING", "REF", "ARE", "HOST", "REFERENCING", |
||
404 | "ARRAY", "HOUR", "RELATIVE", "ASSERTION", "IGNORE", "RESULT", |
||
405 | "AT", "IMMEDIATE", "RETURNS", "BEFORE", "INDICATOR", "ROLE", |
||
406 | "BINARY", "INITIALIZE", "ROLLUP", "BIT", "INITIALLY", |
||
407 | "ROUTINE", "BLOB", "INOUT", "ROW", "BOOLEAN", "INPUT", |
||
408 | "ROWS", "BOTH", "INT", "SAVEPOINT", "BREADTH", "INTEGER", |
||
409 | "SCROLL", "CALL", "INTERVAL", "SCOPE", "CASCADED", |
||
410 | "ISOLATION", "SEARCH", "CAST", "ITERATE", "SECOND", |
||
411 | "CATALOG", "LANGUAGE", "SECTION", "CHAR", "LARGE", |
||
412 | "SEQUENCE", "CHARACTER", "LAST", "SESSION", "CLASS", |
||
413 | "LATERAL", "SETS", "CLOB", "LEADING", "SIZE", "COLLATION", |
||
414 | "LESS", "SMALLINT", "COMPLETION", "LEVEL", "SPACE", |
||
415 | "CONNECT", "LIMIT", "SPECIFIC", "CONNECTION", "LOCAL", |
||
416 | "SPECIFICTYPE", "CONSTRAINTS", "LOCALTIME", "SQL", |
||
417 | "CONSTRUCTOR", "LOCALTIMESTAMP", "SQLEXCEPTION", |
||
418 | "CORRESPONDING", "LOCATOR", "SQLSTATE", "CUBE", "MAP", |
||
419 | "SQLWARNING", "CURRENT_PATH", "MATCH", "START", |
||
420 | "CURRENT_ROLE", "MINUTE", "STATE", "CYCLE", "MODIFIES", |
||
421 | "STATEMENT", "DATA", "MODIFY", "STATIC", "DATE", "MODULE", |
||
422 | "STRUCTURE", "DAY", "MONTH", "TEMPORARY", "DEC", "NAMES", |
||
423 | "TERMINATE", "DECIMAL", "NATURAL", "THAN", "DEFERRABLE", |
||
424 | "NCHAR", "TIME", "DEFERRED", "NCLOB", "TIMESTAMP", "DEPTH", |
||
425 | "NEW", "TIMEZONE_HOUR", "DEREF", "NEXT", "TIMEZONE_MINUTE", |
||
426 | "DESCRIBE", "NO", "TRAILING", "DESCRIPTOR", "NONE", |
||
427 | "TRANSLATION", "DESTROY", "NUMERIC", "TREAT", "DESTRUCTOR", |
||
428 | "OBJECT", "TRUE", "DETERMINISTIC", "OLD", "UNDER", |
||
429 | "DICTIONARY", "ONLY", "UNKNOWN", "DIAGNOSTICS", "OPERATION", |
||
430 | "UNNEST", "DISCONNECT", "ORDINALITY", "USAGE", "DOMAIN", |
||
431 | "OUT", "USING", "DYNAMIC", "OUTPUT", "VALUE", "EACH", |
||
432 | "PAD", "VARCHAR", "END-EXEC", "PARAMETER", "VARIABLE", |
||
433 | "EQUALS", "PARAMETERS", "WHENEVER", "EVERY", "PARTIAL", |
||
434 | "WITHOUT", "EXCEPTION", "PATH", "WORK", "EXTERNAL", |
||
435 | "POSTFIX", "WRITE", "FALSE", "PREFIX", "YEAR", "FIRST", |
||
436 | "PREORDER", "ZONE", "FLOAT", "PREPARE", "ADA", "AVG", |
||
437 | "BIT_LENGTH", "CHAR_LENGTH", "CHARACTER_LENGTH", "COUNT", |
||
438 | "EXTRACT", "FORTRAN", "INCLUDE", "INSENSITIVE", "LOWER", |
||
439 | "MAX", "MIN", "OCTET_LENGTH", "OVERLAPS", "PASCAL", |
||
440 | "POSITION", "SQLCA", "SQLCODE", "SQLERROR", "SUBSTRING", |
||
441 | "SUM", "TRANSLATE", "TRIM", "UPPER" |
||
442 | }; |
||
443 | //static DataTable instance; |
||
444 | //static public DataTable Instance { |
||
445 | // get { |
||
446 | // if (instance == null) { |
||
447 | // DataRow row = null; |
||
448 | // instance = new DataTable ("ReservedWords"); |
||
449 | // instance.Columns.Add ("ReservedWord", typeof(string)); |
||
450 | // foreach (string reservedWord in reservedWords) |
||
451 | // { |
||
452 | // row = instance.NewRow(); |
||
453 | |||
454 | // row["ReservedWord"] = reservedWord; |
||
455 | // instance.Rows.Add(row); |
||
456 | // } |
||
457 | // } |
||
458 | // return instance; |
||
459 | // } |
||
460 | //} |
||
461 | } |
||
462 | |||
463 | //public virtual DataTable GetSchema () |
||
464 | //{ |
||
465 | // return MetaDataCollections.Instance; |
||
466 | //} |
||
467 | |||
468 | //public virtual DataTable GetSchema (string collectionName) |
||
469 | //{ |
||
470 | // return GetSchema (collectionName, null); |
||
471 | //} |
||
472 | |||
473 | private void AddParameter (DbCommand command, string parameterName, DbType parameterType, int parameterSize) |
||
474 | { |
||
475 | DbParameter parameter = command.CreateParameter (); |
||
476 | parameter.ParameterName = parameterName; |
||
477 | parameter.DbType = parameterType; |
||
478 | parameter.Size = parameterSize; |
||
479 | command.Parameters.Add (parameter); |
||
480 | } |
||
481 | |||
482 | // public virtual DataTable GetSchema (string collectionName, string[] restrictionValues) |
||
483 | // { |
||
484 | // if (collectionName == null) |
||
485 | // //LAMESPEC: In MS.NET, if collectionName is null, it throws ArgumentException. |
||
486 | // throw new ArgumentException (); |
||
487 | |||
488 | // String cName = null; |
||
489 | // DataTable schemaTable = MetaDataCollections.Instance; |
||
490 | // int length = restrictionValues == null ? 0 : restrictionValues.Length; |
||
491 | |||
492 | // foreach (DataRow row in schemaTable.Rows) { |
||
493 | // if (String.Compare ((string) row ["CollectionName"], collectionName, true) == 0) { |
||
494 | // if (length > (int) row ["NumberOfRestrictions"]) { |
||
495 | // throw new ArgumentException ("More restrictions were provided " + |
||
496 | // "than the requested schema ('" + |
||
497 | // row ["CollectionName"].ToString () + "') supports"); |
||
498 | // } |
||
499 | // cName = row ["CollectionName"].ToString (); |
||
500 | // } |
||
501 | // } |
||
502 | // if (cName == null) |
||
503 | // throw new ArgumentException ("The requested collection ('" + collectionName + "') is not defined."); |
||
504 | |||
505 | // DbCommand command = null; |
||
506 | // DataTable dataTable = new DataTable (); |
||
507 | |||
508 | // switch (cName) |
||
509 | // { |
||
510 | // case "Databases": |
||
511 | // command = CreateCommand (); |
||
512 | // command.Connection = this; |
||
513 | // command.CommandText = "select name as database_name, dbid, crdate as create_date " + |
||
514 | // "from master.sys.sysdatabases where (name = @Name or (@Name " + |
||
515 | // "is null))"; |
||
516 | // AddParameter (command, "@Name", DbType.StringFixedLength, 4000); |
||
517 | // break; |
||
518 | // case "ForeignKeys": |
||
519 | // command = CreateCommand (); |
||
520 | // command.Connection = this; |
||
521 | // command.CommandText = "select CONSTRAINT_CATALOG, CONSTRAINT_SCHEMA, CONSTRAINT_NAME, " + |
||
522 | // "TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, CONSTRAINT_TYPE, " + |
||
523 | // "IS_DEFERRABLE, INITIALLY_DEFERRED from " + |
||
524 | // "INFORMATION_SCHEMA.TABLE_CONSTRAINTS where (CONSTRAINT_CATALOG" + |
||
525 | // " = @Catalog or (@Catalog is null)) and (CONSTRAINT_SCHEMA = " + |
||
526 | // "@Owner or (@Owner is null)) and (TABLE_NAME = @Table or (" + |
||
527 | // "@Table is null)) and (CONSTRAINT_NAME = @Name or (@Name is null))" + |
||
528 | // " and CONSTRAINT_TYPE = 'FOREIGN KEY' order by CONSTRAINT_CATALOG," + |
||
529 | // " CONSTRAINT_SCHEMA, CONSTRAINT_NAME"; |
||
530 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
531 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
532 | // AddParameter (command, "@Table", DbType.StringFixedLength, 4000); |
||
533 | // AddParameter (command, "@Name", DbType.StringFixedLength, 4000); |
||
534 | // break; |
||
535 | // case "Indexes": |
||
536 | // command = CreateCommand (); |
||
537 | // command.Connection = this; |
||
538 | // command.CommandText = "select distinct db_name() as constraint_catalog, " + |
||
539 | // "constraint_schema = user_name (o.uid), " + |
||
540 | // "constraint_name = x.name, table_catalog = db_name (), " + |
||
541 | // "table_schema = user_name (o.uid), table_name = o.name, " + |
||
542 | // "index_name = x.name from sysobjects o, sysindexes x, " + |
||
543 | // "sysindexkeys xk where o.type in ('U') and x.id = o.id and " + |
||
544 | // "o.id = xk.id and x.indid = xk.indid and xk.keyno = x.keycnt " + |
||
545 | // "and (db_name() = @Catalog or (@Catalog is null)) and " + |
||
546 | // "(user_name() = @Owner or (@Owner is null)) and (o.name = " + |
||
547 | // "@Table or (@Table is null)) and (x.name = @Name or (@Name is null))" + |
||
548 | // "order by table_name, index_name"; |
||
549 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
550 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
551 | // AddParameter (command, "@Table", DbType.StringFixedLength, 4000); |
||
552 | // AddParameter (command, "@Name", DbType.StringFixedLength, 4000); |
||
553 | // break; |
||
554 | // case "IndexColumns": |
||
555 | // command = CreateCommand (); |
||
556 | // command.Connection = this; |
||
557 | // command.CommandText = "select distinct db_name() as constraint_catalog, " + |
||
558 | // "constraint_schema = user_name (o.uid), constraint_name = x.name, " + |
||
559 | // "table_catalog = db_name (), table_schema = user_name (o.uid), " + |
||
560 | // "table_name = o.name, column_name = c.name, " + |
||
561 | // "ordinal_position = convert (int, xk.keyno), keyType = c.xtype, " + |
||
562 | // "index_name = x.name from sysobjects o, sysindexes x, syscolumns c, " + |
||
563 | // "sysindexkeys xk where o.type in ('U') and x.id = o.id and o.id = c.id " + |
||
564 | // "and o.id = xk.id and x.indid = xk.indid and c.colid = xk.colid " + |
||
565 | // "and xk.keyno <= x.keycnt and permissions (o.id, c.name) <> 0 " + |
||
566 | // "and (db_name() = @Catalog or (@Catalog is null)) and (user_name() " + |
||
567 | // "= @Owner or (@Owner is null)) and (o.name = @Table or (@Table is" + |
||
568 | // " null)) and (x.name = @ConstraintName or (@ConstraintName is null)) " + |
||
569 | // "and (c.name = @Column or (@Column is null)) order by table_name, " + |
||
570 | // "index_name"; |
||
571 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 8); |
||
572 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
573 | // AddParameter (command, "@Table", DbType.StringFixedLength, 13); |
||
574 | // AddParameter (command, "@ConstraintName", DbType.StringFixedLength, 4000); |
||
575 | // AddParameter (command, "@Column", DbType.StringFixedLength, 4000); |
||
576 | // break; |
||
577 | // case "Procedures": |
||
578 | // command = CreateCommand (); |
||
579 | // command.Connection = this; |
||
580 | // command.CommandText = "select SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME, " + |
||
581 | // "ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE, " + |
||
582 | // "CREATED, LAST_ALTERED from INFORMATION_SCHEMA.ROUTINES where " + |
||
583 | // "(SPECIFIC_CATALOG = @Catalog or (@Catalog is null)) and " + |
||
584 | // "(SPECIFIC_SCHEMA = @Owner or (@Owner is null)) and (SPECIFIC_NAME" + |
||
585 | // " = @Name or (@Name is null)) and (ROUTINE_TYPE = @Type or (@Type " + |
||
586 | // "is null)) order by SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME"; |
||
587 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
588 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
589 | // AddParameter (command, "@Name", DbType.StringFixedLength, 4000); |
||
590 | // AddParameter (command, "@Type", DbType.StringFixedLength, 4000); |
||
591 | // break; |
||
592 | // case "ProcedureParameters": |
||
593 | // command = CreateCommand (); |
||
594 | // command.Connection = this; |
||
595 | // command.CommandText = "select SPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAME, " + |
||
596 | // "ORDINAL_POSITION, PARAMETER_MODE, IS_RESULT, AS_LOCATOR, " + |
||
597 | // "PARAMETER_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, " + |
||
598 | // "CHARACTER_OCTET_LENGTH, COLLATION_CATALOG, COLLATION_SCHEMA, " + |
||
599 | // "COLLATION_NAME, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, " + |
||
600 | // "CHARACTER_SET_NAME, NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, " + |
||
601 | // "NUMERIC_SCALE, DATETIME_PRECISION, INTERVAL_TYPE, " + |
||
602 | // "INTERVAL_PRECISION from INFORMATION_SCHEMA.PARAMETERS where " + |
||
603 | // "(SPECIFIC_CATALOG = @Catalog or (@Catalog is null)) and " + |
||
604 | // "(SPECIFIC_SCHEMA = @Owner or (@Owner is null)) and (SPECIFIC_NAME = " + |
||
605 | // "@Name or (@Name is null)) and (PARAMETER_NAME = @Parameter or (" + |
||
606 | // "@Parameter is null)) order by SPECIFIC_CATALOG, SPECIFIC_SCHEMA," + |
||
607 | // " SPECIFIC_NAME, PARAMETER_NAME"; |
||
608 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
609 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
610 | // AddParameter (command, "@Name", DbType.StringFixedLength, 4000); |
||
611 | // AddParameter (command, "@Parameter", DbType.StringFixedLength, 4000); |
||
612 | // break; |
||
613 | // case "Tables": |
||
614 | // command = CreateCommand (); |
||
615 | // command.Connection = this; |
||
616 | // command.CommandText = "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE " + |
||
617 | // "from INFORMATION_SCHEMA.TABLES where" + |
||
618 | // " (TABLE_CATALOG = @catalog or (@catalog is null)) and " + |
||
619 | // "(TABLE_SCHEMA = @owner or (@owner is null))and " + |
||
620 | // "(TABLE_NAME = @name or (@name is null)) and " + |
||
621 | // "(TABLE_TYPE = @table_type or (@table_type is null))"; |
||
622 | // AddParameter (command, "@catalog", DbType.StringFixedLength, 8); |
||
623 | // AddParameter (command, "@owner", DbType.StringFixedLength, 3); |
||
624 | // AddParameter (command, "@name", DbType.StringFixedLength, 11); |
||
625 | // AddParameter (command, "@table_type", DbType.StringFixedLength, 10); |
||
626 | // break; |
||
627 | // case "Columns": |
||
628 | // command = CreateCommand (); |
||
629 | // command.Connection = this; |
||
630 | // command.CommandText = "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, " + |
||
631 | // "ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, " + |
||
632 | // "CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH, " + |
||
633 | // "NUMERIC_PRECISION, NUMERIC_PRECISION_RADIX, NUMERIC_SCALE, " + |
||
634 | // "DATETIME_PRECISION, CHARACTER_SET_CATALOG, CHARACTER_SET_SCHEMA, " + |
||
635 | // "CHARACTER_SET_NAME, COLLATION_CATALOG from INFORMATION_SCHEMA.COLUMNS" + |
||
636 | // " where (TABLE_CATALOG = @Catalog or (@Catalog is null)) and (" + |
||
637 | // "TABLE_SCHEMA = @Owner or (@Owner is null)) and (TABLE_NAME = @table" + |
||
638 | // " or (@Table is null)) and (COLUMN_NAME = @column or (@Column is null" + |
||
639 | // ")) order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME"; |
||
640 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
641 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
642 | // AddParameter (command, "@Table", DbType.StringFixedLength, 4000); |
||
643 | // AddParameter (command, "@Column", DbType.StringFixedLength, 4000); |
||
644 | // break; |
||
645 | // case "Users": |
||
646 | // command = CreateCommand (); |
||
647 | // command.Connection = this; |
||
648 | // command.CommandText = "select uid, name as user_name, createdate, updatedate from sysusers" + |
||
649 | // " where (name = @Name or (@Name is null))"; |
||
650 | // AddParameter (command, "@Name", DbType.StringFixedLength, 4000); |
||
651 | // break; |
||
652 | // case "Views": |
||
653 | // command = CreateCommand (); |
||
654 | // command.Connection = this; |
||
655 | // command.CommandText = "select TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, CHECK_OPTION, " + |
||
656 | // "IS_UPDATABLE from INFORMATION_SCHEMA.VIEWS where (TABLE_CATALOG" + |
||
657 | // " = @Catalog or (@Catalog is null)) TABLE_SCHEMA = @Owner or " + |
||
658 | // "(@Owner is null)) and (TABLE_NAME = @table or (@Table is null))" + |
||
659 | // " order by TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME"; |
||
660 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
661 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
662 | // AddParameter (command, "@Table", DbType.StringFixedLength, 4000); |
||
663 | // break; |
||
664 | // case "ViewColumns": |
||
665 | // command = CreateCommand (); |
||
666 | // command.Connection = this; |
||
667 | // command.CommandText = "select VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME, TABLE_CATALOG, " + |
||
668 | // "TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME from " + |
||
669 | // "INFORMATION_SCHEMA.VIEW_COLUMN_USAGE where (VIEW_CATALOG = " + |
||
670 | // "@Catalog (@Catalog is null)) and (VIEW_SCHEMA = @Owner (@Owner" + |
||
671 | // " is null)) and (VIEW_NAME = @Table or (@Table is null)) and " + |
||
672 | // "(COLUMN_NAME = @Column or (@Column is null)) order by " + |
||
673 | // "VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME"; |
||
674 | // AddParameter (command, "@Catalog", DbType.StringFixedLength, 4000); |
||
675 | // AddParameter (command, "@Owner", DbType.StringFixedLength, 4000); |
||
676 | // AddParameter (command, "@Table", DbType.StringFixedLength, 4000); |
||
677 | // AddParameter (command, "@Column", DbType.StringFixedLength, 4000); |
||
678 | // break; |
||
679 | // case "UserDefinedTypes": |
||
680 | // command = CreateCommand (); |
||
681 | // command.Connection = this; |
||
682 | // command.CommandText = "select assemblies.name as assembly_name, types.assembly_class " + |
||
683 | // "as udt_name, ASSEMBLYPROPERTY(assemblies.name, 'VersionMajor') " + |
||
684 | // "as version_major, ASSEMBLYPROPERTY(assemblies.name, 'VersionMinor') " + |
||
685 | // "as version_minor, ASSEMBLYPROPERTY(assemblies.name, 'VersionBuild') " + |
||
686 | // "as version_build, ASSEMBLYPROPERTY(assemblies.name, 'VersionRevision') " + |
||
687 | // "as version_revision, ASSEMBLYPROPERTY(assemblies.name, 'CultureInfo') " + |
||
688 | // "as culture_info, ASSEMBLYPROPERTY(assemblies.name, 'PublicKey') " + |
||
689 | // "as public_key, is_fixed_length, max_length, Create_Date, " + |
||
690 | // "Permission_set_desc from sys.assemblies as assemblies join " + |
||
691 | // "sys.assembly_types as types on assemblies.assembly_id = types.assembly_id" + |
||
692 | // " where (assemblies.name = @AssemblyName or (@AssemblyName is null)) and " + |
||
693 | // "(types.assembly_class = @UDTName or (@UDTName is null))"; |
||
694 | // AddParameter (command, "@AssemblyName", DbType.StringFixedLength, 4000); |
||
695 | // AddParameter (command, "@UDTName", DbType.StringFixedLength, 4000); |
||
696 | // break; |
||
697 | // case "MetaDataCollections": |
||
698 | // return MetaDataCollections.Instance; |
||
699 | // case "DataSourceInformation": |
||
700 | // throw new NotImplementedException (); |
||
701 | // case "DataTypes": |
||
702 | // return DataTypes.Instance; |
||
703 | // case "ReservedWords": |
||
704 | // return ReservedWords.Instance; |
||
705 | // case "Restrictions": |
||
706 | // return Restrictions.Instance; |
||
707 | // } |
||
708 | // for (int i = 0; i < length; i++) { |
||
709 | // command.Parameters [i].Value = restrictionValues [i]; |
||
710 | // } |
||
711 | // DbDataAdapter dataAdapter = DbProviderFactory.CreateDataAdapter (); |
||
712 | // dataAdapter.SelectCommand = command; |
||
713 | // dataAdapter.Fill (dataTable); |
||
714 | // return dataTable; |
||
715 | // } |
||
716 | |||
717 | // protected virtual DbProviderFactory DbProviderFactory { |
||
718 | //#if MOBILE |
||
719 | // get {throw new NotImplementedException();} |
||
720 | //#else |
||
721 | // get { return DbProviderFactories.GetFactory (this.GetType (). ToString ()); } |
||
722 | //#endif |
||
723 | // } |
||
724 | //#endif |
||
725 | |||
726 | IDbTransaction IDbConnection.BeginTransaction () |
||
727 | { |
||
728 | return BeginTransaction (); |
||
729 | } |
||
730 | |||
731 | IDbTransaction IDbConnection.BeginTransaction (IsolationLevel il) |
||
732 | { |
||
733 | return BeginTransaction (il); |
||
734 | } |
||
735 | |||
736 | IDbCommand IDbConnection.CreateCommand () |
||
737 | { |
||
738 | return CreateCommand (); |
||
739 | } |
||
740 | |||
741 | public abstract void Open (); |
||
742 | |||
743 | //protected virtual void OnStateChange (StateChangeEventArgs stateChanged) |
||
744 | //{ |
||
745 | // if (StateChange != null) |
||
746 | // StateChange (this, stateChanged); |
||
747 | //} |
||
748 | |||
749 | #endregion // Methods |
||
750 | |||
751 | //public virtual event StateChangeEventHandler StateChange; |
||
752 | |||
753 | |||
754 | #region IDisposable Members |
||
755 | |||
756 | public void Dispose() |
||
757 | { |
||
758 | Dispose(true); |
||
759 | GC.SuppressFinalize(this); |
||
760 | } |
||
761 | |||
762 | // <summary> |
||
763 | // Controls disposal of resources used by this. |
||
764 | // </summary> |
||
765 | // |
||
766 | // <param name="release_all"> Controls which resources are released</param> |
||
767 | // |
||
768 | // <remarks> |
||
769 | // if release_all is set to true, both managed and unmanaged |
||
770 | // resources should be released. If release_all is set to false, |
||
771 | // only unmanaged resources should be disposed |
||
772 | // </remarks> |
||
773 | protected virtual void Dispose(bool release_all) |
||
774 | { |
||
775 | //if (release_all) |
||
776 | //{ |
||
777 | // if (mySite != null && mySite.Container != null) |
||
778 | // mySite.Container.Remove(this); |
||
779 | // EventHandler eh = (EventHandler)Events[disposedEvent]; |
||
780 | // if (eh != null) |
||
781 | // eh(this, EventArgs.Empty); |
||
782 | //} |
||
783 | } |
||
784 | |||
785 | #endregion |
||
786 | } |
||
787 | } |
||
788 | |||
789 |