/ Check-in [238442bb]
Login

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

Overview
Comment:Remove the OP_StrEq opcodes. (CVS 1397)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:238442bbd267faee3eb70048bd9419af99c02931
User & Date: drh 2004-05-18 22:17:46
Context
2004-05-18
22:38
Remove dead code from vdbeaux.c. Add comments describing desired changes to OP_Sort processing in select.c (CVS 1398) check-in: ae37e8a0 user: drh tags: trunk
22:17
Remove the OP_StrEq opcodes. (CVS 1397) check-in: 238442bb user: drh tags: trunk
22:03
Remove dead code from util.c (CVS 1396) check-in: 3ce42e85 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.25 2004/05/18 09:58:08 danielk1977 Exp $
           14  +** $Id: pragma.c,v 1.26 2004/05/18 22:17:46 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include <ctype.h>
    18     18   
    19     19   /*
    20     20   ** Interpret the given string as a boolean value.
    21     21   */
................................................................................
   585    585         { OP_Rewind,      0, 8,        0},    /* 4 */
   586    586         { OP_Column,      0, 3,        0},    /* 5 */
   587    587         { OP_SetInsert,   0, 0,        0},
   588    588         { OP_Next,        0, 5,        0},    /* 7 */
   589    589         { OP_IntegrityCk, 0, 0,        0},    /* 8 */
   590    590         { OP_Dup,         0, 1,        0},
   591    591         { OP_String,      0, 0,        "ok"},
   592         -      { OP_StrEq,       0, 13,       0},    /* 11 */
          592  +      { OP_Eq,          0, 13,       0},    /* 11 */
   593    593         { OP_MemIncr,     0, 0,        0},
   594    594         { OP_String,      0, 0,        "*** in database "},
   595    595         { OP_String,      0, 0,        0},    /* 14 */
   596    596         { OP_String,      0, 0,        " ***\n"},
   597    597         { OP_Pull,        3, 0,        0},
   598    598         { OP_Concat,      4, 1,        0},
   599    599         { OP_Callback,    1, 0,        0},
