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 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 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 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 750 751 752 753 754 755 756 757 758 759 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 817 818 819 820 821 822 823 824 825 826 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
|
//
// System.Data.OleDb.OleDbDataReader
//
// Author:
// Rodrigo Moya (rodrigo@ximian.com)
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
// Copyright (C) Tim Coleman, 2002
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.ComponentModel;
using System.Data.Common;
using System.Runtime.InteropServices;
namespace System.Data.OleDb
{
#if NET_2_0
public sealed class OleDbDataReader : DbDataReader, IDisposable
#else
public sealed class OleDbDataReader : MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
#endif
{
#region Fields
private OleDbCommand command;
private bool open;
private ArrayList gdaResults;
private int currentResult;
private int currentRow;
private bool disposed;
#endregion
#region Constructors
internal OleDbDataReader (OleDbCommand command, ArrayList results)
{
this.command = command;
open = true;
if (results != null)
gdaResults = results;
else
gdaResults = new ArrayList ();
currentResult = -1;
currentRow = -1;
}
#endregion
#region Properties
public
#if NET_2_0
override
#endif
int Depth {
get {
return 0; // no nested selects supported
}
}
public
#if NET_2_0
override
#endif
int FieldCount {
get {
if (currentResult < 0 || currentResult >= gdaResults.Count)
return 0;
return libgda.gda_data_model_get_n_columns (
(IntPtr) gdaResults[currentResult]);
}
}
public
#if NET_2_0
override
#endif
bool IsClosed {
get {
return !open;
}
}
public
#if NET_2_0
override
#endif
object this[string name] {
get {
int pos;
if (currentResult == -1)
throw new InvalidOperationException ();
pos = libgda.gda_data_model_get_column_position (
(IntPtr) gdaResults[currentResult],
name);
if (pos == -1)
throw new IndexOutOfRangeException ();
return this[pos];
}
}
public
#if NET_2_0
override
#endif
object this[int index] {
get {
return (object) GetValue (index);
}
}
public
#if NET_2_0
override
#endif
int RecordsAffected {
get {
int total_rows;
if (currentResult < 0 || currentResult >= gdaResults.Count)
return 0;
total_rows = libgda.gda_data_model_get_n_rows (
(IntPtr) gdaResults[currentResult]);
if (total_rows > 0) {
if (FieldCount > 0) {
// It's a SELECT statement
return -1;
}
}
return FieldCount > 0 ? -1 : total_rows;
}
}
[MonoTODO]
public
#if NET_2_0
override
#endif
bool HasRows {
get {
throw new NotImplementedException ();
}
}
#if NET_2_0
[MonoTODO]
public override int VisibleFieldCount {
get {
throw new NotImplementedException ();
}
}
#endif
#endregion
#region Methods
public
#if NET_2_0
override
#endif
void Close ()
{
for (int i = 0; i < gdaResults.Count; i++) {
IntPtr obj = (IntPtr) gdaResults[i];
libgda.FreeObject (obj);
}
gdaResults.Clear ();
gdaResults = null;
open = false;
currentResult = -1;
currentRow = -1;
}
public
#if NET_2_0
override
#endif
bool GetBoolean (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Boolean)
throw new InvalidCastException ();
return libgda.gda_value_get_boolean (value);
}
public
#if NET_2_0
override
#endif
byte GetByte (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Tinyint)
throw new InvalidCastException ();
return libgda.gda_value_get_tinyint (value);
}
[MonoTODO]
public
#if NET_2_0
override
#endif
long GetBytes (int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length)
{
throw new NotImplementedException ();
}
[EditorBrowsableAttribute (EditorBrowsableState.Never)]
public
#if NET_2_0
override
#endif
char GetChar (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Tinyint)
throw new InvalidCastException ();
return (char) libgda.gda_value_get_tinyint (value);
}
[MonoTODO]
public
#if NET_2_0
override
#endif
long GetChars (int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
{
throw new NotImplementedException ();
}
[MonoTODO]
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
#endif
public new OleDbDataReader GetData (int ordinal)
{
throw new NotImplementedException ();
}
#if NET_2_0
protected override DbDataReader GetDbDataReader (int ordinal)
{
return this.GetData (ordinal);
}
#endif
public
#if NET_2_0
override
#endif
string GetDataTypeName (int index)
{
IntPtr attrs;
GdaValueType type;
if (currentResult == -1)
return "unknown";
attrs = libgda.gda_data_model_describe_column ((IntPtr) gdaResults[currentResult],
index);
if (attrs == IntPtr.Zero)
return "unknown";
type = libgda.gda_field_attributes_get_gdatype (attrs);
libgda.gda_field_attributes_free (attrs);
return libgda.gda_type_to_string (type);
}
public
#if NET_2_0
override
#endif
DateTime GetDateTime (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) == GdaValueType.Date) {
GdaDate gdt;
gdt = (GdaDate) Marshal.PtrToStructure (libgda.gda_value_get_date (value),
typeof (GdaDate));
return new DateTime ((int) gdt.year, (int) gdt.month, (int) gdt.day);
} else if (libgda.gda_value_get_type (value) == GdaValueType.Time) {
GdaTime gdt;
gdt = (GdaTime) Marshal.PtrToStructure (libgda.gda_value_get_time (value),
typeof (GdaTime));
return new DateTime (0, 0, 0, (int) gdt.hour, (int) gdt.minute, (int) gdt.second, 0);
} else if (libgda.gda_value_get_type (value) == GdaValueType.Timestamp) {
GdaTimestamp gdt;
gdt = (GdaTimestamp) Marshal.PtrToStructure (libgda.gda_value_get_timestamp (value),
typeof (GdaTimestamp));
return new DateTime ((int) gdt.year, (int) gdt.month, (int) gdt.day,
(int) gdt.hour, (int) gdt.minute, (int) gdt.second,
(int) gdt.fraction);
}
throw new InvalidCastException ();
}
[MonoTODO]
public
#if NET_2_0
override
#endif
decimal GetDecimal (int ordinal)
{
throw new NotImplementedException ();
}
public
#if NET_2_0
override
#endif
double GetDouble (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Double)
throw new InvalidCastException ();
return libgda.gda_value_get_double (value);
}
public
#if NET_2_0
override
#endif
Type GetFieldType (int index)
{
IntPtr value;
GdaValueType type;
if (currentResult == -1)
throw new IndexOutOfRangeException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
index, currentRow);
if (value == IntPtr.Zero)
throw new IndexOutOfRangeException ();
type = libgda.gda_value_get_type (value);
switch (type) {
case GdaValueType.Bigint : return typeof (long);
case GdaValueType.Boolean : return typeof (bool);
case GdaValueType.Date : return typeof (DateTime);
case GdaValueType.Double : return typeof (double);
case GdaValueType.Integer : return typeof (int);
case GdaValueType.Single : return typeof (float);
case GdaValueType.Smallint : return typeof (byte);
case GdaValueType.String : return typeof (string);
case GdaValueType.Time : return typeof (DateTime);
case GdaValueType.Timestamp : return typeof (DateTime);
case GdaValueType.Tinyint : return typeof (byte);
}
return typeof(string); // default
}
public
#if NET_2_0
override
#endif
float GetFloat (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Single)
throw new InvalidCastException ();
return libgda.gda_value_get_single (value);
}
[MonoTODO]
public
#if NET_2_0
override
#endif
Guid GetGuid (int ordinal)
{
throw new NotImplementedException ();
}
public
#if NET_2_0
override
#endif
short GetInt16 (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Smallint)
throw new InvalidCastException ();
return (short) libgda.gda_value_get_smallint (value);
}
public
#if NET_2_0
override
#endif
int GetInt32 (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Integer)
throw new InvalidCastException ();
return libgda.gda_value_get_integer (value);
}
public
#if NET_2_0
override
#endif
long GetInt64 (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.Bigint)
throw new InvalidCastException ();
return libgda.gda_value_get_bigint (value);
}
public
#if NET_2_0
override
#endif
string GetName (int index)
{
if (currentResult == -1)
return null;
return libgda.gda_data_model_get_column_title (
(IntPtr) gdaResults[currentResult], index);
}
public
#if NET_2_0
override
#endif
int GetOrdinal (string name)
{
if (currentResult == -1)
throw new IndexOutOfRangeException ();
for (int i = 0; i < FieldCount; i++) {
if (GetName (i) == name)
return i;
}
throw new IndexOutOfRangeException ();
}
public
#if NET_2_0
override
#endif
DataTable GetSchemaTable ()
{
DataTable dataTableSchema = null;
// Only Results from SQL SELECT Queries
// get a DataTable for schema of the result
// otherwise, DataTable is null reference
if(this.FieldCount > 0) {
IntPtr attrs;
GdaValueType gdaType;
long columnSize = 0;
if (currentResult == -1) {
// FIXME: throw an exception?
#if DEBUG_OleDbDataReader
Console.WriteLine("Error: current result -1");
#endif
return null;
}
dataTableSchema = new DataTable ();
dataTableSchema.Columns.Add ("ColumnName", typeof (string));
dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
dataTableSchema.Columns.Add ("NumericScale", typeof (int));
dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
dataTableSchema.Columns.Add ("IsKey", typeof (bool));
DataColumn dc = dataTableSchema.Columns["IsKey"];
dc.AllowDBNull = true; // IsKey can have a DBNull
dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
dataTableSchema.Columns.Add ("DataType", typeof(Type));
dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
dataTableSchema.Columns.Add ("ProviderType", typeof (int));
dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
dataTableSchema.Columns.Add ("IsLong", typeof (bool));
dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
DataRow schemaRow;
for (int i = 0; i < this.FieldCount; i += 1 ) {
schemaRow = dataTableSchema.NewRow ();
attrs = libgda.gda_data_model_describe_column ((IntPtr) gdaResults[currentResult],
i);
if (attrs == IntPtr.Zero){
// FIXME: throw exception
#if DEBUG_OleDbDataReader
Console.WriteLine("Error: attrs null");
#endif
return null;
}
gdaType = libgda.gda_field_attributes_get_gdatype (attrs);
columnSize = libgda.gda_field_attributes_get_defined_size (attrs);
libgda.gda_field_attributes_free (attrs);
schemaRow["ColumnName"] = this.GetName(i);
schemaRow["ColumnOrdinal"] = i + 1;
schemaRow["ColumnSize"] = (int) columnSize;
schemaRow["NumericPrecision"] = 0;
schemaRow["NumericScale"] = 0;
// TODO: need to get KeyInfo
//if((cmdBehavior & CommandBehavior.KeyInfo) == CommandBehavior.KeyInfo) {
// bool IsUnique, IsKey;
// GetKeyInfo(field[i].Name, out IsUnique, out IsKey);
//}
//else {
schemaRow["IsUnique"] = false;
schemaRow["IsKey"] = DBNull.Value;
//}
schemaRow["BaseCatalogName"] = "";
schemaRow["BaseColumnName"] = this.GetName(i);
schemaRow["BaseSchemaName"] = "";
schemaRow["BaseTableName"] = "";
schemaRow["DataType"] = this.GetFieldType(i);
schemaRow["AllowDBNull"] = false;
schemaRow["ProviderType"] = (int) gdaType;
schemaRow["IsAliased"] = false;
schemaRow["IsExpression"] = false;
schemaRow["IsIdentity"] = false;
schemaRow["IsAutoIncrement"] = false;
schemaRow["IsRowVersion"] = false;
schemaRow["IsHidden"] = false;
schemaRow["IsLong"] = false;
schemaRow["IsReadOnly"] = false;
schemaRow.AcceptChanges();
dataTableSchema.Rows.Add (schemaRow);
}
#if DEBUG_OleDbDataReader
Console.WriteLine("********** DEBUG Table Schema BEGIN ************");
foreach (DataRow myRow in dataTableSchema.Rows) {
foreach (DataColumn myCol in dataTableSchema.Columns)
Console.WriteLine(myCol.ColumnName + " = " + myRow[myCol]);
Console.WriteLine();
}
Console.WriteLine("********** DEBUG Table Schema END ************");
#endif // DEBUG_OleDbDataReader
}
return dataTableSchema;
}
public
#if NET_2_0
override
#endif
string GetString (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new InvalidCastException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new InvalidCastException ();
if (libgda.gda_value_get_type (value) != GdaValueType.String)
throw new InvalidCastException ();
return libgda.gda_value_get_string (value);
}
[MonoTODO]
public TimeSpan GetTimeSpan (int ordinal)
{
throw new NotImplementedException ();
}
public
#if NET_2_0
override
#endif
object GetValue (int ordinal)
{
IntPtr value;
GdaValueType type;
if (currentResult == -1)
throw new IndexOutOfRangeException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new IndexOutOfRangeException ();
type = libgda.gda_value_get_type (value);
switch (type) {
case GdaValueType.Bigint : return GetInt64 (ordinal);
case GdaValueType.Boolean : return GetBoolean (ordinal);
case GdaValueType.Date : return GetDateTime (ordinal);
case GdaValueType.Double : return GetDouble (ordinal);
case GdaValueType.Integer : return GetInt32 (ordinal);
case GdaValueType.Single : return GetFloat (ordinal);
case GdaValueType.Smallint : return GetByte (ordinal);
case GdaValueType.String : return GetString (ordinal);
case GdaValueType.Time : return GetDateTime (ordinal);
case GdaValueType.Timestamp : return GetDateTime (ordinal);
case GdaValueType.Tinyint : return GetByte (ordinal);
}
return (object) libgda.gda_value_stringify (value);
}
[MonoTODO]
public
#if NET_2_0
override
#endif
int GetValues (object[] values)
{
throw new NotImplementedException ();
}
#if !NET_2_0
[MonoTODO]
IDataReader IDataRecord.GetData (int ordinal)
{
throw new NotImplementedException ();
}
#endif
#if NET_2_0
public override IEnumerator GetEnumerator()
#else
IEnumerator IEnumerable.GetEnumerator ()
#endif
{
return new DbEnumerator(this);
}
public
#if NET_2_0
override
#endif
bool IsDBNull (int ordinal)
{
IntPtr value;
if (currentResult == -1)
throw new IndexOutOfRangeException ();
value = libgda.gda_data_model_get_value_at ((IntPtr) gdaResults[currentResult],
ordinal, currentRow);
if (value == IntPtr.Zero)
throw new IndexOutOfRangeException ();
return libgda.gda_value_is_null (value);
}
public
#if NET_2_0
override
#endif
bool NextResult ()
{
int i = currentResult + 1;
if (i >= 0 && i < gdaResults.Count) {
currentResult++;
return true;
}
return false;
}
public
#if NET_2_0
override
#endif
bool Read ()
{
if (currentResult < 0 || currentResult >= gdaResults.Count)
return false;
currentRow++;
if (currentRow < libgda.gda_data_model_get_n_rows ((IntPtr) gdaResults[currentResult]))
return true;
return false;
}
#endregion
#region Destructors
private new void Dispose (bool disposing)
{
if (!this.disposed) {
if (disposing) {
// release any managed resources
command = null;
GC.SuppressFinalize (this);
}
// release any unmanaged resources
if (gdaResults != null) {
gdaResults.Clear ();
gdaResults = null;
}
// close any handles
if (open)
Close ();
this.disposed = true;
}
}
void IDisposable.Dispose() {
Dispose (true);
}
#if ONLY_1_1
~OleDbDataReader () {
Dispose (false);
}
#endif
#endregion // Destructors
}
}
|