/ Check-in [544664ca]
Login

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

Overview
Comment:Simplify two conditionals and add testcase() macros to the affinity transform logic in the comparison operators.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 544664cadfb4e504bc0b321c865d1ecb8a831e20
User & Date: drh 2014-09-19 22:44:20
Context
2014-09-20
00:35
Fix the usage of the _GNU_SOURCE and _BSD_SOURCE macros in the main internal header file, sqliteInt.h. Set HAVE_STRCHRNUL to 1 by default on Linux only. check-in: 59e2c9df user: drh tags: trunk
00:02
Revise macro usage in 'sqliteInt.h'. check-in: 35db3e2f user: mistachkin tags: sqliteIntMacros
2014-09-19
22:44
Simplify two conditionals and add testcase() macros to the affinity transform logic in the comparison operators. check-in: 544664ca user: drh tags: trunk
22:30
Recognize the invariant that a Mem object cannot be MEM_Dyn and have a non-zero szMalloc at the same time. Enforce this with assert()s and exploit it in the sqlite3VdbeMemClearAndResize() routine for a performance increase. check-in: 3b21cf2b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  1896   1896         }
  1897   1897         break;
  1898   1898       }
  1899   1899     }else{
  1900   1900       /* Neither operand is NULL.  Do a comparison. */
  1901   1901       affinity = pOp->p5 & SQLITE_AFF_MASK;
  1902   1902       if( affinity>=SQLITE_AFF_NUMERIC ){
  1903         -      if( (pIn1->flags & (MEM_Int|MEM_Real))==0 && (pIn1->flags&MEM_Str)!=0 ){
         1903  +      if( (pIn1->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
  1904   1904           applyNumericAffinity(pIn1,0);
  1905   1905         }
  1906         -      if( (pIn3->flags & (MEM_Int|MEM_Real))==0 && (pIn3->flags&MEM_Str)!=0 ){
         1906  +      if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
  1907   1907           applyNumericAffinity(pIn3,0);
  1908   1908         }
  1909   1909       }else if( affinity==SQLITE_AFF_TEXT ){
  1910   1910         if( (pIn1->flags & MEM_Str)==0 && (pIn1->flags & (MEM_Int|MEM_Real))!=0 ){
         1911  +        testcase( pIn1->flags & MEM_Int );
         1912  +        testcase( pIn1->flags & MEM_Real );
  1911   1913           sqlite3VdbeMemStringify(pIn1, encoding, 1);
  1912   1914         }
  1913   1915         if( (pIn3->flags & MEM_Str)==0 && (pIn3->flags & (MEM_Int|MEM_Real))!=0 ){
         1916  +        testcase( pIn3->flags & MEM_Int );
         1917  +        testcase( pIn3->flags & MEM_Real );
  1914   1918           sqlite3VdbeMemStringify(pIn3, encoding, 1);
  1915   1919         }
  1916   1920       }
  1917   1921       assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
  1918   1922       if( pIn1->flags & MEM_Zero ){
  1919   1923         sqlite3VdbeMemExpandBlob(pIn1);
  1920   1924         flags1 &= ~MEM_Zero;