@@ -404,7 +404,7 @@ public override object GetValue(int i)
404404 CheckPosition ( ) ;
405405 CheckIndex ( i ) ;
406406
407- return CheckedGetValue ( ( ) => _row [ i ] . Value ) ;
407+ return CheckedGetValue ( x => _row [ x ] . Value , i ) ;
408408 }
409409
410410 public override int GetValues ( object [ ] values )
@@ -415,7 +415,7 @@ public override int GetValues(object[] values)
415415 var count = Math . Min ( _fields . Count , values . Length ) ;
416416 for ( var i = 0 ; i < count ; i ++ )
417417 {
418- values [ i ] = CheckedGetValue ( ( ) => GetValue ( i ) ) ;
418+ values [ i ] = CheckedGetValue ( x => GetValue ( x ) , i ) ;
419419 }
420420 return count ;
421421 }
@@ -425,23 +425,18 @@ public override bool GetBoolean(int i)
425425 CheckPosition ( ) ;
426426 CheckIndex ( i ) ;
427427
428- return CheckedGetValue ( ( ) => _row [ i ] . GetBoolean ( ) ) ;
428+ return CheckedGetValue ( x => _row [ x ] . GetBoolean ( ) , i ) ;
429429 }
430430
431431 public override byte GetByte ( int i )
432432 {
433433 CheckPosition ( ) ;
434434 CheckIndex ( i ) ;
435435
436- return CheckedGetValue ( ( ) => _row [ i ] . GetByte ( ) ) ;
436+ return CheckedGetValue ( x => _row [ x ] . GetByte ( ) , i ) ;
437437 }
438438
439- public override long GetBytes (
440- int i ,
441- long dataIndex ,
442- byte [ ] buffer ,
443- int bufferIndex ,
444- int length )
439+ public override long GetBytes ( int i , long dataIndex , byte [ ] buffer , int bufferIndex , int length )
445440 {
446441 CheckPosition ( ) ;
447442 CheckIndex ( i ) ;
@@ -457,12 +452,12 @@ public override long GetBytes(
457452 }
458453 else
459454 {
460- return CheckedGetValue ( ( ) => _row [ i ] . GetBinary ( ) ) . Length ;
455+ return CheckedGetValue ( x => _row [ x ] . GetBinary ( ) , i ) . Length ;
461456 }
462457 }
463458 else
464459 {
465- var byteArray = CheckedGetValue ( ( ) => _row [ i ] . GetBinary ( ) ) ;
460+ var byteArray = CheckedGetValue ( x => _row [ x ] . GetBinary ( ) , i ) ;
466461
467462 if ( length > ( byteArray . Length - dataIndex ) )
468463 {
@@ -490,15 +485,10 @@ public override char GetChar(int i)
490485 CheckPosition ( ) ;
491486 CheckIndex ( i ) ;
492487
493- return CheckedGetValue ( ( ) => _row [ i ] . GetChar ( ) ) ;
488+ return CheckedGetValue ( x => _row [ x ] . GetChar ( ) , i ) ;
494489 }
495490
496- public override long GetChars (
497- int i ,
498- long dataIndex ,
499- char [ ] buffer ,
500- int bufferIndex ,
501- int length )
491+ public override long GetChars ( int i , long dataIndex , char [ ] buffer , int bufferIndex , int length )
502492 {
503493 CheckPosition ( ) ;
504494 CheckIndex ( i ) ;
@@ -511,13 +501,13 @@ public override long GetChars(
511501 }
512502 else
513503 {
514- return ( CheckedGetValue ( ( ) => ( string ) GetValue ( i ) ) ) . ToCharArray ( ) . Length ;
504+ return CheckedGetValue ( x => ( string ) GetValue ( x ) , i ) . ToCharArray ( ) . Length ;
515505 }
516506 }
517507 else
518508 {
519509
520- var charArray = ( CheckedGetValue ( ( ) => ( string ) GetValue ( i ) ) ) . ToCharArray ( ) ;
510+ var charArray = CheckedGetValue ( x => ( string ) GetValue ( x ) , i ) . ToCharArray ( ) ;
521511
522512 var charsRead = 0 ;
523513 var realLength = length ;
@@ -548,71 +538,71 @@ public override Guid GetGuid(int i)
548538 CheckPosition ( ) ;
549539 CheckIndex ( i ) ;
550540
551- return CheckedGetValue ( ( ) => _row [ i ] . GetGuid ( ) ) ;
541+ return CheckedGetValue ( x => _row [ x ] . GetGuid ( ) , i ) ;
552542 }
553543
554544 public override Int16 GetInt16 ( int i )
555545 {
556546 CheckPosition ( ) ;
557547 CheckIndex ( i ) ;
558548
559- return CheckedGetValue ( ( ) => _row [ i ] . GetInt16 ( ) ) ;
549+ return CheckedGetValue ( x => _row [ x ] . GetInt16 ( ) , i ) ;
560550 }
561551
562552 public override Int32 GetInt32 ( int i )
563553 {
564554 CheckPosition ( ) ;
565555 CheckIndex ( i ) ;
566556
567- return CheckedGetValue ( ( ) => _row [ i ] . GetInt32 ( ) ) ;
557+ return CheckedGetValue ( x => _row [ x ] . GetInt32 ( ) , i ) ;
568558 }
569559
570560 public override Int64 GetInt64 ( int i )
571561 {
572562 CheckPosition ( ) ;
573563 CheckIndex ( i ) ;
574564
575- return CheckedGetValue ( ( ) => _row [ i ] . GetInt64 ( ) ) ;
565+ return CheckedGetValue ( x => _row [ x ] . GetInt64 ( ) , i ) ;
576566 }
577567
578568 public override float GetFloat ( int i )
579569 {
580570 CheckPosition ( ) ;
581571 CheckIndex ( i ) ;
582572
583- return CheckedGetValue ( ( ) => _row [ i ] . GetFloat ( ) ) ;
573+ return CheckedGetValue ( x => _row [ x ] . GetFloat ( ) , i ) ;
584574 }
585575
586576 public override double GetDouble ( int i )
587577 {
588578 CheckPosition ( ) ;
589579 CheckIndex ( i ) ;
590580
591- return CheckedGetValue ( ( ) => _row [ i ] . GetDouble ( ) ) ;
581+ return CheckedGetValue ( x => _row [ x ] . GetDouble ( ) , i ) ;
592582 }
593583
594584 public override string GetString ( int i )
595585 {
596586 CheckPosition ( ) ;
597587 CheckIndex ( i ) ;
598588
599- return CheckedGetValue ( ( ) => _row [ i ] . GetString ( ) ) ;
589+ return CheckedGetValue ( x => _row [ x ] . GetString ( ) , i ) ;
600590 }
601591
602592 public override Decimal GetDecimal ( int i )
603593 {
604594 CheckPosition ( ) ;
605595 CheckIndex ( i ) ;
606596
607- return CheckedGetValue ( ( ) => _row [ i ] . GetDecimal ( ) ) ;
597+ return CheckedGetValue ( x => _row [ x ] . GetDecimal ( ) , i ) ;
608598 }
609599
610600 public override DateTime GetDateTime ( int i )
611601 {
612602 CheckPosition ( ) ;
613603 CheckIndex ( i ) ;
614604
615- return CheckedGetValue ( ( ) => _row [ i ] . GetDateTime ( ) ) ;
605+ return CheckedGetValue ( x => _row [ x ] . GetDateTime ( ) , i ) ;
616606 }
617607
618608 public override bool IsDBNull ( int i )
@@ -640,25 +630,19 @@ public override bool NextResult()
640630 private void CheckPosition ( )
641631 {
642632 if ( _eof || _position == StartPosition )
643- {
644633 throw new InvalidOperationException ( "There are no data to read." ) ;
645- }
646634 }
647635
648636 private void CheckState ( )
649637 {
650638 if ( IsClosed )
651- {
652639 throw new InvalidOperationException ( "Invalid attempt of read when the reader is closed." ) ;
653- }
654640 }
655641
656642 private void CheckIndex ( int i )
657643 {
658644 if ( i < 0 || i >= FieldCount )
659- {
660645 throw new IndexOutOfRangeException ( "Could not find specified column in results." ) ;
661- }
662646 }
663647
664648 private FbDbType GetProviderType ( int i )
@@ -788,11 +772,11 @@ FROM rdb$relation_fields rfr
788772 return sql ;
789773 }
790774
791- private static T CheckedGetValue < T > ( Func < T > f )
775+ private static T CheckedGetValue < T > ( Func < int , T > f , int index )
792776 {
793777 try
794778 {
795- return f ( ) ;
779+ return f ( index ) ;
796780 }
797781 catch ( IscException ex )
798782 {
0 commit comments