................................................................................
   709    709       sqlite3VdbeChangeP2(v, addr+2, addr+ArraySize(endCode));
   710    710     }else
   711    711   
   712    712     {}
   713    713     sqliteFree(zLeft);
   714    714     sqliteFree(zRight);
   715    715   }
   716         -
   717         -
   718         -

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.298 2004/05/18 09:58:08 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.299 2004/05/18 22:17:46 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   /*
................................................................................
  1447   1447   **
  1448   1448   */
  1449   1449   /* Opcode: Ne P1 P2 *
  1450   1450   **
  1451   1451   ** Pop the top two elements from the stack.  If they are not equal, then
  1452   1452   ** jump to instruction P2.  Otherwise, continue to the next instruction.
  1453   1453   **
  1454         -** If either operand is NULL (and thus if the result is unknown) then
  1455         -** take the jump if P1 is true.
         1454  +** The least significant byte of P1 may be either 0x00 or 0x01. If either
         1455  +** operand is NULL (and thus if the result is unknown) then take the jump
         1456  +** only if the least significant byte of P1 is 0x01.
  1456   1457   **
  1457         -** If both values are numeric, they are converted to doubles using atof()
  1458         -** and compared in that format.  Otherwise the strcmp() library
  1459         -** routine is used for the comparison.  For a pure text comparison
  1460         -** use OP_StrNe.
         1458  +** The second least significant byte of P1 must be an affinity character -
         1459  +** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
         1460  +** according to the affinity before the comparison is made. If the byte is
         1461  +** 0x00, then numeric affinity is used.
         1462  +**
         1463  +** Once any conversions have taken place, and neither value is NULL, 
         1464  +** the values are compared. If both values are blobs, or both are text,
         1465  +** then memcmp() is used to determine the results of the comparison. If
         1466  +** both values are numeric, then a numeric comparison is used. If the
         1467  +** two values are of different types, then they are inequal.
  1461   1468   **
  1462   1469   ** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1463   1470   ** stack if the jump would have been taken, or a 0 if not.  Push a
  1464   1471   ** NULL if either operand was NULL.
  1465   1472   */
  1466   1473   /* Opcode: Lt P1 P2 *
  1467   1474   **
  1468   1475   ** Pop the top two elements from the stack.  If second element (the
  1469   1476   ** next on stack) is less than the first (the top of stack), then
  1470   1477   ** jump to instruction P2.  Otherwise, continue to the next instruction.
  1471   1478   ** In other words, jump if NOS<TOS.
  1472   1479   **
  1473         -** If either operand is NULL (and thus if the result is unknown) then
  1474         -** take the jump if P1 is true.
         1480  +** The least significant byte of P1 may be either 0x00 or 0x01. If either
         1481  +** operand is NULL (and thus if the result is unknown) then take the jump
         1482  +** only if the least significant byte of P1 is 0x01.
  1475   1483   **
  1476         -** If both values are numeric, they are converted to doubles using atof()
  1477         -** and compared in that format.  Numeric values are always less than
  1478         -** non-numeric values.  If both operands are non-numeric, the strcmp() library
  1479         -** routine is used for the comparison.  For a pure text comparison
  1480         -** use OP_StrLt.
         1484  +** The second least significant byte of P1 must be an affinity character -
         1485  +** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
         1486  +** according to the affinity before the comparison is made. If the byte is
         1487  +** 0x00, then numeric affinity is used.
         1488  +**
         1489  +** Once any conversions have taken place, and neither value is NULL, 
         1490  +** the values are compared. If both values are blobs, or both are text,
         1491  +** then memcmp() is used to determine the results of the comparison. If
         1492  +** both values are numeric, then a numeric comparison is used. If the
         1493  +** two values are of different types, then they are inequal.
  1481   1494   **
  1482   1495   ** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1483   1496   ** stack if the jump would have been taken, or a 0 if not.  Push a
  1484   1497   ** NULL if either operand was NULL.
  1485   1498   */
  1486   1499   /* Opcode: Le P1 P2 *
  1487   1500   **
  1488   1501   ** Pop the top two elements from the stack.  If second element (the
  1489   1502   ** next on stack) is less than or equal to the first (the top of stack),
  1490   1503   ** then jump to instruction P2. In other words, jump if NOS<=TOS.
  1491   1504   **
  1492         -** If either operand is NULL (and thus if the result is unknown) then
  1493         -** take the jump if P1 is true.
         1505  +** The least significant byte of P1 may be either 0x00 or 0x01. If either
         1506  +** operand is NULL (and thus if the result is unknown) then take the jump
         1507  +** only if the least significant byte of P1 is 0x01.
  1494   1508   **
  1495         -** If both values are numeric, they are converted to doubles using atof()
  1496         -** and compared in that format.  Numeric values are always less than
  1497         -** non-numeric values.  If both operands are non-numeric, the strcmp() library
  1498         -** routine is used for the comparison.  For a pure text comparison
  1499         -** use OP_StrLe.
         1509  +** The second least significant byte of P1 must be an affinity character -
         1510  +** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
         1511  +** according to the affinity before the comparison is made. If the byte is
         1512  +** 0x00, then numeric affinity is used.
         1513  +**
         1514  +** Once any conversions have taken place, and neither value is NULL, 
         1515  +** the values are compared. If both values are blobs, or both are text,
         1516  +** then memcmp() is used to determine the results of the comparison. If
         1517  +** both values are numeric, then a numeric comparison is used. If the
         1518  +** two values are of different types, then they are inequal.
  1500   1519   **
  1501   1520   ** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1502   1521   ** stack if the jump would have been taken, or a 0 if not.  Push a
  1503   1522   ** NULL if either operand was NULL.
  1504   1523   */
  1505   1524   /* Opcode: Gt P1 P2 *
  1506   1525   **
  1507   1526   ** Pop the top two elements from the stack.  If second element (the
  1508   1527   ** next on stack) is greater than the first (the top of stack),
  1509   1528   ** then jump to instruction P2. In other words, jump if NOS>TOS.
  1510   1529   **
  1511         -** If either operand is NULL (and thus if the result is unknown) then
  1512         -** take the jump if P1 is true.
         1530  +** The least significant byte of P1 may be either 0x00 or 0x01. If either
         1531  +** operand is NULL (and thus if the result is unknown) then take the jump
         1532  +** only if the least significant byte of P1 is 0x01.
  1513   1533   **
  1514         -** If both values are numeric, they are converted to doubles using atof()
  1515         -** and compared in that format.  Numeric values are always less than
  1516         -** non-numeric values.  If both operands are non-numeric, the strcmp() library
  1517         -** routine is used for the comparison.  For a pure text comparison
  1518         -** use OP_StrGt.
         1534  +** The second least significant byte of P1 must be an affinity character -
         1535  +** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
         1536  +** according to the affinity before the comparison is made. If the byte is
         1537  +** 0x00, then numeric affinity is used.
         1538  +**
         1539  +** Once any conversions have taken place, and neither value is NULL, 
         1540  +** the values are compared. If both values are blobs, or both are text,
         1541  +** then memcmp() is used to determine the results of the comparison. If
         1542  +** both values are numeric, then a numeric comparison is used. If the
         1543  +** two values are of different types, then they are inequal.
  1519   1544   **
  1520   1545   ** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1521   1546   ** stack if the jump would have been taken, or a 0 if not.  Push a
  1522   1547   ** NULL if either operand was NULL.
  1523   1548   */
  1524   1549   /* Opcode: Ge P1 P2 *
  1525   1550   **
  1526   1551   ** Pop the top two elements from the stack.  If second element (the next
  1527   1552   ** on stack) is greater than or equal to the first (the top of stack),
  1528   1553   ** then jump to instruction P2. In other words, jump if NOS>=TOS.
  1529   1554   **
  1530         -** If either operand is NULL (and thus if the result is unknown) then
  1531         -** take the jump if P1 is true.
         1555  +** The least significant byte of P1 may be either 0x00 or 0x01. If either
         1556  +** operand is NULL (and thus if the result is unknown) then take the jump
         1557  +** only if the least significant byte of P1 is 0x01.
  1532   1558   **
  1533         -** If both values are numeric, they are converted to doubles using atof()
  1534         -** and compared in that format.  Numeric values are always less than
  1535         -** non-numeric values.  If both operands are non-numeric, the strcmp() library
  1536         -** routine is used for the comparison.  For a pure text comparison
  1537         -** use OP_StrGe.
         1559  +** The second least significant byte of P1 must be an affinity character -
         1560  +** 'n', 't', 'i' or 'o' - or 0x00. An attempt is made to coerce both values
         1561  +** according to the affinity before the comparison is made. If the byte is
         1562  +** 0x00, then numeric affinity is used.
         1563  +**
         1564  +** Once any conversions have taken place, and neither value is NULL, 
         1565  +** the values are compared. If both values are blobs, or both are text,
         1566  +** then memcmp() is used to determine the results of the comparison. If
         1567  +** both values are numeric, then a numeric comparison is used. If the
         1568  +** two values are of different types, then they are inequal.
  1538   1569   **
  1539   1570   ** If P2 is zero, do not jump.  Instead, push an integer 1 onto the
  1540   1571   ** stack if the jump would have been taken, or a 0 if not.  Push a
  1541   1572   ** NULL if either operand was NULL.
  1542         -**
  1543         -** FIX ME: The comment for OP_Eq is up to date, but none of the others are.
  1544   1573   */
  1545   1574   case OP_Eq:
  1546   1575   case OP_Ne:
  1547   1576   case OP_Lt:
  1548   1577   case OP_Le:
  1549   1578   case OP_Gt:
  1550   1579   case OP_Ge: {
................................................................................
  1594   1623     }else{
  1595   1624       pTos++;
  1596   1625       pTos->flags = MEM_Int;
  1597   1626       pTos->i = res;
  1598   1627     }
  1599   1628     break;
  1600   1629   }
  1601         -
  1602         -#if 0
  1603         -  Mem *pNos = &pTos[-1];
  1604         -  i64 c, v;
  1605         -  int ft, fn;
  1606         -  assert( pNos>=p->aStack );
  1607         -  ft = pTos->flags;
  1608         -  fn = pNos->flags;
  1609         -  if( (ft | fn) & MEM_Null ){
  1610         -    popStack(&pTos, 2);
  1611         -    if( pOp->p2 ){
  1612         -      if( pOp->p1 ) pc = pOp->p2-1;
  1613         -    }else{
  1614         -      pTos++;
  1615         -      pTos->flags = MEM_Null;
  1616         -    }
  1617         -    break;
  1618         -  }else if( (ft & fn & MEM_Int)==MEM_Int ){
  1619         -    c = pNos->i - pTos->i;
  1620         -  }else if( (ft & MEM_Int)!=0 && (fn & MEM_Str)!=0 && toInt(pNos->z,&v) ){
  1621         -    c = v - pTos->i;
  1622         -  }else if( (fn & MEM_Int)!=0 && (ft & MEM_Str)!=0 && toInt(pTos->z,&v) ){
  1623         -    c = pNos->i - v;
  1624         -  }else{
  1625         -    Stringify(pTos);
  1626         -    Stringify(pNos);
  1627         -    c = sqlite3Compare(pNos->z, pTos->z);
  1628         -  }
  1629         -  switch( pOp->opcode ){
  1630         -    case OP_Eq:    c = c==0;     break;
  1631         -    case OP_Ne:    c = c!=0;     break;
  1632         -    case OP_Lt:    c = c<0;      break;
  1633         -    case OP_Le:    c = c<=0;     break;
  1634         -    case OP_Gt:    c = c>0;      break;
  1635         -    default:       c = c>=0;     break;
  1636         -  }
  1637         -  popStack(&pTos, 2);
  1638         -  if( pOp->p2 ){
  1639         -    if( c ) pc = pOp->p2-1;
  1640         -  }else{
  1641         -    pTos++;
  1642         -    pTos->i = c;
  1643         -    pTos->flags = MEM_Int;
  1644         -  }
  1645         -  break;
  1646         -}
  1647         -#endif
  1648   1630   /* INSERT NO CODE HERE!
  1649   1631   **
  1650   1632   ** The opcode numbers are extracted from this source file by doing
  1651   1633   **
  1652   1634   **    grep '^case OP_' vdbe.c | ... >opcodes.h
  1653   1635   **
  1654   1636   ** The opcodes are numbered in the order that they appear in this file.