/ Check-in [c844f3da]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix the extra comments (added with -DSQLITE_ENABLE_EXPLAIN_COMMENTS) so that the sense of <, <=, >, and >= tests is correct and so that the SQLITE_STOREP2 version is shown correctly. Cherrypick of [4d43c4698eef4e3d].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.14
Files: files | file ages | folders
SHA1: c844f3daa9173badf476c56ca00284dbbac853d3
User & Date: mistachkin 2016-09-07 19:47:07
Context
2016-09-07
20:12
Fix the sqlite3_trace_v2() interface so that it goes disabled if either the callback or mask arguments are zero, in accordance with the documentation. Cherrypick of [37e6c54b1afc6348]. check-in: e9acf616 user: mistachkin tags: branch-3.14
19:47
Fix the extra comments (added with -DSQLITE_ENABLE_EXPLAIN_COMMENTS) so that the sense of <, <=, >, and >= tests is correct and so that the SQLITE_STOREP2 version is shown correctly. Cherrypick of [4d43c4698eef4e3d]. check-in: c844f3da user: mistachkin tags: branch-3.14
19:31
Merge selected test fixes from trunk. check-in: 71866b36 user: mistachkin tags: branch-3.14
2016-08-27
14:05
Fix the extra comments (added with -DSQLITE_ENABLE_EXPLAIN_COMMENTS) so that the sense of <, <=, >, and >= tests is correct and so that the SQLITE_STOREP2 version is shown correctly. These changes are already in the rowvalue branch but are added here since they are technically unrelated to rowvalue. check-in: 4d43c469 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  1877   1877     UPDATE_MAX_BLOBSIZE(pIn1);
  1878   1878     if( rc ) goto abort_due_to_error;
  1879   1879     break;
  1880   1880   }
  1881   1881   #endif /* SQLITE_OMIT_CAST */
  1882   1882   
  1883   1883   /* Opcode: Lt P1 P2 P3 P4 P5
  1884         -** Synopsis: if r[P1]<r[P3] goto P2
         1884  +** Synopsis: IF r[P3]<r[P1]
  1885   1885   **
  1886   1886   ** Compare the values in register P1 and P3.  If reg(P3)<reg(P1) then
  1887   1887   ** jump to address P2.  
  1888   1888   **
  1889   1889   ** If the SQLITE_JUMPIFNULL bit of P5 is set and either reg(P1) or
  1890   1890   ** reg(P3) is NULL then take the jump.  If the SQLITE_JUMPIFNULL 
  1891   1891   ** bit is clear then fall through if either operand is NULL.
................................................................................
  1912   1912   ** store a boolean result (either 0, or 1, or NULL) in register P2.
  1913   1913   **
  1914   1914   ** If the SQLITE_NULLEQ bit is set in P5, then NULL values are considered
  1915   1915   ** equal to one another, provided that they do not have their MEM_Cleared
  1916   1916   ** bit set.
  1917   1917   */
  1918   1918   /* Opcode: Ne P1 P2 P3 P4 P5
  1919         -** Synopsis: if r[P1]!=r[P3] goto P2
         1919  +** Synopsis: IF r[P3]!=r[P1]
  1920   1920   **
  1921   1921   ** This works just like the Lt opcode except that the jump is taken if
  1922   1922   ** the operands in registers P1 and P3 are not equal.  See the Lt opcode for
  1923   1923   ** additional information.
  1924   1924   **
  1925   1925   ** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either
  1926   1926   ** true or false and is never NULL.  If both operands are NULL then the result
  1927   1927   ** of comparison is false.  If either operand is NULL then the result is true.
  1928   1928   ** If neither operand is NULL the result is the same as it would be if
  1929   1929   ** the SQLITE_NULLEQ flag were omitted from P5.
  1930   1930   */
  1931   1931   /* Opcode: Eq P1 P2 P3 P4 P5
  1932         -** Synopsis: if r[P1]==r[P3] goto P2
         1932  +** Synopsis: IF r[P3]==r[P1]
  1933   1933   **
  1934   1934   ** This works just like the Lt opcode except that the jump is taken if
  1935   1935   ** the operands in registers P1 and P3 are equal.
  1936   1936   ** See the Lt opcode for additional information.
  1937   1937   **
  1938   1938   ** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either
  1939   1939   ** true or false and is never NULL.  If both operands are NULL then the result
  1940   1940   ** of comparison is true.  If either operand is NULL then the result is false.
  1941   1941   ** If neither operand is NULL the result is the same as it would be if
  1942   1942   ** the SQLITE_NULLEQ flag were omitted from P5.
  1943   1943   */
  1944   1944   /* Opcode: Le P1 P2 P3 P4 P5
  1945         -** Synopsis: if r[P1]<=r[P3] goto P2
         1945  +** Synopsis: IF r[P3]<=r[P1]
  1946   1946   **
  1947   1947   ** This works just like the Lt opcode except that the jump is taken if
  1948   1948   ** the content of register P3 is less than or equal to the content of
  1949   1949   ** register P1.  See the Lt opcode for additional information.
  1950   1950   */
  1951   1951   /* Opcode: Gt P1 P2 P3 P4 P5
  1952         -** Synopsis: if r[P1]>r[P3] goto P2
         1952  +** Synopsis: IF r[P3]>r[P1]
  1953   1953   **
  1954   1954   ** This works just like the Lt opcode except that the jump is taken if
  1955   1955   ** the content of register P3 is greater than the content of
  1956   1956   ** register P1.  See the Lt opcode for additional information.
  1957   1957   */
  1958   1958   /* Opcode: Ge P1 P2 P3 P4 P5
  1959         -** Synopsis: if r[P1]>=r[P3] goto P2
         1959  +** Synopsis: IF r[P3]>=r[P1]
  1960   1960   **
  1961   1961   ** This works just like the Lt opcode except that the jump is taken if
  1962   1962   ** the content of register P3 is greater than or equal to the content of
  1963   1963   ** register P1.  See the Lt opcode for additional information.
  1964   1964   */
  1965   1965   case OP_Eq:               /* same as TK_EQ, jump, in1, in3 */
  1966   1966   case OP_Ne:               /* same as TK_NE, jump, in1, in3 */

