System.Data.SQLite
Check-in [f09f0e8ea1]
Not logged in

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

Overview
Comment:Further optimization/fix for ticket [201128cc88].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f09f0e8ea14d399a2bea6c9da52a72cca5bd1ccf
User & Date: mistachkin 2011-07-07 02:40:04
References
2011-07-07
04:30 Ticket [201128cc88] SQLite3.GetParamValueBytes optimization status still Closed with 2 other changes artifact: b6073f8c6c user: mistachkin
02:41 Closed ticket [201128cc88]. artifact: b2698d9f7d user: mistachkin
Context
2011-07-07
04:18
Add proper test case for [201128cc88] that covers most branches of the modified method. Also, tweak common test infrastructure. check-in: a290d2c1a5 user: mistachkin tags: trunk
02:40
Further optimization/fix for ticket [201128cc88]. check-in: f09f0e8ea1 user: mistachkin tags: trunk
02:15
Fix for ticket [e1b2e0f769] with test case. check-in: fa8d4d5773 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLite3.cs.

759
760
761
762
763
764
765
766
767
768
769
770
771
772



773

774
775
776
777
778
779
780

    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;

      return nCopied;
    }

    internal override double GetParamValueDouble(IntPtr ptr)
    {







<






>
>
>
|
>







759
760
761
762
763
764
765

766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783

    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;


      int nCopied = nLength;

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

      if (nCopied > 0)
      {
        IntPtr ptr = UnsafeNativeMethods.sqlite3_value_blob(p);

        Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
      }
      else nCopied = 0;

      return nCopied;
    }

    internal override double GetParamValueDouble(IntPtr ptr)
    {