System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 8c1650482e39e01446f1907d86577e4ce740d27e
Title: SQLite3.GetBytes optimization
Status: Closed Type: Code_Defect
Severity: Minor Priority: Immediate
Subsystem: Integration_Via_PInvoke Resolution: Fixed
Last Modified: 2013-01-01 19:32:05
Version Found In:
Description:
current:

<pre>
nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index);
ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);
if (bDest == null) return nlen;
</pre>

need:

<pre>
nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index);
if (bDest == null) return nlen;

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

if (nCopied > 0) {
    ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);
    Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
} else nCopied = 0;
</pre>

<hr /><i>shane added on 2011-05-24 01:40:06 UTC:</i><br />
Fixed by [a97d149d1e].

<hr /><i>mistachkin added on 2011-07-07 04:48:39 UTC:</i><br />
Related to [201128cc88].