]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Modify the sqlite3VdbeMemCompare() routine so that it does not modify any Mem.z value...
authordanielk1977 <danielk1977@noemail.net>
Tue, 16 Sep 2008 12:06:08 +0000 (12:06 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Tue, 16 Sep 2008 12:06:08 +0000 (12:06 +0000)
FossilOrigin-Name: 2d4505510032bf903a9c5d582edda442a0592c77

manifest
manifest.uuid
src/vdbemem.c

index 6a8ad4672c5b1f16cbdb5c719ea497b7cc14be2d..bc0d6fedb441a4b8145a9283138c94adf1c8492a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\stest\scase\sfor\sticket\s#3376.\s(CVS\s5705)
-D 2008-09-16T11:58:20
+C Modify\sthe\ssqlite3VdbeMemCompare()\sroutine\sso\sthat\sit\sdoes\snot\smodify\sany\sMem.z\svalues.\sTicket\s#3376.\s(CVS\s5706)
+D 2008-09-16T12:06:08
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in d15a7ebfe5e057a72a49805ffb302dbb601c8329
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -196,7 +196,7 @@ F src/vdbeapi.c c0f87aabb2bcf8c760ff9cb289119f7f6ba1797a
 F src/vdbeaux.c e1198d1ea2e129bd56863794a223da670e1359c7
 F src/vdbeblob.c f93110888ddc246215e9ba1f831d3d375bfd8355
 F src/vdbefifo.c 20fda2a7c4c0bcee1b90eb7e545fefcdbf2e1de7
-F src/vdbemem.c 51538ff193e1fcd462123ccef65323ccd2cc030c
+F src/vdbemem.c ead88713b852576e2a924bc4ae696964bfbaec0a
 F src/vtab.c 527c180e9c5fca417c9167d02af4b5039f892b4b
 F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
 F src/where.c a9958b26cc87ea1446fbe6d004a7959b8d5d75c1
@@ -636,7 +636,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 5dff20f4bc8d98017e76d3a771ab49310bddda63
-R bbe3c956b65ecfe3fc9d4f701a790ef2
-U drh
-Z 010c83f95916a850b415d2bd020d7b81
+P c64260579d353df3eae8c355b082b8206bc6185b
+R 7535949cc5ece243cee76f2451e698a1
+U danielk1977
+Z f8c645f05684cc478b17c2db72cd6df0
index c1fbbe62225193c324e1900e1f60f262d8ab10a0..b133435f4070f437f849b28c7ffe594ea6acdf3e 100644 (file)
@@ -1 +1 @@
-c64260579d353df3eae8c355b082b8206bc6185b
\ No newline at end of file
+2d4505510032bf903a9c5d582edda442a0592c77
\ No newline at end of file
index 1bf8aa0c6919394f23e4ee37d610d6ebd78130d0..6db624a43bdfcec8a27ab1779e396c73fd9bc06f 100644 (file)
@@ -15,7 +15,7 @@
 ** only within the VDBE.  Interface routines refer to a Mem using the
 ** name sqlite_value
 **
-** $Id: vdbemem.c,v 1.122 2008/08/22 14:41:01 drh Exp $
+** $Id: vdbemem.c,v 1.123 2008/09/16 12:06:08 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -738,22 +738,21 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
         ** comparison function directly */
         return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z);
       }else{
-        u8 origEnc = pMem1->enc;
         const void *v1, *v2;
         int n1, n2;
-        /* Convert the strings into the encoding that the comparison
-        ** function expects */
-        v1 = sqlite3ValueText((sqlite3_value*)pMem1, pColl->enc);
-        n1 = v1==0 ? 0 : pMem1->n;
-        assert( n1==sqlite3ValueBytes((sqlite3_value*)pMem1, pColl->enc) );
-        v2 = sqlite3ValueText((sqlite3_value*)pMem2, pColl->enc);
-        n2 = v2==0 ? 0 : pMem2->n;
-        assert( n2==sqlite3ValueBytes((sqlite3_value*)pMem2, pColl->enc) );
-        /* Do the comparison */
+        Mem c1;
+        Mem c2;
+        memset(&c1, 0, sizeof(c1));
+        memset(&c2, 0, sizeof(c2));
+        sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem);
+        sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem);
+        v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc);
+        n1 = v1==0 ? 0 : c1.n;
+        v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);
+        n2 = v2==0 ? 0 : c2.n;
         rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
-        /* Convert the strings back into the database encoding */
-        sqlite3ValueText((sqlite3_value*)pMem1, origEnc);
-        sqlite3ValueText((sqlite3_value*)pMem2, origEnc);
+        sqlite3VdbeMemRelease(&c1);
+        sqlite3VdbeMemRelease(&c2);
         return rc;
       }
     }