System.Data.SQLite

Check-in [756bbf5fcb]
Login

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

Overview
Comment:Add GetObject method to the SQLiteValue class for use in testing and debugging.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | sessions
Files: files | file ages | folders
SHA1: 756bbf5fcbef4fd7cec061198f02ee55f0b94eb9
User & Date: mistachkin 2017-10-06 23:07:09.923
Context
2017-10-06
23:09
Make the IEnumerable<ISQLiteChangeSetMetadataItem> interface part of ISQLiteChangeSet. Add a couple missing null argument checks. check-in: ff0061c1df user: mistachkin tags: sessions
23:07
Add GetObject method to the SQLiteValue class for use in testing and debugging. check-in: 756bbf5fcb user: mistachkin tags: sessions
21:44
Add the SQLiteConnectionLock base class and use it from the classes that need to hold onto a native database connection handle. check-in: 91d210a6ca user: mistachkin tags: sessions
Changes
Unified Diff Show Whitespace Changes Patch
Changes to System.Data.SQLite/SQLiteModule.cs.
589
590
591
592
593
594
595














































596
597
598
599
600
601
602
        public byte[] GetBlob()
        {
            if (pValue == IntPtr.Zero) return null;

            return SQLiteBytes.FromIntPtr(
                UnsafeNativeMethods.sqlite3_value_blob(pValue), GetBytes());
        }















































        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Uses the native value handle to obtain and store the managed value
        /// for this object instance, thus saving it for later use.  The type
        /// of the managed value is determined by the type affinity of the







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







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
        public byte[] GetBlob()
        {
            if (pValue == IntPtr.Zero) return null;

            return SQLiteBytes.FromIntPtr(
                UnsafeNativeMethods.sqlite3_value_blob(pValue), GetBytes());
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns an <see cref="Object" /> instance associated with
        /// this value.
        /// </summary>
        /// <returns>
        /// The <see cref="Object" /> associated with this value.  If the type
        /// affinity of the object is unknown or cannot be determined, a null
        /// value will be returned.
        /// </returns>
        public object GetObject()
        {
            switch (GetTypeAffinity())
            {
                case TypeAffinity.Uninitialized:
                    {
                        return null;
                    }
                case TypeAffinity.Int64:
                    {
                        return GetInt64();
                    }
                case TypeAffinity.Double:
                    {
                        return GetDouble();
                    }
                case TypeAffinity.Text:
                    {
                        return GetString();
                    }
                case TypeAffinity.Blob:
                    {
                        return GetBytes();
                    }
                case TypeAffinity.Null:
                    {
                        return DBNull.Value;
                    }
                default:
                    {
                        return null;
                    }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Uses the native value handle to obtain and store the managed value
        /// for this object instance, thus saving it for later use.  The type
        /// of the managed value is determined by the type affinity of the