/ Check-in [821b0b29]
Login

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

Overview
Comment:Really remove the OP_StrEq opcode this time - appearently I didn't save the file out of the editor before doing the check-in (1397). (CVS 1405)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 821b0b297c11a5e8d08d73b5eff810652e5a0d27
User & Date: drh 2004-05-19 11:31:13
Context
2004-05-19
13:13
Bug fixes in where.c. The where.test test works again. (CVS 1406) check-in: 7c31e257 user: drh tags: trunk
11:31
Really remove the OP_StrEq opcode this time - appearently I didn't save the file out of the editor before doing the check-in (1397). (CVS 1405) check-in: 821b0b29 user: drh tags: trunk
11:24
Variable name change: azVar to apVar. (CVS 1404) check-in: 45169ce0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.301 2004/05/19 11:24:26 drh Exp $
           46  +** $Id: vdbe.c,v 1.302 2004/05/19 11:31:13 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  1648   1648         pc = pOp->p2-1;
  1649   1649       }
  1650   1650     }else{
  1651   1651       pTos++;
  1652   1652       pTos->flags = MEM_Int;
  1653   1653       pTos->i = res;
  1654   1654     }
  1655         -  break;
  1656         -}
  1657         -/* INSERT NO CODE HERE!
  1658         -**
  1659         -** The opcode numbers are extracted from this source file by doing
  1660         -**
  1661         -**    grep '^case OP_' vdbe.c | ... >opcodes.h
  1662         -**
  1663         -** The opcodes are numbered in the order that they appear in this file.
  1664         -** But in order for the expression generating code to work right, the
  1665         -** string comparison operators that follow must be numbered exactly 6
  1666         -** greater than the numeric comparison opcodes above.  So no other
  1667         -** cases can appear between the two.
  1668         -*/
  1669         -/* Opcode: StrEq P1 P2 *
  1670         -**
  1671         -** Pop the top two elements from the stack.  If they are equal, then
  1672         -** jump to instruction P2.  Otherwise, continue to the next instruction.
  1673         -**
  1674         -** If either operand is NULL (and thus if the result is unknown) then
  1675         -** take the jump if P1 is true.
  1676         -**
  1677         -** The strcmp() library routine is used for the comparison.  For a
  1678         -** numeric comparison, use OP_Eq.
  1679         -**
  1680         -** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1681         -** stack if the jump would have been taken, or a 0 if not.  Push a
  1682         -** NULL if either operand was NULL.
  1683         -*/
  1684         -/* Opcode: StrNe P1 P2 *
  1685         -**
  1686         -** Pop the top two elements from the stack.  If they are not equal, then
  1687         -** jump to instruction P2.  Otherwise, continue to the next instruction.
  1688         -**
  1689         -** If either operand is NULL (and thus if the result is unknown) then
  1690         -** take the jump if P1 is true.
  1691         -**
  1692         -** The strcmp() library routine is used for the comparison.  For a
  1693         -** numeric comparison, use OP_Ne.
  1694         -**
  1695         -** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1696         -** stack if the jump would have been taken, or a 0 if not.  Push a
  1697         -** NULL if either operand was NULL.
  1698         -*/
  1699         -/* Opcode: StrLt P1 P2 *
  1700         -**
  1701         -** Pop the top two elements from the stack.  If second element (the
  1702         -** next on stack) is less than the first (the top of stack), then
  1703         -** jump to instruction P2.  Otherwise, continue to the next instruction.
  1704         -** In other words, jump if NOS<TOS.
  1705         -**
  1706         -** If either operand is NULL (and thus if the result is unknown) then
  1707         -** take the jump if P1 is true.
  1708         -**
  1709         -** The strcmp() library routine is used for the comparison.  For a
  1710         -** numeric comparison, use OP_Lt.
  1711         -**
  1712         -** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1713         -** stack if the jump would have been taken, or a 0 if not.  Push a
  1714         -** NULL if either operand was NULL.
  1715         -*/
  1716         -/* Opcode: StrLe P1 P2 *
  1717         -**
  1718         -** Pop the top two elements from the stack.  If second element (the
  1719         -** next on stack) is less than or equal to the first (the top of stack),
  1720         -** then jump to instruction P2. In other words, jump if NOS<=TOS.
  1721         -**
  1722         -** If either operand is NULL (and thus if the result is unknown) then
  1723         -** take the jump if P1 is true.
  1724         -**
  1725         -** The strcmp() library routine is used for the comparison.  For a
  1726         -** numeric comparison, use OP_Le.
  1727         -**
  1728         -** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1729         -** stack if the jump would have been taken, or a 0 if not.  Push a
  1730         -** NULL if either operand was NULL.
  1731         -*/
  1732         -/* Opcode: StrGt P1 P2 *
  1733         -**
  1734         -** Pop the top two elements from the stack.  If second element (the
  1735         -** next on stack) is greater than the first (the top of stack),
  1736         -** then jump to instruction P2. In other words, jump if NOS>TOS.
  1737         -**
  1738         -** If either operand is NULL (and thus if the result is unknown) then
  1739         -** take the jump if P1 is true.
  1740         -**
  1741         -** The strcmp() library routine is used for the comparison.  For a
  1742         -** numeric comparison, use OP_Gt.
  1743         -**
  1744         -** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1745         -** stack if the jump would have been taken, or a 0 if not.  Push a
  1746         -** NULL if either operand was NULL.
  1747         -*/
  1748         -/* Opcode: StrGe P1 P2 *
  1749         -**
  1750         -** Pop the top two elements from the stack.  If second element (the next
  1751         -** on stack) is greater than or equal to the first (the top of stack),
  1752         -** then jump to instruction P2. In other words, jump if NOS>=TOS.
  1753         -**
  1754         -** If either operand is NULL (and thus if the result is unknown) then
  1755         -** take the jump if P1 is true.
  1756         -**
  1757         -** The strcmp() library routine is used for the comparison.  For a
  1758         -** numeric comparison, use OP_Ge.
  1759         -**
  1760         -** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1761         -** stack if the jump would have been taken, or a 0 if not.  Push a
  1762         -** NULL if either operand was NULL.
  1763         -*/
  1764         -case OP_StrEq:
  1765         -case OP_StrNe:
  1766         -case OP_StrLt:
  1767         -case OP_StrLe:
  1768         -case OP_StrGt:
  1769         -case OP_StrGe: {
  1770         -  Mem *pNos = &pTos[-1];
  1771         -  int c;
  1772         -  assert( pNos>=p->aStack );
  1773         -  if( (pNos->flags | pTos->flags) & MEM_Null ){
  1774         -    popStack(&pTos, 2);
  1775         -    if( pOp->p2 ){
  1776         -      if( pOp->p1 ) pc = pOp->p2-1;
  1777         -    }else{
  1778         -      pTos++;
  1779         -      pTos->flags = MEM_Null;
  1780         -    }
  1781         -    break;
  1782         -  }else{
  1783         -    Stringify(pTos);
  1784         -    Stringify(pNos);
  1785         -    c = strcmp(pNos->z, pTos->z);
  1786         -  }
  1787         -  /* The asserts on each case of the following switch are there to verify
  1788         -  ** that string comparison opcodes are always exactly 6 greater than the
  1789         -  ** corresponding numeric comparison opcodes.  The code generator depends
  1790         -  ** on this fact.
  1791         -  */
  1792         -  switch( pOp->opcode ){
  1793         -    case OP_StrEq:    c = c==0;    assert( pOp->opcode-6==OP_Eq );   break;
  1794         -    case OP_StrNe:    c = c!=0;    assert( pOp->opcode-6==OP_Ne );   break;
  1795         -    case OP_StrLt:    c = c<0;     assert( pOp->opcode-6==OP_Lt );   break;
  1796         -    case OP_StrLe:    c = c<=0;    assert( pOp->opcode-6==OP_Le );   break;
  1797         -    case OP_StrGt:    c = c>0;     assert( pOp->opcode-6==OP_Gt );   break;
  1798         -    default:          c = c>=0;    assert( pOp->opcode-6==OP_Ge );   break;
  1799         -  }
  1800         -  popStack(&pTos, 2);
  1801         -  if( pOp->p2 ){
  1802         -    if( c ) pc = pOp->p2-1;
  1803         -  }else{
  1804         -    pTos++;
  1805         -    pTos->flags = MEM_Int;
  1806         -    pTos->i = c;
  1807         -  }
  1808   1655     break;
  1809   1656   }
  1810   1657   
  1811   1658   /* Opcode: And * * *
  1812   1659   **
  1813   1660   ** Pop two values off the stack.  Take the logical AND of the
  1814   1661   ** two values and push the resulting boolean value back onto the