System.Data.SQLite

Check-in [3e063f371f]
Login

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

Overview
Comment:Fix for [201128cc88].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3e063f371f256f0a60fe33a801e0cf5c2f191fad
User & Date: mistachkin 2011-07-05 10:13:18.191
References
2011-07-07
04:30 Ticket [201128cc88] SQLite3.GetParamValueBytes optimization status still Closed with 2 other changes artifact: b6073f8c6c user: mistachkin
2011-07-05
10:18 Closed ticket [201128cc88]. artifact: fe6aeb5e69 user: mistachkin
Context
2011-07-05
10:13
Cleanup leaked variables in test case. check-in: 84d5eb1e69 user: mistachkin tags: trunk
10:13
Fix for [201128cc88]. check-in: 3e063f371f user: mistachkin tags: trunk
10:05
First attempt to reproduce the issue in ticket [e1b2e0f769]. check-in: 984585f3ac user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLite3.cs.
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769



770
771
772
773
774
775
776
#else
      throw new NotImplementedException();
#endif
    }

    internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {
      IntPtr ptr;
      int nlen;
      int nCopied = nLength;

      nlen = UnsafeNativeMethods.sqlite3_value_bytes(p);
      ptr = UnsafeNativeMethods.sqlite3_value_blob(p);

      if (bDest == null) return nlen;




      if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
      if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;

      if (nCopied > 0)
        Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied);
      else nCopied = 0;







<
<
<
<
|
<


>
>
>







755
756
757
758
759
760
761




762

763
764
765
766
767
768
769
770
771
772
773
774
#else
      throw new NotImplementedException();
#endif
    }

    internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {




      int nlen = UnsafeNativeMethods.sqlite3_value_bytes(p);


      if (bDest == null) return nlen;

      IntPtr ptr = UnsafeNativeMethods.sqlite3_value_blob(p);
      int nCopied = nLength;

      if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
      if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;

      if (nCopied > 0)
        Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied);
      else nCopied = 0;