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

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

Overview
Comment:To avoid future confusion, the fix for [8c1650482e] should match the fix for [201128cc88].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f1f7b20cea7aa814dd99fdd139fedf4829aeb02b
User & Date: mistachkin 2011-07-07 05:12:44
Context
2011-07-07
05:53
Modify fix for [e1b2e0f769] so that it passes all the legacy unit tests in the 'test' project. Also, skip deploying CE projects for non-CE build configurations to avoid VS PDB locking issue. check-in: def75f76da user: mistachkin tags: trunk
05:12
To avoid future confusion, the fix for [8c1650482e] should match the fix for [201128cc88]. check-in: f1f7b20cea user: mistachkin tags: trunk
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
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   600    600   #else
   601    601         return ToDateTime(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1);
   602    602   #endif
   603    603       }
   604    604   
   605    605       internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength)
   606    606       {
   607         -      IntPtr ptr;
   608         -      int nlen;
   609         -      int nCopied = nLength;
          607  +      int nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index);
   610    608   
   611         -      nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index);
   612    609         // If no destination buffer, return the size needed.
   613    610         if (bDest == null) return nlen;
          611  +
          612  +      int nCopied = nLength;
   614    613   
   615    614         if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
   616    615         if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;
   617    616   
   618    617         if (nCopied > 0)
   619    618         {
   620         -        ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);
          619  +        IntPtr ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);
          620  +
   621    621           Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
   622    622         }
   623    623         else
   624    624         {
   625    625           nCopied = 0;
   626    626         }
   627    627   
................................................................................
   757    757   #endif
   758    758       }
   759    759   
   760    760       internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
   761    761       {
   762    762         int nlen = UnsafeNativeMethods.sqlite3_value_bytes(p);
   763    763   
          764  +      // If no destination buffer, return the size needed.
   764    765         if (bDest == null) return nlen;
   765    766   
   766    767         int nCopied = nLength;
   767    768   
   768    769         if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
   769    770         if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;
   770    771   
   771    772         if (nCopied > 0)
   772    773         {
   773    774           IntPtr ptr = UnsafeNativeMethods.sqlite3_value_blob(p);
   774    775   
   775    776           Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
   776    777         }
   777         -      else nCopied = 0;
          778  +      else
          779  +      {
          780  +        nCopied = 0;
          781  +      }
   778    782   
   779    783         return nCopied;
   780    784       }
   781    785   
   782    786       internal override double GetParamValueDouble(IntPtr ptr)
   783    787       {
   784    788         double value;