System.Data.SQLite

Check-in [7b08d5ca2f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7b08d5ca2fc696fa5427b92b5a506c13ddb7dd0c
User & Date: mistachkin 2015-10-20 00:29:07.374
Context
2015-10-20
03:43
Web page updates to mention VS 2015. check-in: c012c893c1 user: mistachkin tags: trunk
00:29
Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class. check-in: 7b08d5ca2f user: mistachkin tags: trunk
2015-10-19
17:23
Add memory usage stress test. check-in: 67d28724d6 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/version.html.
48
49
50
51
52
53
54

55
56
57
58
59
60
61
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_1.html">SQLite 3.9.1</a>.</li>
      <li>Update and improve documentation comments for the native virtual table methods.</li>
      <li>Permit an existing registered function to be replaced. Fix for <a href="https://system.data.sqlite.org/index.html/info/2556655d1b">[2556655d1b]</a>.</li>
      <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for <a href="https://system.data.sqlite.org/index.html/info/7714b60d61">[7714b60d61]</a>.</li>
      <li>Add Reset method to the SQLiteCommand class.</li>
      <li>Add FileName property to the SQLiteConnection class.</li>
      <li>Add experimental support for the native json1 and fts5 extensions.</li>

    </ul>
    <p><b>1.0.98.0 - August 19, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li>
      <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>
      <li>Add support for creating custom SQL functions using delegates.</li>
      <li>Implement the Substring method for LINQ using the &quot;substr&quot; core SQL function.&nbsp;<b>** Potentially Incompatible Change **</b></li>







>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_1.html">SQLite 3.9.1</a>.</li>
      <li>Update and improve documentation comments for the native virtual table methods.</li>
      <li>Permit an existing registered function to be replaced. Fix for <a href="https://system.data.sqlite.org/index.html/info/2556655d1b">[2556655d1b]</a>.</li>
      <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for <a href="https://system.data.sqlite.org/index.html/info/7714b60d61">[7714b60d61]</a>.</li>
      <li>Add Reset method to the SQLiteCommand class.</li>
      <li>Add FileName property to the SQLiteConnection class.</li>
      <li>Add experimental support for the native json1 and fts5 extensions.</li>
      <li>Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.</li>
    </ul>
    <p><b>1.0.98.0 - August 19, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li>
      <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>
      <li>Add support for creating custom SQL functions using delegates.</li>
      <li>Implement the Substring method for LINQ using the &quot;substr&quot; core SQL function.&nbsp;<b>** Potentially Incompatible Change **</b></li>
Changes to System.Data.SQLite/SQLiteDataReader.cs.
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

        throw new InvalidCastException();
    }

    /// <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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetBoolean(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetByte(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Byte);
        return Convert.ToByte(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves a column as an array of bytes (blob)
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <param name="fieldOffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the bytes into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <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.







|
















|
















|







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

        throw new InvalidCastException();
    }

    /// <summary>
    /// Retrieves the column as a boolean value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>bool</returns>
    public override bool GetBoolean(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetBoolean(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>byte</returns>
    public override byte GetByte(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetByte(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Byte);
        return Convert.ToByte(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves a column as an array of bytes (blob)
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <param name="fieldOffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the bytes into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <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.
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
        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetChar(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.SByte);
        return Convert.ToChar(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves a column as an array of chars (blob)
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <param name="fieldoffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the characters into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <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.







|
















|







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
        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.</param>
    /// <returns>char</returns>
    public override char GetChar(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetChar(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.SByte);
        return Convert.ToChar(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves a column as an array of chars (blob)
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <param name="fieldoffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the characters into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <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.
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
        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 >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDataTypeName(i - PrivateVisibleFieldCount);

        TypeAffinity affin = TypeAffinity.Uninitialized;
        return _activeStatement._sql.ColumnType(_activeStatement, i, ref affin);
    }

    /// <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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDateTime(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDecimal(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDouble(i - PrivateVisibleFieldCount);

        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 >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFieldType(i - PrivateVisibleFieldCount);

        return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(_flags, 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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFloat(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)







|















|
















|
















|
















|














|
















|







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
        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.</param>
    /// <returns>string</returns>
    public override string GetDataTypeName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDataTypeName(i - PrivateVisibleFieldCount);

        TypeAffinity affin = TypeAffinity.Uninitialized;
        return _activeStatement._sql.ColumnType(_activeStatement, i, ref affin);
    }

    /// <summary>
    /// Retrieve the column as a date/time value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>DateTime</returns>
    public override DateTime GetDateTime(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDateTime(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>decimal</returns>
    public override decimal GetDecimal(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDecimal(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>double</returns>
    public override double GetDouble(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDouble(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>Type</returns>
    public override Type GetFieldType(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFieldType(i - PrivateVisibleFieldCount);

        return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(_flags, i));
    }

    /// <summary>
    /// Returns a column as a float value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>float</returns>
    public override float GetFloat(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFloat(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>Guid</returns>
    public override Guid GetGuid(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
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
        else
            return new Guid(_activeStatement._sql.GetText(_activeStatement, i));
    }

    /// <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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt16(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt32(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt64(i - PrivateVisibleFieldCount);

        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 >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        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)







|
















|
















|
















|










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
        else
            return new Guid(_activeStatement._sql.GetText(_activeStatement, i));
    }

    /// <summary>
    /// Returns the column as a short
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>Int16</returns>
    public override Int16 GetInt16(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt16(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>Int32</returns>
    public override Int32 GetInt32(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt32(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>Int64</returns>
    public override Int64 GetInt64(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt64(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>string</returns>
    public override string GetName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the name of the database associated with the specified column.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetDatabaseName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnDatabaseName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the name of the table associated with the specified column.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetTableName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnTableName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the original name of the specified column.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetOriginalName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnOriginalName(_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)
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206

      return tbl;
    }

    /// <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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetString(i - PrivateVisibleFieldCount);

        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();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)







|
















|







1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251

      return tbl;
    }

    /// <summary>
    /// Retrieves the column as a string
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public override string GetString(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetString(i - PrivateVisibleFieldCount);

        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.</param>
    /// <returns>object</returns>
    public override object GetValue(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
    {
      get { CheckDisposed(); return (_command == null); }
    }

    /// <summary>
    /// Returns True if the specified column is null
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>True or False</returns>
    public override bool IsDBNull(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)







|







1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
    {
      get { CheckDisposed(); return (_command == null); }
    }

    /// <summary>
    /// Returns True if the specified column is null
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>True or False</returns>
    public override bool IsDBNull(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
        return oldType;
    }

    /// <summary>
    /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
    /// </summary>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>A SQLiteType structure</returns>
    private SQLiteType GetSQLiteType(SQLiteConnectionFlags flags, int i)
    {
        SQLiteType typ = _fieldTypeArray[i];

        if (typ == null)
        {







|







1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
        return oldType;
    }

    /// <summary>
    /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
    /// </summary>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <param name="i">The index of the column.</param>
    /// <returns>A SQLiteType structure</returns>
    private SQLiteType GetSQLiteType(SQLiteConnectionFlags flags, int i)
    {
        SQLiteType typ = _fieldTypeArray[i];

        if (typ == null)
        {
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
    {
      get { CheckDisposed(); return GetValue(GetOrdinal(name)); }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its i
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>The value contained in the column</returns>
    public override object this[int i]
    {
      get { CheckDisposed(); return GetValue(i); }
    }

    private void LoadKeyInfo()







|







1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
    {
      get { CheckDisposed(); return GetValue(GetOrdinal(name)); }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its i
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>The value contained in the column</returns>
    public override object this[int i]
    {
      get { CheckDisposed(); return GetValue(i); }
    }

    private void LoadKeyInfo()
Changes to Tests/basic.eagle.
3988
3989
3990
3991
3992
3993
3994













































3995
3996
3997
3998
3999
4000
4001
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_JSON1_EXTENSION\
System.Data.SQLite SQLiteInterop} -result {{{"this":"is","a":["test"]}} {1\
integer 2 real 3 true 4 false 5 null 6 text 7 array 8 object} {1 {$} 2 2 {$}\
3.5 3 {$} 1 4 {$} 0 5 {$} 6 {$} x 7 {$[0]} 4 7 {$[1]} 5.7 7 {$[2]} 1 7 {$[3]} 0\
7 {$[4]} 7 {$[5]} x 8 {$.a[0]} 8 8 {$.a[1]} 9.1 8 {$.a[2]} 1 8 {$.a[3]} 0 8\
{$.a[4]} 8 {$.a[5]} y}}}














































###############################################################################

reportSQLiteResources $test_channel

###############################################################################








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_JSON1_EXTENSION\
System.Data.SQLite SQLiteInterop} -result {{{"this":"is","a":["test"]}} {1\
integer 2 real 3 true 4 false 5 null 6 text 7 array 8 object} {1 {$} 2 2 {$}\
3.5 3 {$} 1 4 {$} 0 5 {$} 6 {$} x 7 {$[0]} 4 7 {$[1]} 5.7 7 {$[2]} 1 7 {$[3]} 0\
7 {$[4]} 7 {$[5]} x 8 {$.a[0]} 8 8 {$.a[1]} 9.1 8 {$.a[2]} 1 8 {$.a[3]} 0 8\
{$.a[4]} 8 {$.a[5]} y}}}

###############################################################################

runTest {test data-1.78 {basic and extended column metadata} -setup {
  setupDb [set fileName data-1.78.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y TEXT, z MYTYPE);
    INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234);
    INSERT INTO t1 (x, y, z) VALUES(1, 5678, 'bar');
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, z FROM t1;"]

  set result [list]

  while {[$dataReader Read]} {
    lappend result \
        [list [$dataReader GetOrdinal x] [$dataReader GetName 0] \
        [$dataReader GetValue 0] [$dataReader GetDatabaseName 0] \
        [$dataReader GetTableName 0] [$dataReader GetOriginalName 0] \
        [$dataReader GetDataTypeName 0] [$dataReader GetFieldType 0]] \
        [list [$dataReader GetOrdinal y] [$dataReader GetName 1] \
        [$dataReader GetValue 1] [$dataReader GetDatabaseName 1] \
        [$dataReader GetTableName 1] [$dataReader GetOriginalName 1] \
        [$dataReader GetDataTypeName 1] [$dataReader GetFieldType 1]] \
        [list [$dataReader GetOrdinal z] [$dataReader GetName 2] \
        [$dataReader GetValue 2] [$dataReader GetDatabaseName 2] \
        [$dataReader GetTableName 2] [$dataReader GetOriginalName 2] \
        [$dataReader GetDataTypeName 2] [$dataReader GetFieldType 2]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{0 x 1 main t1 x INTEGER System.Int64} {1 y foo\
main t1 y TEXT System.String} {2 z 1234 main t1 z MYTYPE System.Int64} {0 x 1\
main t1 x INTEGER System.Int64} {1 y 5678 main t1 y TEXT System.String} {2 z\
bar main t1 z MYTYPE System.String}}}

###############################################################################

reportSQLiteResources $test_channel

###############################################################################

Changes to readme.htm.
215
216
217
218
219
220
221

222
223
224
225
226
227
228
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_1.html">SQLite 3.9.1</a>.</li>
    <li>Update and improve documentation comments for the native virtual table methods.</li>
    <li>Permit an existing registered function to be replaced. Fix for [2556655d1b].</li>
    <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for [7714b60d61].</li>
    <li>Add Reset method to the SQLiteCommand class.</li>
    <li>Add FileName property to the SQLiteConnection class.</li>
    <li>Add experimental support for the native json1 and fts5 extensions.</li>

</ul>
<p>
    <b>1.0.98.0 - August 19, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li>
    <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>







>







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_1.html">SQLite 3.9.1</a>.</li>
    <li>Update and improve documentation comments for the native virtual table methods.</li>
    <li>Permit an existing registered function to be replaced. Fix for [2556655d1b].</li>
    <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for [7714b60d61].</li>
    <li>Add Reset method to the SQLiteCommand class.</li>
    <li>Add FileName property to the SQLiteConnection class.</li>
    <li>Add experimental support for the native json1 and fts5 extensions.</li>
    <li>Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.98.0 - August 19, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li>
    <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>
Changes to www/news.wiki.
9
10
11
12
13
14
15

16
17
18
19
20
21
22
    <li>Updated to [https://www.sqlite.org/releaselog/3_9_1.html|SQLite 3.9.1].</li>
    <li>Update and improve documentation comments for the native virtual table methods.</li>
    <li>Permit an existing registered function to be replaced. Fix for [2556655d1b].</li>
    <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for [7714b60d61].</li>
    <li>Add Reset method to the SQLiteCommand class.</li>
    <li>Add FileName property to the SQLiteConnection class.</li>
    <li>Add experimental support for the native json1 and fts5 extensions.</li>

</ul>
<p>
    <b>1.0.98.0 - August 19, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_11_1.html|SQLite 3.8.11.1].</li>
    <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>







>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    <li>Updated to [https://www.sqlite.org/releaselog/3_9_1.html|SQLite 3.9.1].</li>
    <li>Update and improve documentation comments for the native virtual table methods.</li>
    <li>Permit an existing registered function to be replaced. Fix for [2556655d1b].</li>
    <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for [7714b60d61].</li>
    <li>Add Reset method to the SQLiteCommand class.</li>
    <li>Add FileName property to the SQLiteConnection class.</li>
    <li>Add experimental support for the native json1 and fts5 extensions.</li>
    <li>Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.98.0 - August 19, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_11_1.html|SQLite 3.8.11.1].</li>
    <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>