Changes to src/vdbeaux.c.

  1090   1090     char *zTemp,       /* Write result here */
  1091   1091     int nTemp          /* Space available in zTemp[] */
  1092   1092   ){
  1093   1093     const char *zOpName;
  1094   1094     const char *zSynopsis;
  1095   1095     int nOpName;
  1096   1096     int ii, jj;
         1097  +  char zAlt[50];
  1097   1098     zOpName = sqlite3OpcodeName(pOp->opcode);
  1098   1099     nOpName = sqlite3Strlen30(zOpName);
  1099   1100     if( zOpName[nOpName+1] ){
  1100   1101       int seenCom = 0;
  1101   1102       char c;
  1102   1103       zSynopsis = zOpName += nOpName + 1;
         1104  +    if( strncmp(zSynopsis,"IF ",3)==0 ){
         1105  +      if( pOp->p5 & SQLITE_STOREP2 ){
         1106  +        sqlite3_snprintf(sizeof(zAlt), zAlt, "r[P2] = (%s)", zSynopsis+3);
         1107  +      }else{
         1108  +        sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3);
         1109  +      }
         1110  +      zSynopsis = zAlt;
         1111  +    }
  1103   1112       for(ii=jj=0; jj<nTemp-1 && (c = zSynopsis[ii])!=0; ii++){
  1104   1113         if( c=='P' ){
  1105   1114           c = zSynopsis[++ii];
  1106   1115           if( c=='4' ){
  1107   1116             sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zP4);
  1108   1117           }else if( c=='X' ){
  1109   1118             sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", pOp->zComment);