System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 85b824b736c17c73e0762b5a473d1e4776d039a2
Title: SQLiteValue.GetString() returns garbage value
Status: Closed Type: Code_Defect
Severity: Severe Priority: Blocker
Subsystem: Virtual_Table Resolution: Fixed
Last Modified: 2015-01-22 22:40:42
Version Found In: 1.0.94.0
User Comments:
anonymous added on 2015-01-22 20:29:16:
SQLiteValue.GetString() is returning a garbage value when called.  Appears to be due to it trying to use 'pValue' as the string data pointer (pValue references an SQLite Mem object I believe).  The following modification fixes it in my test cases:

        public string GetString()
        {
            if (pValue == IntPtr.Zero) return null;
            var pBytes = UnsafeNativeMethods.sqlite3_value_blob(pValue);
            return SQLiteString.StringFromUtf8IntPtr(pBytes, GetBytes());
        }

I believe SQLiteValue.GetBlob() also has this same issue, though I have not tried it.

mistachkin added on 2015-01-22 20:40:11:
Nice catch.  Pending fix.

mistachkin added on 2015-01-22 22:40:42:
Fixed on trunk via check-in [c68ac18fb4].  The GetBlob method was also fixed.