Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When marshalling from/to the SQLiteIndex class, only marshal data members of the needed direction. The SQLiteVirtualTableCursorEnumerable class should implement the IDisposable pattern. More work on docs. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | virtualTables |
Files: | files | file ages | folders |
SHA1: |
c6a8523c45e9e39ecf08492d4d991255 |
User & Date: | mistachkin 2013-06-25 09:53:48.058 |
Context
2013-06-25
| ||
11:55 | First attempt at making virtual table support work on the .NET Compact Framework. check-in: 78e8297a83 user: mistachkin tags: virtualTables | |
09:53 | When marshalling from/to the SQLiteIndex class, only marshal data members of the needed direction. The SQLiteVirtualTableCursorEnumerable class should implement the IDisposable pattern. More work on docs. check-in: c6a8523c45 user: mistachkin tags: virtualTables | |
08:24 | Move byte array handling methods to the SQLiteBytes class. Remove superfluous ValueArrayFromSizeAndIntPtr method from the SQLiteMarshal class. More work on docs. check-in: 75dd5c847a user: mistachkin tags: virtualTables | |
Changes
Changes to System.Data.SQLite/SQLiteModule.cs.
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | /////////////////////////////////////////////////////////////////////////// #region SQLiteVirtualTable Base Class /// <summary> /// This class represents a managed virtual table implementation. It is /// not sealed and should be used as the base class for any user-defined | | | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 | /////////////////////////////////////////////////////////////////////////// #region SQLiteVirtualTable Base Class /// <summary> /// This class represents a managed virtual table implementation. It is /// not sealed and should be used as the base class for any user-defined /// virtual table classes implemented in managed code. /// </summary> public class SQLiteVirtualTable : ISQLiteNativeHandle, IDisposable /* NOT SEALED */ { #region Private Constants /// <summary> /// The index within the array of strings provided to the |
︙ | ︙ | |||
1333 1334 1335 1336 1337 1338 1339 | /////////////////////////////////////////////////////////////////////////// #region SQLiteVirtualTableCursor Base Class /// <summary> /// This class represents a managed virtual table cursor implementation. /// It is not sealed and should be used as the base class for any | | | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | /////////////////////////////////////////////////////////////////////////// #region SQLiteVirtualTableCursor Base Class /// <summary> /// This class represents a managed virtual table cursor implementation. /// It is not sealed and should be used as the base class for any /// user-defined virtual table cursor classes implemented in managed code. /// </summary> public class SQLiteVirtualTableCursor : ISQLiteNativeHandle, IDisposable /* NOT SEALED */ { #region Public Constructors /// <summary> /// Constructs an instance of this class. |
︙ | ︙ | |||
4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 | #endif } #endregion /////////////////////////////////////////////////////////////////////// #region SQLiteValue Helper Methods public static SQLiteValue[] ValueArrayFromIntPtrArray( IntPtr[] values ) { if (values == null) return null; SQLiteValue[] result = new SQLiteValue[values.Length]; for (int index = 0; index < result.Length; index++) result[index] = new SQLiteValue(values[index]); return result; } #endregion /////////////////////////////////////////////////////////////////////// #region SQLiteIndex Helper Methods public static void IndexFromIntPtr( IntPtr pIndex, ref SQLiteIndex index ) { if (pIndex == IntPtr.Zero) return; int offset = 0; int nConstraint = ReadInt32(pIndex, offset); offset += sizeof(int); IntPtr pConstraint = ReadIntPtr(pIndex, offset); offset += IntPtr.Size; int nOrderBy = ReadInt32(pIndex, offset); | > > > > > > > > > > > > > > > > > > > > > > > > < < < | < < < < < < < < < < < < < < < < < < < < < < | 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 | #endif } #endregion /////////////////////////////////////////////////////////////////////// #region SQLiteValue Helper Methods /// <summary> /// Converts an array of native pointers to native sqlite3_value /// structures into a managed array of <see cref="SQLiteValue" /> /// object instances. /// </summary> /// <param name="values"> /// The array of native pointers to convert. /// </param> /// <returns> /// The managed array of <see cref="SQLiteValue" /> object instances or /// null upon failure. /// </returns> public static SQLiteValue[] ValueArrayFromIntPtrArray( IntPtr[] values ) { if (values == null) return null; SQLiteValue[] result = new SQLiteValue[values.Length]; for (int index = 0; index < result.Length; index++) result[index] = new SQLiteValue(values[index]); return result; } #endregion /////////////////////////////////////////////////////////////////////// #region SQLiteIndex Helper Methods /// <summary> /// Converts a native pointer to a native sqlite3_index_info structure /// into a new <see cref="SQLiteIndex" /> object instance. /// </summary> /// <param name="pIndex"> /// The native pointer to the native sqlite3_index_info structure to /// convert. /// </param> /// <param name="index"> /// Upon success, this parameter will be modified to contain the newly /// created <see cref="SQLiteIndex" /> object instance. /// </param> public static void IndexFromIntPtr( IntPtr pIndex, ref SQLiteIndex index ) { if (pIndex == IntPtr.Zero) return; int offset = 0; int nConstraint = ReadInt32(pIndex, offset); offset += sizeof(int); IntPtr pConstraint = ReadIntPtr(pIndex, offset); offset += IntPtr.Size; int nOrderBy = ReadInt32(pIndex, offset); offset += sizeof(int); IntPtr pOrderBy = ReadIntPtr(pIndex, offset); index = new SQLiteIndex(nConstraint, nOrderBy); int sizeOfConstraintType = Marshal.SizeOf(typeof( UnsafeNativeMethods.sqlite3_index_constraint)); for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++) { UnsafeNativeMethods.sqlite3_index_constraint constraint = |
︙ | ︙ | |||
4157 4158 4159 4160 4161 4162 4163 | Marshal.PtrToStructure(IntPtrForOffset(pOrderBy, iOrderBy * sizeOfOrderByType), orderBy); index.Inputs.OrderBys[iOrderBy] = new SQLiteIndexOrderBy(orderBy); } | < < < < < < < < < < < < < < < > > > > > > > > > > > > > | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > | 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 | Marshal.PtrToStructure(IntPtrForOffset(pOrderBy, iOrderBy * sizeOfOrderByType), orderBy); index.Inputs.OrderBys[iOrderBy] = new SQLiteIndexOrderBy(orderBy); } } /////////////////////////////////////////////////////////////////////// /// <summary> /// Populates the outputs of a pre-allocated native sqlite3_index_info /// structure using an existing <see cref="SQLiteIndex" /> object /// instance. /// </summary> /// <param name="index"> /// The existing <see cref="SQLiteIndex" /> object instance containing /// the output data to use. /// </param> /// <param name="pIndex"> /// The native pointer to the pre-allocated native sqlite3_index_info /// structure. /// </param> public static void IndexToIntPtr( SQLiteIndex index, IntPtr pIndex ) { if ((index == null) || (index.Inputs == null) || (index.Inputs.Constraints == null) || (index.Outputs == null) || (index.Outputs.ConstraintUsages == null)) { return; } if (pIndex == IntPtr.Zero) return; int offset = 0; int nConstraint = ReadInt32(pIndex, offset); if (nConstraint != index.Inputs.Constraints.Length) return; if (nConstraint != index.Outputs.ConstraintUsages.Length) return; offset += sizeof(int) + IntPtr.Size + sizeof(int) + IntPtr.Size; IntPtr pConstraintUsage = ReadIntPtr(pIndex, offset); int sizeOfConstraintUsageType = Marshal.SizeOf(typeof( UnsafeNativeMethods.sqlite3_index_constraint_usage)); for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++) { UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage = new UnsafeNativeMethods.sqlite3_index_constraint_usage( index.Outputs.ConstraintUsages[iConstraint]); Marshal.StructureToPtr( constraintUsage, IntPtrForOffset(pConstraintUsage, iConstraint * sizeOfConstraintUsageType), false); index.Outputs.ConstraintUsages[iConstraint] = new SQLiteIndexConstraintUsage(constraintUsage); } offset += IntPtr.Size; WriteInt32(pIndex, offset, index.Outputs.IndexNumber); offset += sizeof(int); WriteIntPtr(pIndex, offset, SQLiteString.Utf8IntPtrFromString( index.Outputs.IndexString)); offset += IntPtr.Size; WriteInt32(pIndex, offset, 1); /* NOTE: We just allocated it. */ offset += sizeof(int); WriteInt32(pIndex, offset, index.Outputs.OrderByConsumed); offset += sizeof(int); WriteDouble(pIndex, offset, index.Outputs.EstimatedCost); } #endregion } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteModule Base Class /// <summary> /// This class represents a managed virtual table module implementation. /// It is not sealed and must be used as the base class for any /// user-defined virtual table module classes implemented in managed code. /// </summary> public abstract class SQLiteModule : ISQLiteManagedModule, /*ISQLiteNativeModule,*/ IDisposable /* NOT SEALED */ { #region SQLiteNativeModule Private Class private sealed class SQLiteNativeModule : ISQLiteNativeModule, IDisposable |
︙ | ︙ | |||
5163 5164 5165 5166 5167 5168 5169 | /////////////////////////////////////////////////////////////////////// #region Public Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="name"> | | | 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 | /////////////////////////////////////////////////////////////////////// #region Public Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="name"> /// The name of the module. This parameter cannot be null. /// </param> public SQLiteModule(string name) { if (name == null) throw new ArgumentNullException("name"); this.name = name; |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteModuleEnumerable.cs.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Joe Mistachkin (joe@mistachkin.com) * * Released to the public domain, use at your own risk! ********************************************************/ using System.Collections; using System.Globalization; namespace System.Data.SQLite { #region SQLiteVirtualTableCursorEnumerable Class | | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > < > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Joe Mistachkin (joe@mistachkin.com) * * Released to the public domain, use at your own risk! ********************************************************/ using System.Collections; using System.Globalization; namespace System.Data.SQLite { #region SQLiteVirtualTableCursorEnumerable Class /// <summary> /// This class represents a virtual table cursor to be used with the /// <see cref="SQLiteModuleEnumerable" /> class. It is not sealed and may /// be used as the base class for any user-defined virtual table cursor /// class that wraps an <see cref="IEnumerator" /> object instance. /// </summary> public class SQLiteVirtualTableCursorEnumerable : SQLiteVirtualTableCursor /* NOT SEALED */ { #region Private Data /// <summary> /// The <see cref="IEnumerator" /> instance provided when this cursor /// was created. /// </summary> private IEnumerator enumerator; /////////////////////////////////////////////////////////////////////// /// <summary> /// This value will be non-zero if false has been returned from the /// <see cref="IEnumerator.MoveNext"/> method. /// </summary> private bool endOfEnumerator; #endregion /////////////////////////////////////////////////////////////////////// #region Public Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this object instance. /// </param> /// <param name="enumerator"> /// The <see cref="IEnumerator" /> instance to expose as a virtual /// table cursor. /// </param> public SQLiteVirtualTableCursorEnumerable( SQLiteVirtualTable table, IEnumerator enumerator ) : base(table) { this.enumerator = enumerator; this.endOfEnumerator = true; } #endregion /////////////////////////////////////////////////////////////////////// #region Public Members /// <summary> /// Advances to the next row of the virtual table cursor using the /// <see cref="IEnumerator.MoveNext" /> method of the /// <see cref="IEnumerator" /> object instance. /// </summary> /// <returns> /// Non-zero if the current row is valid; zero otherwise. If zero is /// returned, no further rows are available. /// </returns> public virtual bool MoveNext() { CheckDisposed(); if (enumerator == null) return false; endOfEnumerator = !enumerator.MoveNext(); return !endOfEnumerator; } /////////////////////////////////////////////////////////////////////// /// <summary> /// Returns the value for the current row of the virtual table cursor /// using the <see cref="IEnumerator.Current" /> property of the /// <see cref="IEnumerator" /> object instance. /// </summary> public virtual object Current { get { CheckDisposed(); if (enumerator == null) return null; return enumerator.Current; } } /////////////////////////////////////////////////////////////////////// /// <summary> /// Resets the virtual table cursor position, also invalidating the /// current row, using the <see cref="IEnumerator.Reset" /> method of /// the <see cref="IEnumerator" /> object instance. /// </summary> public virtual void Reset() { CheckDisposed(); if (enumerator == null) return; enumerator.Reset(); } /////////////////////////////////////////////////////////////////////// /// <summary> /// Returns non-zero if the end of the virtual table cursor has been /// seen (i.e. no more rows are available, including the current one). /// </summary> public virtual bool EndOfEnumerator { get { CheckDisposed(); return endOfEnumerator; } } /////////////////////////////////////////////////////////////////////// /// <summary> /// Closes the virtual table cursor. /// </summary> public virtual void Close() { // CheckDisposed(); if (enumerator != null) enumerator = null; } #endregion /////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; /// <summary> /// Throws an <see cref="ObjectDisposedException"/> if this object /// instance has been disposed. /// </summary> private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) { throw new ObjectDisposedException( typeof(SQLiteVirtualTableCursorEnumerable).Name); } #endif } /////////////////////////////////////////////////////////////////////// /// <summary> /// Disposes of this object instance. /// </summary> /// <param name="disposing"> /// Non-zero if this method is being called from the /// <see cref="IDisposable.Dispose" /> method. Zero if this method is /// being called from the finalizer. /// </param> protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) //{ // //////////////////////////////////// // // dispose managed resources here... // //////////////////////////////////// //} ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// Close(); disposed = true; } } finally { base.Dispose(disposing); } } #endregion } #endregion /////////////////////////////////////////////////////////////////////////// #region SQLiteModuleEnumerable Class /// <summary> /// This class implements a virtual table module that exposes an /// IEnumerable instance as a read-only virtual table. It is not sealed /// and may be used as the base class for any user-defined virtual table /// class that wraps an <see cref="IEnumerable" /> object instance. /// </summary> public class SQLiteModuleEnumerable : SQLiteModuleNoop /* NOT SEALED */ { #region Private Constants /// <summary> /// The CREATE TABLE statement used to declare the schema for the /// virtual table. /// </summary> private static readonly string declareSql = String.Format( CultureInfo.CurrentCulture, "CREATE TABLE {0}(x);", typeof(SQLiteModuleEnumerable).Name); #endregion /////////////////////////////////////////////////////////////////////// #region Private Data /// <summary> /// The <see cref="IEnumerable" /> instance containing the backing data /// for the virtual table. /// </summary> private IEnumerable enumerable; #endregion /////////////////////////////////////////////////////////////////////// #region Public Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="name"> /// The name of the module. This parameter cannot be null. /// </param> /// <param name="enumerable"> /// The <see cref="IEnumerable" /> instance to expose as a virtual /// table. This parameter cannot be null. /// </param> public SQLiteModuleEnumerable( string name, IEnumerable enumerable ) : base(name) { if (enumerable == null) throw new ArgumentNullException("enumerable"); this.enumerable = enumerable; } #endregion /////////////////////////////////////////////////////////////////////// #region Protected Methods /// <summary> /// Sets the table error message to one that indicates the virtual /// table cursor is of the wrong type. /// </summary> /// <param name="cursor"> /// The <see cref="SQLiteVirtualTableCursor" /> object instance. /// </param> /// <returns> /// The value of <see cref="SQLiteErrorCode.Error"/>. /// </returns> protected virtual SQLiteErrorCode CursorTypeMismatchError( SQLiteVirtualTableCursor cursor ) { SetCursorError(cursor, "not an \"enumerable\" cursor"); return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// /// <summary> /// Sets the table error message to one that indicates the virtual /// table cursor has no current row. /// </summary> /// <param name="cursor"> /// The <see cref="SQLiteVirtualTableCursor" /> object instance. /// </param> /// <returns> /// The value of <see cref="SQLiteErrorCode.Error"/>. /// </returns> protected virtual SQLiteErrorCode CursorEndOfEnumeratorError( SQLiteVirtualTableCursor cursor ) { SetCursorError(cursor, "already hit end of enumerator"); return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// /// <summary> /// Determines the string to return as the column value for the object /// instance value. /// </summary> /// <param name="value"> /// The object instance to return a string representation for. /// </param> /// <returns> /// The string representation of the specified object instance or null /// upon failure. /// </returns> protected virtual string GetStringFromObject( object value ) { if (value == null) return null; return value.ToString(); } /////////////////////////////////////////////////////////////////////// /// <summary> /// Determines the unique row identifier for the object instance value. /// </summary> /// <param name="value"> /// The object instance to return a unique row identifier for. /// </param> /// <returns> /// The unique row identifier or zero upon failure. /// </returns> protected virtual long GetRowIdFromObject( object value ) { if (value == null) return 0; return value.GetHashCode(); } /////////////////////////////////////////////////////////////////////// /// <summary> /// Converts a <see cref="SQLiteErrorCode" /> into a boolean return /// value for use with the <see cref="ISQLiteManagedModule.Eof" /> /// method. /// </summary> /// <param name="returnCode"> /// The <see cref="SQLiteErrorCode" /> value to convert. /// </param> /// <returns> /// The <see cref="Boolean" /> value. /// </returns> protected virtual bool CodeToEofResult( SQLiteErrorCode returnCode ) { return (returnCode == SQLiteErrorCode.Ok) ? false : true; } #endregion /////////////////////////////////////////////////////////////////////// #region ISQLiteManagedModule Members /// <summary> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </summary> /// <param name="connection"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="arguments"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="error"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </returns> public override SQLiteErrorCode Create( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error ) |
︙ | ︙ | |||
201 202 203 204 205 206 207 208 209 210 211 212 213 214 | } return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Connect( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error ) | > > > > > > > > > > > > > > > > > > > > > | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | } return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </summary> /// <param name="connection"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="arguments"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="error"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </returns> public override SQLiteErrorCode Connect( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error ) |
︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | } return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index ) { CheckDisposed(); if (!SetEstimatedCost(index)) { SetTableError(table, "failed to set estimated cost"); return SQLiteErrorCode.Error; } return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Disconnect( SQLiteVirtualTable table ) { CheckDisposed(); table.Dispose(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Destroy( SQLiteVirtualTable table ) { CheckDisposed(); table.Dispose(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Open( SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor ) { CheckDisposed(); cursor = new SQLiteVirtualTableCursorEnumerable( table, enumerable.GetEnumerator()); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Close( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); SQLiteVirtualTableCursorEnumerable enumerableCursor = cursor as SQLiteVirtualTableCursorEnumerable; if (enumerableCursor == null) return CursorTypeMismatchError(cursor); enumerableCursor.Close(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Filter( SQLiteVirtualTableCursor cursor, int indexNumber, string indexString, SQLiteValue[] values ) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | } return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </param> /// <param name="index"> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </returns> public override SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index ) { CheckDisposed(); if (!SetEstimatedCost(index)) { SetTableError(table, "failed to set estimated cost"); return SQLiteErrorCode.Error; } return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </returns> public override SQLiteErrorCode Disconnect( SQLiteVirtualTable table ) { CheckDisposed(); table.Dispose(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </returns> public override SQLiteErrorCode Destroy( SQLiteVirtualTable table ) { CheckDisposed(); table.Dispose(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </param> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </returns> public override SQLiteErrorCode Open( SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor ) { CheckDisposed(); cursor = new SQLiteVirtualTableCursorEnumerable( table, enumerable.GetEnumerator()); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Close" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Close" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Close" /> method. /// </returns> public override SQLiteErrorCode Close( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); SQLiteVirtualTableCursorEnumerable enumerableCursor = cursor as SQLiteVirtualTableCursorEnumerable; if (enumerableCursor == null) return CursorTypeMismatchError(cursor); enumerableCursor.Close(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <param name="indexNumber"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <param name="indexString"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <param name="values"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </returns> public override SQLiteErrorCode Filter( SQLiteVirtualTableCursor cursor, int indexNumber, string indexString, SQLiteValue[] values ) { |
︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 336 | enumerableCursor.MoveNext(); /* IGNORED */ return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Next( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); SQLiteVirtualTableCursorEnumerable enumerableCursor = | > > > > > > > > > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | enumerableCursor.MoveNext(); /* IGNORED */ return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Next" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Next" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Next" /> method. /// </returns> public override SQLiteErrorCode Next( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); SQLiteVirtualTableCursorEnumerable enumerableCursor = |
︙ | ︙ | |||
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | enumerableCursor.MoveNext(); /* IGNORED */ return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override bool Eof( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); SQLiteVirtualTableCursorEnumerable enumerableCursor = cursor as SQLiteVirtualTableCursorEnumerable; if (enumerableCursor == null) return CodeToEofResult(CursorTypeMismatchError(cursor)); return enumerableCursor.EndOfEnumerator; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Column( SQLiteVirtualTableCursor cursor, SQLiteContext context, int index ) { CheckDisposed(); | > > > > > > > > > > > > > > > > > > > > > > > > | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | enumerableCursor.MoveNext(); /* IGNORED */ return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Eof" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Eof" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Eof" /> method. /// </returns> public override bool Eof( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); SQLiteVirtualTableCursorEnumerable enumerableCursor = cursor as SQLiteVirtualTableCursorEnumerable; if (enumerableCursor == null) return CodeToEofResult(CursorTypeMismatchError(cursor)); return enumerableCursor.EndOfEnumerator; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </param> /// <param name="context"> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </param> /// <param name="index"> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </returns> public override SQLiteErrorCode Column( SQLiteVirtualTableCursor cursor, SQLiteContext context, int index ) { CheckDisposed(); |
︙ | ︙ | |||
390 391 392 393 394 395 396 397 398 399 400 401 402 403 | context.SetNull(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode RowId( SQLiteVirtualTableCursor cursor, ref long rowId ) { CheckDisposed(); | > > > > > > > > > > > > | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | context.SetNull(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </param> /// <param name="rowId"> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </returns> public override SQLiteErrorCode RowId( SQLiteVirtualTableCursor cursor, ref long rowId ) { CheckDisposed(); |
︙ | ︙ | |||
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | rowId = GetRowIdFromObject(current); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Update( SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId ) { CheckDisposed(); SetTableError(table, String.Format(CultureInfo.CurrentCulture, "virtual table \"{0}\" is read-only", table.TableName)); return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// public override SQLiteErrorCode Rename( SQLiteVirtualTable table, string newName ) { CheckDisposed(); | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | rowId = GetRowIdFromObject(current); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <param name="values"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <param name="rowId"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </returns> public override SQLiteErrorCode Update( SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId ) { CheckDisposed(); SetTableError(table, String.Format(CultureInfo.CurrentCulture, "virtual table \"{0}\" is read-only", table.TableName)); return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </param> /// <param name="newName"> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </returns> public override SQLiteErrorCode Rename( SQLiteVirtualTable table, string newName ) { CheckDisposed(); |
︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | } #endregion /////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) { throw new ObjectDisposedException( typeof(SQLiteModuleNoop).Name); } #endif } /////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) | > > > > > > > > > > > > | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | } #endregion /////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; /// <summary> /// Throws an <see cref="ObjectDisposedException"/> if this object /// instance has been disposed. /// </summary> private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) { throw new ObjectDisposedException( typeof(SQLiteModuleNoop).Name); } #endif } /////////////////////////////////////////////////////////////////////// /// <summary> /// Disposes of this object instance. /// </summary> /// <param name="disposing"> /// Non-zero if this method is being called from the /// <see cref="IDisposable.Dispose" /> method. Zero if this method is /// being called from the finalizer. /// </param> protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteModuleNoop.cs.
1 2 3 4 5 6 7 8 9 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Joe Mistachkin (joe@mistachkin.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Joe Mistachkin (joe@mistachkin.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { /// <summary> /// This class implements a virtual table module that does nothing. /// </summary> public class SQLiteModuleNoop : SQLiteModule /* NOT SEALED */ { #region Public Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="name"> /// The name of the module. This parameter cannot be null. /// </param> public SQLiteModuleNoop( string name ) : base(name) { // do nothing. } #endregion /////////////////////////////////////////////////////////////////////// #region ISQLiteManagedModule Members /// <summary> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </summary> /// <param name="connection"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="arguments"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <param name="error"> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Create" /> method. /// </returns> public override SQLiteErrorCode Create( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </summary> /// <param name="connection"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="arguments"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="error"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </returns> public override SQLiteErrorCode Connect( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </param> /// <param name="index"> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </returns> public override SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </returns> public override SQLiteErrorCode Disconnect( SQLiteVirtualTable table ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </returns> public override SQLiteErrorCode Destroy( SQLiteVirtualTable table ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </param> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </returns> public override SQLiteErrorCode Open( SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Close" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Close" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Close" /> method. /// </returns> public override SQLiteErrorCode Close( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <param name="indexNumber"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <param name="indexString"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <param name="values"> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Filter" /> method. /// </returns> public override SQLiteErrorCode Filter( SQLiteVirtualTableCursor cursor, int indexNumber, string indexString, SQLiteValue[] values ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Next" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Next" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Next" /> method. /// </returns> public override SQLiteErrorCode Next( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Eof" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Eof" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Eof" /> method. /// </returns> public override bool Eof( SQLiteVirtualTableCursor cursor ) { CheckDisposed(); return true; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </param> /// <param name="context"> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </param> /// <param name="index"> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Column" /> method. /// </returns> public override SQLiteErrorCode Column( SQLiteVirtualTableCursor cursor, SQLiteContext context, int index ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </summary> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </param> /// <param name="rowId"> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.RowId" /> method. /// </returns> public override SQLiteErrorCode RowId( SQLiteVirtualTableCursor cursor, ref long rowId ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <param name="values"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <param name="rowId"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </returns> public override SQLiteErrorCode Update( SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Begin" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Begin" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Begin" /> method. /// </returns> public override SQLiteErrorCode Begin( SQLiteVirtualTable table ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Sync" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Sync" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Sync" /> method. /// </returns> public override SQLiteErrorCode Sync( SQLiteVirtualTable table ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Commit" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Commit" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Commit" /> method. /// </returns> public override SQLiteErrorCode Commit( SQLiteVirtualTable table ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Rollback" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Rollback" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Rollback" /> method. /// </returns> public override SQLiteErrorCode Rollback( SQLiteVirtualTable table ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="argumentCount"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="name"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="function"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </returns> public override bool FindFunction( SQLiteVirtualTable table, int argumentCount, string name, ref SQLiteFunction function, ref IntPtr pClientData ) { CheckDisposed(); return false; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </param> /// <param name="newName"> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </returns> public override SQLiteErrorCode Rename( SQLiteVirtualTable table, string newName ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method. /// </param> /// <param name="savepoint"> /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method. /// </returns> public override SQLiteErrorCode Savepoint( SQLiteVirtualTable table, int savepoint ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Release" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Release" /> method. /// </param> /// <param name="savepoint"> /// See the <see cref="ISQLiteManagedModule.Release" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Release" /> method. /// </returns> public override SQLiteErrorCode Release( SQLiteVirtualTable table, int savepoint ) { CheckDisposed(); return SQLiteErrorCode.Ok; } /////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </param> /// <param name="savepoint"> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </returns> public override SQLiteErrorCode RollbackTo( SQLiteVirtualTable table, int savepoint ) { CheckDisposed(); return SQLiteErrorCode.Ok; } #endregion /////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; /// <summary> /// Throws an <see cref="ObjectDisposedException"/> if this object /// instance has been disposed. /// </summary> private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) { throw new ObjectDisposedException( typeof(SQLiteModuleNoop).Name); } #endif } /////////////////////////////////////////////////////////////////////// /// <summary> /// Disposes of this object instance. /// </summary> /// <param name="disposing"> /// Non-zero if this method is being called from the /// <see cref="IDisposable.Dispose" /> method. Zero if this method is /// being called from the finalizer. /// </param> protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) |
︙ | ︙ |