Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch IDisposablePattern Excluding Merge-Ins
This is equivalent to a diff from f58dc30e00 to b48037de03
2011-12-16
| ||
04:31 | Merge all IDisposable pattern fixes to trunk. check-in: 419bfbd2ee user: mistachkin tags: trunk | |
04:28 | Update test count on test procedures wiki page. Closed-Leaf check-in: b48037de03 user: mistachkin tags: IDisposablePattern | |
04:25 | Compilation error fixes. check-in: 8dfdf59c72 user: mistachkin tags: IDisposablePattern | |
03:32 | Start of making sure that all core components containing IDisposable objects implement IDisposable and that they follow the established best-practices when doing so. check-in: c532a87e4d user: mistachkin tags: IDisposablePattern | |
03:28 | Add missing file header to various files. check-in: f58dc30e00 user: mistachkin tags: trunk | |
2011-12-13
| ||
10:09 | When creating MockRegistryKey objects, use the new constructors that require the readOnly and safe arguments. check-in: 64686e6685 user: mistachkin tags: trunk | |
Changes to SQLite.NET.Settings.targets.
︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | + + + + + + + + | <IsCompactFramework Condition="'$(IsCompactFramework)' == ''">false</IsCompactFramework> <!-- NOTE: Emit an AssemblyFlags attribute that includes the Retargetable flag from the AssemblyNameFlags enumeration? --> <IsRetargetable Condition="'$(IsRetargetable)' == ''">false</IsRetargetable> <!-- NOTE: Throw an exception if an object has already been disposed? By default, this is enabled. If this is disabled, an exception will not be thrown when a SQLite object which has already been disposed is accessed. --> <ThrowOnDisposed Condition="'$(ThrowOnDisposed)' == ''">true</ThrowOnDisposed> </PropertyGroup> <!-- ****************************************************************************** ** Warning Properties ** ****************************************************************************** --> |
︙ | |||
168 169 170 171 172 173 174 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + + | ****************************************************************************** ** Strong Name Signing Properties ** ****************************************************************************** --> <PropertyGroup Condition="'$(SQLiteNetDir)' != '' And !HasTrailingSlash('$(SQLiteNetDir)') And |
︙ |
Changes to System.Data.SQLite/AssemblyInfo.cs.
|
Changes to System.Data.SQLite/SQLite3.cs.
︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + + + + + + + + + + | internal delegate void SQLiteLogCallback(IntPtr puser, int err_code, IntPtr message); /// <summary> /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET /// </summary> internal class SQLite3 : SQLiteBase { // // NOTE: This is the public key for the System.Data.SQLite assembly. If you change the // SNK file, you will need to change this as well. // internal const string PublicKey = "002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1" + "b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0" + "a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421" + "d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c"; #if !PLATFORM_COMPACTFRAMEWORK internal const string DesignerVersion = "1.0.77.0"; #endif /// <summary> /// The opaque pointer returned to us by the sqlite provider /// </summary> |
︙ | |||
44 45 46 47 48 49 50 | 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 | + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + - - - + + + + + | protected SQLiteFunction[] _functionsArray; internal SQLite3(SQLiteDateFormats fmt, DateTimeKind kind) : base(fmt, kind) { } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLite3).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// |
︙ |
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | internal class SQLite3_UTF16 : SQLite3 { internal SQLite3_UTF16(SQLiteDateFormats fmt, DateTimeKind kind) : base(fmt, kind) { } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLite3_UTF16).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) //{ // //////////////////////////////////// // // dispose managed resources here... // //////////////////////////////////// //} ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } finally { base.Dispose(disposing); } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8 /// </summary> /// <param name="b">A pointer to a UTF-16 string</param> /// <param name="nbytelen">The length (IN BYTES) of the string</param> /// <returns>A .NET string</returns> public override string ToString(IntPtr b, int nbytelen) { CheckDisposed(); return UTF16ToString(b, nbytelen); } public static string UTF16ToString(IntPtr b, int nbytelen) { if (nbytelen == 0 || b == IntPtr.Zero) return ""; |
︙ |
Changes to System.Data.SQLite/SQLiteBase.cs.
︙ | |||
218 219 220 221 222 223 224 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - + + + + - - - - - + + + + + + + + + + + + + + + | internal abstract bool AutoCommit { get; } internal abstract int FileControl(string zDbName, int op, IntPtr pArg); /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteBase).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// |
︙ |
Changes to System.Data.SQLite/SQLiteCommand.cs.
︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 | 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 | + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + | _commandTimeout = connection.DefaultTimeout; } if (transaction != null) Transaction = transaction; } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteCommand).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Disposes of the command and clears all member variables /// </summary> /// <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param> protected override void Dispose(bool disposing) { try { |
︙ | |||
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 | 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 | + + + + + | } /// <summary> /// Not implemented /// </summary> public override void Cancel() { CheckDisposed(); if (_activeReader != null) { SQLiteDataReader reader = _activeReader.Target as SQLiteDataReader; if (reader != null) reader.Cancel(); } } /// <summary> /// The SQL command text associated with the command /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [DefaultValue(""), RefreshProperties(RefreshProperties.All), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] #endif public override string CommandText { get { CheckDisposed(); return _commandText; } set { CheckDisposed(); if (_commandText == value) return; if (_activeReader != null && _activeReader.IsAlive) { throw new InvalidOperationException("Cannot set CommandText while a DataReader is active"); } |
︙ | |||
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 | 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 | + + + + + | #if !PLATFORM_COMPACTFRAMEWORK [DefaultValue((int)30)] #endif public override int CommandTimeout { get { CheckDisposed(); return _commandTimeout; } set { CheckDisposed(); _commandTimeout = value; } } /// <summary> /// The type of the command. SQLite only supports CommandType.Text /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [RefreshProperties(RefreshProperties.All), DefaultValue(CommandType.Text)] #endif public override CommandType CommandType { get { CheckDisposed(); return CommandType.Text; } set { CheckDisposed(); if (value != CommandType.Text) { throw new NotSupportedException(); } } } |
︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | 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 | + - + + + | /// <summary> /// Create a new parameter /// </summary> /// <returns></returns> public new SQLiteParameter CreateParameter() { CheckDisposed(); return new SQLiteParameter(); } /// <summary> /// The connection associated with this command /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] #endif public new SQLiteConnection Connection { |
︙ | |||
424 425 426 427 428 429 430 | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | - + | /// Returns the SQLiteParameterCollection for the given command /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] #endif public new SQLiteParameterCollection Parameters { |
︙ | |||
447 448 449 450 451 452 453 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | - + + + | /// command's underlying connection. /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] #endif public new SQLiteTransaction Transaction { |
︙ | |||
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 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | 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 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 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 | + + + + + + + + + + + + + | /// <summary> /// Overrides the default behavior to return a SQLiteDataReader specialization class /// </summary> /// <param name="behavior">The flags to be associated with the reader</param> /// <returns>A SQLiteDataReader</returns> public new SQLiteDataReader ExecuteReader(CommandBehavior behavior) { CheckDisposed(); InitializeForReader(); SQLiteDataReader rd = new SQLiteDataReader(this, behavior); _activeReader = new WeakReference(rd, false); return rd; } /// <summary> /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class /// </summary> /// <returns>A SQLiteDataReader</returns> public new SQLiteDataReader ExecuteReader() { CheckDisposed(); return ExecuteReader(CommandBehavior.Default); } /// <summary> /// Called by the SQLiteDataReader when the data reader is closed. /// </summary> internal void ClearDataReader() { _activeReader = null; } /// <summary> /// Execute the command and return the number of rows inserted/updated affected by it. /// </summary> /// <returns></returns> public override int ExecuteNonQuery() { CheckDisposed(); using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) { while (reader.NextResult()) ; return reader.RecordsAffected; } } /// <summary> /// Execute the command and return the first column of the first row of the resultset /// (if present), or null if no resultset was returned. /// </summary> /// <returns>The first column of the first row of the first resultset from the query</returns> public override object ExecuteScalar() { CheckDisposed(); using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) { if (reader.Read()) return reader[0]; } return null; } /// <summary> /// Does nothing. Commands are prepared as they are executed the first time, and kept in prepared state afterwards. /// </summary> public override void Prepare() { CheckDisposed(); } /// <summary> /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable. /// </summary> [DefaultValue(UpdateRowSource.None)] public override UpdateRowSource UpdatedRowSource { get { CheckDisposed(); return _updateRowSource; } set { CheckDisposed(); _updateRowSource = value; } } /// <summary> /// Determines if the command is visible at design time. Defaults to True. /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [DesignOnly(true), Browsable(false), DefaultValue(true), EditorBrowsable(EditorBrowsableState.Never)] #endif public override bool DesignTimeVisible { get { CheckDisposed(); return _designTimeVisible; } set { CheckDisposed(); _designTimeVisible = value; #if !PLATFORM_COMPACTFRAMEWORK TypeDescriptor.Refresh(this); #endif } } /// <summary> /// Clones a command, including all its parameters /// </summary> /// <returns>A new SQLiteCommand with the same commandtext, connection and parameters</returns> public object Clone() { CheckDisposed(); return new SQLiteCommand(this); } } } |
Changes to System.Data.SQLite/SQLiteCommandBuilder.cs.
︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | public SQLiteCommandBuilder(SQLiteDataAdapter adp) { QuotePrefix = "["; QuoteSuffix = "]"; DataAdapter = adp; } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteCommandBuilder).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) //{ // //////////////////////////////////// // // dispose managed resources here... // //////////////////////////////////// //} ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } finally { base.Dispose(disposing); } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Minimal amount of parameter processing. Primarily sets the DbType for the parameter equal to the provider type in the schema /// </summary> /// <param name="parameter">The parameter to use in applying custom behaviors to a row</param> /// <param name="row">The row to apply the parameter to</param> /// <param name="statementType">The type of statement</param> /// <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param> |
︙ | |||
102 103 104 105 106 107 108 | 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 | - - + + + + + + + + + + + + + + + + + + + + | } /// <summary> /// Gets/sets the DataAdapter for this CommandBuilder /// </summary> public new SQLiteDataAdapter DataAdapter { |
︙ | |||
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | + + | #if !PLATFORM_COMPACTFRAMEWORK [Browsable(false)] #endif public override string SchemaSeparator { get { CheckDisposed(); return base.SchemaSeparator; } set { CheckDisposed(); base.SchemaSeparator = value; } } /// <summary> /// Override helper, which can help the base command builder choose the right keys for the given query /// </summary> |
︙ |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | |||
309 310 311 312 313 314 315 316 317 318 319 320 321 322 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } } } } } } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteConnection).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// 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 /////////////////////////////////////////////////////////////////////////////////////////////// #if PLATFORM_COMPACTFRAMEWORK /// <summary> /// Obsolete /// </summary> public override int ConnectionTimeout { get |
︙ | |||
332 333 334 335 336 337 338 | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | - - - - - - - - - - - - | /// </summary> /// <returns></returns> public object Clone() { return new SQLiteConnection(this); } |
︙ |
Changes to System.Data.SQLite/SQLiteDataAdapter.cs.
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | /// <param name="connectionString">A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command.</param> public SQLiteDataAdapter(string commandText, string connectionString) { SQLiteConnection cnn = new SQLiteConnection(connectionString); SelectCommand = new SQLiteCommand(commandText, cnn); } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteDataAdapter).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) //{ // //////////////////////////////////// // // dispose managed resources here... // //////////////////////////////////// //} ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } finally { base.Dispose(disposing); } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Row updating event handler /// </summary> public event EventHandler<RowUpdatingEventArgs> RowUpdating { add { CheckDisposed(); #if !PLATFORM_COMPACTFRAMEWORK EventHandler<RowUpdatingEventArgs> previous = (EventHandler<RowUpdatingEventArgs>)base.Events[_updatingEventPH]; if ((previous != null) && (value.Target is DbCommandBuilder)) { EventHandler<RowUpdatingEventArgs> handler = (EventHandler<RowUpdatingEventArgs>)FindBuilder(previous); if (handler != null) { base.Events.RemoveHandler(_updatingEventPH, handler); } } #endif base.Events.AddHandler(_updatingEventPH, value); } |
︙ | |||
106 107 108 109 110 111 112 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | - - + + | #endif /// <summary> /// Row updated event handler /// </summary> public event EventHandler<RowUpdatedEventArgs> RowUpdated { |
︙ | |||
142 143 144 145 146 147 148 | 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 | - - + + - - + + - - + + - - + + | /// Gets/sets the select command for this DataAdapter /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] #endif public new SQLiteCommand SelectCommand { |
Changes to System.Data.SQLite/SQLiteDataReader.cs.
︙ | |||
62 63 64 65 66 67 68 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | - - - - - | internal bool _disposeCommand; /// <summary> /// If set, then raise an exception when the object is accessed after being disposed. /// </summary> internal bool _throwOnDisposed; |
︙ | |||
104 105 106 107 108 109 110 | 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 | + - + + + + + + + - + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + | _activeStatementIndex = -1; _rowsAffected = -1; if (_command != null) NextResult(); } /////////////////////////////////////////////////////////////////////////////////////////////// |
︙ | |||
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 | 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 | + + + + + | /// <summary> /// Enumerator support /// </summary> /// <returns>Returns a DbEnumerator object.</returns> public override Collections.IEnumerator GetEnumerator() { CheckDisposed(); return new DbEnumerator(this, ((_commandBehavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection)); } /// <summary> /// Not implemented. Returns 0 /// </summary> public override int Depth { get { CheckDisposed(); CheckClosed(); return 0; } } /// <summary> /// Returns the number of columns in the current resultset /// </summary> public override int FieldCount { get { CheckDisposed(); CheckClosed(); if (_keyInfo == null) return _fieldCount; return _fieldCount + _keyInfo.Count; } } /// <summary> /// Returns the number of visible fielsd in the current resultset /// </summary> public override int VisibleFieldCount { get { CheckDisposed(); CheckClosed(); return _fieldCount; } } /// <summary> /// SQLite is inherently un-typed. All datatypes in SQLite are natively strings. The definition of the columns of a table |
︙ | |||
273 274 275 276 277 278 279 280 281 282 283 284 285 286 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | + | /// </returns> /// <param name="i">The index of the column to type-check</param> /// <param name="typ">The type we want to get out of the column</param> private TypeAffinity VerifyType(int i, DbType typ) { CheckClosed(); CheckValidRow(); TypeAffinity affinity = GetSQLiteType(i).Affinity; switch (affinity) { case TypeAffinity.Int64: if (typ == DbType.Int16) return affinity; if (typ == DbType.Int32) return affinity; |
︙ | |||
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 | 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 | + + + + | /// <summary> /// Retrieves the column as a boolean value /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>bool</returns> public override bool GetBoolean(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetBoolean(i - VisibleFieldCount); VerifyType(i, DbType.Boolean); return Convert.ToBoolean(GetValue(i), CultureInfo.CurrentCulture); } /// <summary> /// Retrieves the column as a single byte value /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>byte</returns> public override byte GetByte(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetByte(i - VisibleFieldCount); VerifyType(i, DbType.Byte); return Convert.ToByte(_activeStatement._sql.GetInt32(_activeStatement, i)); } |
︙ | |||
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 | 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 | + + + + | /// <param name="length">The number of bytes to retrieve</param> /// <returns>The actual number of bytes written into the array</returns> /// <remarks> /// To determine the number of bytes in the column, pass a null value for the buffer. The total length will be returned. /// </remarks> public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetBytes(i - VisibleFieldCount, fieldOffset, buffer, bufferoffset, length); VerifyType(i, DbType.Binary); return _activeStatement._sql.GetBytes(_activeStatement, i, (int)fieldOffset, buffer, bufferoffset, length); } /// <summary> /// Returns the column as a single character /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>char</returns> public override char GetChar(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetChar(i - VisibleFieldCount); VerifyType(i, DbType.SByte); return Convert.ToChar(_activeStatement._sql.GetInt32(_activeStatement, i)); } |
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + | /// <param name="length">The number of bytes to retrieve</param> /// <returns>The actual number of characters written into the array</returns> /// <remarks> /// To determine the number of characters in the column, pass a null value for the buffer. The total length will be returned. /// </remarks> public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetChars(i - VisibleFieldCount, fieldoffset, buffer, bufferoffset, length); VerifyType(i, DbType.String); return _activeStatement._sql.GetChars(_activeStatement, i, (int)fieldoffset, buffer, bufferoffset, length); } /// <summary> /// Retrieves the name of the back-end datatype of the column /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>string</returns> public override string GetDataTypeName(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetDataTypeName(i - VisibleFieldCount); SQLiteType typ = GetSQLiteType(i); if (typ.Type == DbType.Object) return SQLiteConvert.SQLiteTypeToType(typ).Name; return _activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity); } /// <summary> /// Retrieve the column as a date/time value /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>DateTime</returns> public override DateTime GetDateTime(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetDateTime(i - VisibleFieldCount); VerifyType(i, DbType.DateTime); return _activeStatement._sql.GetDateTime(_activeStatement, i); } /// <summary> /// Retrieve the column as a decimal value /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>decimal</returns> public override decimal GetDecimal(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetDecimal(i - VisibleFieldCount); VerifyType(i, DbType.Decimal); return Decimal.Parse(_activeStatement._sql.GetText(_activeStatement, i), NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture); } /// <summary> /// Returns the column as a double /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>double</returns> public override double GetDouble(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetDouble(i - VisibleFieldCount); VerifyType(i, DbType.Double); return _activeStatement._sql.GetDouble(_activeStatement, i); } /// <summary> /// Returns the .NET type of a given column /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>Type</returns> public override Type GetFieldType(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetFieldType(i - VisibleFieldCount); return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i)); } /// <summary> /// Returns a column as a float value /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>float</returns> public override float GetFloat(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetFloat(i - VisibleFieldCount); VerifyType(i, DbType.Single); return Convert.ToSingle(_activeStatement._sql.GetDouble(_activeStatement, i)); } /// <summary> /// Returns the column as a Guid /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>Guid</returns> public override Guid GetGuid(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetGuid(i - VisibleFieldCount); TypeAffinity affinity = VerifyType(i, DbType.Guid); if (affinity == TypeAffinity.Blob) { byte[] buffer = new byte[16]; |
︙ | |||
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 | 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 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | + + + + + + + + + + + | /// <summary> /// Returns the column as a short /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>Int16</returns> public override Int16 GetInt16(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetInt16(i - VisibleFieldCount); VerifyType(i, DbType.Int16); return Convert.ToInt16(_activeStatement._sql.GetInt32(_activeStatement, i)); } /// <summary> /// Retrieves the column as an int /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>Int32</returns> public override Int32 GetInt32(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetInt32(i - VisibleFieldCount); VerifyType(i, DbType.Int32); return _activeStatement._sql.GetInt32(_activeStatement, i); } /// <summary> /// Retrieves the column as a long /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>Int64</returns> public override Int64 GetInt64(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetInt64(i - VisibleFieldCount); VerifyType(i, DbType.Int64); return _activeStatement._sql.GetInt64(_activeStatement, i); } /// <summary> /// Retrieves the name of the column /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>string</returns> public override string GetName(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetName(i - VisibleFieldCount); return _activeStatement._sql.ColumnName(_activeStatement, i); } /// <summary> /// Retrieves the i of a column, given its name /// </summary> /// <param name="name">The name of the column to retrieve</param> /// <returns>The int i of the column</returns> public override int GetOrdinal(string name) { CheckDisposed(); CheckClosed(); int r = _activeStatement._sql.ColumnIndex(_activeStatement, name); if (r == -1 && _keyInfo != null) { r = _keyInfo.GetOrdinal(name); if (r > -1) r += VisibleFieldCount; } return r; } /// <summary> /// Schema information in SQLite is difficult to map into .NET conventions, so a lot of work must be done /// to gather the necessary information so it can be represented in an ADO.NET manner. /// </summary> /// <returns>Returns a DataTable containing the schema information for the active SELECT statement being processed.</returns> public override DataTable GetSchemaTable() { CheckDisposed(); return GetSchemaTable(true, false); } private class ColumnParent : IEqualityComparer<ColumnParent> { public string DatabaseName; public string TableName; |
︙ | |||
941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | + + + + + + + - + + + + | /// <summary> /// Retrieves the column as a string /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>string</returns> public override string GetString(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetString(i - VisibleFieldCount); VerifyType(i, DbType.String); return _activeStatement._sql.GetText(_activeStatement, i); } /// <summary> /// Retrieves the column as an object corresponding to the underlying datatype of the column /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>object</returns> public override object GetValue(int i) { CheckDisposed(); if (i >= VisibleFieldCount && _keyInfo != null) return _keyInfo.GetValue(i - VisibleFieldCount); SQLiteType typ = GetSQLiteType(i); return _activeStatement._sql.GetValue(_activeStatement, i, typ); } /// <summary> /// Retreives the values of multiple columns, up to the size of the supplied array /// </summary> /// <param name="values">The array to fill with values from the columns in the current resultset</param> /// <returns>The number of columns retrieved</returns> public override int GetValues(object[] values) { CheckDisposed(); int nMax = FieldCount; if (values.Length < nMax) nMax = values.Length; for (int n = 0; n < nMax; n++) { values[n] = GetValue(n); } return nMax; } /// <summary> /// Returns True if the resultset has rows that can be fetched /// </summary> public override bool HasRows { get { CheckDisposed(); CheckClosed(); return (_readingState != 1); } } /// <summary> /// Returns True if the data reader is closed /// </summary> public override bool IsClosed { |
︙ | |||
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | + | /// <summary> /// Reads the next row from the resultset /// </summary> /// <returns>True if a new row was successfully loaded and is ready for processing</returns> public override bool Read() { CheckDisposed(); CheckClosed(); if (_readingState == -1) // First step was already done at the NextResult() level, so don't step again, just return true. { _readingState = 0; return true; } |
︙ | |||
1167 1168 1169 1170 1171 1172 1173 | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 | - + - + - + | } /// <summary> /// Retrieve the count of records affected by an update/insert command. Only valid once the data reader is closed! /// </summary> public override int RecordsAffected { |
Changes to System.Data.SQLite/SQLiteEnlistment.cs.
1 2 3 4 5 6 7 8 9 10 11 12 | 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 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ #if !PLATFORM_COMPACTFRAMEWORK namespace System.Data.SQLite { using System.Transactions; |
︙ |
Changes to System.Data.SQLite/SQLiteFactory.cs.
︙ | |||
10 11 12 13 14 15 16 | 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 | - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | using System; using System.Data.Common; #if !PLATFORM_COMPACTFRAMEWORK /// <summary> /// SQLite implementation of DbProviderFactory. /// </summary> |
Changes to System.Data.SQLite/SQLiteFunction.cs.
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | /// Internal constructor, initializes the function's internal variables. /// </summary> protected SQLiteFunction() { _contextDataList = new Dictionary<long, AggregateData>(); } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members /// <summary> /// Disposes of any active contextData variables that were not automatically cleaned up. Sometimes this can happen if /// someone closes the connection while a DataReader is open. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteFunction).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Placeholder for a user-defined disposal routine /// </summary> /// <param name="disposing">True if the object is being disposed explicitly</param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// IDisposable disp; foreach (KeyValuePair<long, AggregateData> kv in _contextDataList) { disp = kv.Value._data as IDisposable; if (disp != null) disp.Dispose(); } _contextDataList.Clear(); _InvokeFunc = null; _StepFunc = null; _FinalFunc = null; _CompareFunc = null; _base = null; _contextDataList = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor ~SQLiteFunction() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert /// strings and DateTime's into the current connection's encoding schema. /// </summary> public SQLiteConvert SQLiteConvert { get { CheckDisposed(); return _base; } } /// <summary> /// Scalar functions override this method to do their magic. /// </summary> /// <remarks> /// Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available /// to force them into a certain type. Therefore the only types you will ever see as parameters are /// DBNull.Value, Int64, Double, String or byte[] array. /// </remarks> /// <param name="args">The arguments for the command to process</param> /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or /// you may return an Exception-derived class if you wish to return an error to SQLite. Do not actually throw the error, /// just return it!</returns> public virtual object Invoke(object[] args) { CheckDisposed(); return null; } /// <summary> /// Aggregate functions override this method to do their magic. /// </summary> /// <remarks> /// Typically you'll be updating whatever you've placed in the contextData field and returning as quickly as possible. /// </remarks> /// <param name="args">The arguments for the command to process</param> /// <param name="stepNumber">The 1-based step number. This is incrememted each time the step method is called.</param> /// <param name="contextData">A placeholder for implementers to store contextual data pertaining to the current context.</param> public virtual void Step(object[] args, int stepNumber, ref object contextData) { CheckDisposed(); } /// <summary> /// Aggregate functions override this method to finish their aggregate processing. /// </summary> /// <remarks> /// If you implemented your aggregate function properly, /// you've been recording and keeping track of your data in the contextData object provided, and now at this stage you should have /// all the information you need in there to figure out what to return. /// NOTE: It is possible to arrive here without receiving a previous call to Step(), in which case the contextData will /// be null. This can happen when no rows were returned. You can either return null, or 0 or some other custom return value /// if that is the case. /// </remarks> /// <param name="contextData">Your own assigned contextData, provided for you so you can return your final results.</param> /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or /// you may return an Exception-derived class if you wish to return an error to SQLite. Do not actually throw the error, /// just return it! /// </returns> public virtual object Final(object contextData) { CheckDisposed(); return null; } /// <summary> /// User-defined collation sequences override this method to provide a custom string sorting algorithm. /// </summary> /// <param name="param1">The first string to compare</param> /// <param name="param2">The second strnig to compare</param> /// <returns>1 if param1 is greater than param2, 0 if they are equal, or -1 if param1 is less than param2</returns> public virtual int Compare(string param1, string param2) { CheckDisposed(); return 0; } /// <summary> /// Converts an IntPtr array of context arguments to an object array containing the resolved parameters the pointers point to. /// </summary> /// <remarks> |
︙ | |||
214 215 216 217 218 219 220 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - + | } /// <summary> /// Takes the return value from Invoke() and Final() and figures out how to return it to SQLite's context. /// </summary> /// <param name="context">The context the return value applies to</param> /// <param name="returnValue">The parameter to return to SQLite</param> |
︙ | |||
347 348 349 350 351 352 353 | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | _context = context; SetReturnValue(context, Final(obj)); IDisposable disp = obj as IDisposable; if (disp != null) disp.Dispose(); } |
︙ | |||
536 537 538 539 540 541 542 543 544 545 546 547 548 549 | 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 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | /// Obtains the collating sequence in effect for the given function. /// </summary> /// <returns></returns> protected CollationSequence GetCollationSequence() { return _base.GetCollationSequence(this, _context); } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteFunctionEx).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) //{ // //////////////////////////////////// // // dispose managed resources here... // //////////////////////////////////// //} ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } finally { base.Dispose(disposing); } } #endregion } /// <summary> /// The type of user-defined function to declare /// </summary> public enum FunctionType { |
︙ |
Changes to System.Data.SQLite/SQLiteKeyReader.cs.
︙ | |||
41 42 43 44 45 46 47 | 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 | - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + | } /// <summary> /// A single sub-query for a given table/database. /// </summary> private sealed class KeyQuery : IDisposable { |
︙ | |||
255 256 257 258 259 260 261 262 263 264 265 266 267 268 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | // Now we have all the additional columns we have to return in order to support // CommandBehavior.KeyInfo _keyInfo = new KeyInfo[keys.Count]; keys.CopyTo(_keyInfo); } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteKeyReader).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// private void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// _stmt = null; if (_keyInfo == null) return; for (int n = 0; n < _keyInfo.Length; n++) { if (_keyInfo[n].query != null) _keyInfo[n].query.Dispose(); } _keyInfo = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor ~SQLiteKeyReader() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// How many additional columns of keyinfo we're holding /// </summary> internal int Count { get { return (_keyInfo == null) ? 0 : _keyInfo.Length; } } |
︙ | |||
310 311 312 313 314 315 316 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | - - - - - - - - - - - - - - | for (int n = 0; n < _keyInfo.Length; n++) { if (_keyInfo[n].query != null) _keyInfo[n].query.IsValid = false; } } |
︙ |
Changes to System.Data.SQLite/SQLiteStatement.cs.
︙ | |||
84 85 86 87 88 89 90 91 92 93 94 95 96 97 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } _paramNames[x] = s; _paramValues[x] = null; } } } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members /// <summary> /// Disposes and finalizes the statement /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteStatement).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// private void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// if (_sqlite_stmt != null) { _sqlite_stmt.Dispose(); _sqlite_stmt = null; } _paramNames = null; _paramValues = null; _sql = null; _sqlStatement = null; } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor ~SQLiteStatement() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Called by SQLiteParameterCollection, this function determines if the specified parameter name belongs to /// this statement, and if so, keeps a reference to the parameter so it can be bound later. /// </summary> /// <param name="s">The parameter name to map</param> /// <param name="p">The parameter to assign it</param> internal bool MapParameter(string s, SQLiteParameter p) |
︙ | |||
113 114 115 116 117 118 119 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - - - - - - - - - - - - - - - - - - - | _paramValues[n] = p; return true; } } return false; } |
︙ |
Changes to System.Data.SQLite/SQLiteTransaction.cs.
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - + + | _cnn._transactionLevel--; _cnn = null; throw; } } } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable "Pattern" Members private bool disposed; private void CheckDisposed() /* throw */ { #if THROW_ON_DISPOSED if (disposed) throw new ObjectDisposedException(typeof(SQLiteTransaction).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Disposes the transaction. If it is currently active, any changes are rolled back. /// </summary> protected override void Dispose(bool disposing) { try { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// if (IsValid(false)) { IssueRollback(); } } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } } finally { base.Dispose(disposing); } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Commits the current transaction. /// </summary> public override void Commit() { CheckDisposed(); IsValid(true); if (_cnn._transactionLevel - 1 == 0) { using (SQLiteCommand cmd = _cnn.CreateCommand()) { cmd.CommandText = "COMMIT"; cmd.ExecuteNonQuery(); } } _cnn._transactionLevel--; _cnn = null; } /// <summary> /// Returns the underlying connection to which this transaction applies. /// </summary> public new SQLiteConnection Connection { |
︙ |
Changes to System.Data.SQLite/SR.Designer.cs.
|
Changes to System.Data.SQLite/System.Data.SQLite.Properties.targets.
︙ | |||
46 47 48 49 50 51 52 53 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | + + + + + + + | <!-- NOTE: Emit an AssemblyFlags attribute that includes the Retargetable flag from the AssemblyNameFlags enumeration? --> <PropertyGroup Condition="'$(IsRetargetable)' != 'false'"> <DefineConstants>$(DefineConstants);RETARGETABLE</DefineConstants> </PropertyGroup> <!-- NOTE: Throw an exception when somebody tries to access a disposed object? --> <PropertyGroup Condition="'$(ThrowOnDisposed)' != 'false'"> <DefineConstants>$(DefineConstants);THROW_ON_DISPOSED</DefineConstants> </PropertyGroup> </Project> |
Changes to testlinq/NorthwindModel2010.Designer.cs.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | - - |
|
︙ |
Changes to www/test.wiki.
︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 | - - + + | </li> <li> Make sure all tests pass; the log file "%TEMP%\EagleShell.exe.test.<pid>.log" may be checked if any errors should occur. EagleTest should produce "success" messages very similar to the following:<br /><br /> |