/ Check-in [56845256]
Login

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

Overview
Comment:Defer checking for null in the comparison operators, since that is an uncommon case.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5684525613961fed9db6a4d10dbe25521201b24f08e011df3a20ac895316957d
User & Date: drh 2017-04-17 23:23:17
Context
2017-04-18
05:49
Refactor the fts3ColumnMethod() function so that all branches can be covered. check-in: e47fdb49 user: dan tags: trunk
2017-04-17
23:23
Defer checking for null in the comparison operators, since that is an uncommon case. check-in: 56845256 user: drh tags: trunk
20:50
Do not allow a Mem object to be both NULL and some other type at the same time. check-in: e698db19 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  1491   1491   
  1492   1492     pIn1 = &aMem[pOp->p1];
  1493   1493     type1 = numericType(pIn1);
  1494   1494     pIn2 = &aMem[pOp->p2];
  1495   1495     type2 = numericType(pIn2);
  1496   1496     pOut = &aMem[pOp->p3];
  1497   1497     flags = pIn1->flags | pIn2->flags;
  1498         -  if( (flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;
  1499   1498     if( (type1 & type2 & MEM_Int)!=0 ){
  1500   1499       iA = pIn1->u.i;
  1501   1500       iB = pIn2->u.i;
  1502   1501       bIntint = 1;
  1503   1502       switch( pOp->opcode ){
  1504   1503         case OP_Add:       if( sqlite3AddInt64(&iB,iA) ) goto fp_math;  break;
  1505   1504         case OP_Subtract:  if( sqlite3SubInt64(&iB,iA) ) goto fp_math;  break;
................................................................................
  1515   1514           if( iA==-1 ) iA = 1;
  1516   1515           iB %= iA;
  1517   1516           break;
  1518   1517         }
  1519   1518       }
  1520   1519       pOut->u.i = iB;
  1521   1520       MemSetTypeFlag(pOut, MEM_Int);
         1521  +  }else if( (flags & MEM_Null)!=0 ){
         1522  +    goto arithmetic_result_is_null;
  1522   1523     }else{
  1523   1524       bIntint = 0;
  1524   1525   fp_math:
  1525   1526       rA = sqlite3VdbeRealValue(pIn1);
  1526   1527       rB = sqlite3VdbeRealValue(pIn2);
  1527   1528       switch( pOp->opcode ){
  1528   1529         case OP_Add:         rB += rA;       break;