/ Check-in [ae37e8a0]
Login

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

Overview
Comment:Remove dead code from vdbeaux.c. Add comments describing desired changes to OP_Sort processing in select.c (CVS 1398)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ae37e8a0bff39fd1568eae83f8761c34cd0184fc
User & Date: drh 2004-05-18 22:38:32
Context
2004-05-18
23:21
Add definitions of the CollSeq and KeyInfo structures. (CVS 1399) check-in: cd1be815 user: drh tags: trunk
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
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

     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 C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.167 2004/05/18 09:58:08 danielk1977 Exp $
           15  +** $Id: select.c,v 1.168 2004/05/18 22:38:32 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Allocate a new Select structure and return a pointer to that
    22     22   ** structure.
................................................................................
   306    306     pParse->nAgg = 0;
   307    307     pParse->useAgg = 0;
   308    308   }
   309    309   
   310    310   /*
   311    311   ** Insert code into "v" that will push the record on the top of the
   312    312   ** stack into the sorter.
          313  +**
          314  +** FIX ME:  Change this so that it uses the OP_MakeKey opcode
          315  +** instead of OP_SortMakeKey.  Delete the OP_SortMakeKey opcode.
          316  +** All columns should have affinity NONE.  Handle ASC versus
          317  +** DESC sort order by defining a list of comparison functions to
          318  +** be used by the OP_Sort opcode.
   313    319   */
   314    320   static void pushOntoSorter(Parse *pParse, Vdbe *v, ExprList *pOrderBy){
   315    321     char *zSortOrder;
   316    322     int i;
   317    323     zSortOrder = sqliteMalloc( pOrderBy->nExpr + 1 );
   318    324     if( zSortOrder==0 ) return;
   319    325     for(i=0; i<pOrderBy->nExpr; i++){
................................................................................
  2521   2527     /* Control jumps to here if an error is encountered above, or upon
  2522   2528     ** successful coding of the SELECT.
  2523   2529     */
  2524   2530   select_end:
  2525   2531     sqliteAggregateInfoReset(pParse);
  2526   2532     return rc;
  2527   2533   }
  2528         -
  2529         -
  2530         -

Changes to src/vdbeInt.h.

   317    317   */
   318    318   void sqlite3VdbeCleanupCursor(Cursor*);
   319    319   void sqlite3VdbeSorterReset(Vdbe*);
   320    320   void sqlite3VdbeAggReset(Agg*);
   321    321   void sqlite3VdbeKeylistFree(Keylist*);
   322    322   void sqliteVdbePopStack(Vdbe*,int);
   323    323   int sqlite3VdbeCursorMoveto(Cursor*);
   324         -int sqlite3VdbeByteSwap(int);
   325    324   #if !defined(NDEBUG) || defined(VDBE_PROFILE)
   326    325   void sqlite3VdbePrintOp(FILE*, int, Op*);
   327    326   #endif
   328    327   int sqlite3VdbeSerialTypeLen(u64);
   329    328   u64 sqlite3VdbeSerialType(const Mem *);
   330    329   int sqlite3VdbeSerialPut(unsigned char *, const Mem *);
   331    330   int sqlite3VdbeSerialGet(const unsigned char *, u64, Mem *);

Changes to src/vdbeaux.c.

  1012   1012     sqliteFree(p->aOp);
  1013   1013     sqliteFree(p->aLabel);
  1014   1014     sqliteFree(p->aStack);
  1015   1015     p->magic = VDBE_MAGIC_DEAD;
  1016   1016     sqliteFree(p);
  1017   1017   }
  1018   1018   
  1019         -/*
  1020         -** Convert an integer in between the native integer format and
  1021         -** the bigEndian format used as the record number for tables.
  1022         -**
  1023         -** The bigEndian format (most significant byte first) is used for
  1024         -** record numbers so that records will sort into the correct order
  1025         -** even though memcmp() is used to compare the keys.  On machines
  1026         -** whose native integer format is little endian (ex: i486) the
  1027         -** order of bytes is reversed.  On native big-endian machines
  1028         -** (ex: Alpha, Sparc, Motorola) the byte order is the same.
  1029         -**
  1030         -** This function is its own inverse.  In other words
  1031         -**
  1032         -**         X == byteSwap(byteSwap(X))
  1033         -*/
  1034         -int sqlite3VdbeByteSwap(int x){
  1035         -  union {
  1036         -     char zBuf[sizeof(int)];
  1037         -     int i;
  1038         -  } ux;
  1039         -  ux.zBuf[3] = x&0xff;
  1040         -  ux.zBuf[2] = (x>>8)&0xff;
  1041         -  ux.zBuf[1] = (x>>16)&0xff;
  1042         -  ux.zBuf[0] = (x>>24)&0xff;
  1043         -  return ux.i;
  1044         -}
  1045         -
  1046   1019   /*
  1047   1020   ** If a MoveTo operation is pending on the given cursor, then do that
  1048   1021   ** MoveTo now.  Return an error code.  If no MoveTo is pending, this
  1049   1022   ** routine does nothing and returns SQLITE_OK.
  1050   1023   */
  1051   1024   int sqlite3VdbeCursorMoveto(Cursor *p){
  1052   1025     if( p->deferredMoveto ){
................................................................................
  1067   1040       sqlite3_search_count++;
  1068   1041       p->deferredMoveto = 0;
  1069   1042       p->cacheValid = 0;
  1070   1043     }
  1071   1044     return SQLITE_OK;
  1072   1045   }
  1073   1046   
         1047  +#if 0
  1074   1048   /*
  1075   1049   ** FIX ME
  1076   1050   **
  1077   1051   ** This function is included temporarily so that regression tests have
  1078   1052   ** a chance of passing. It always uses memcmp().
  1079   1053   */
  1080   1054   int sqlite2BtreeKeyCompare(
................................................................................
  1107   1081   
  1108   1082     rc = sqlite3BtreeKey(pCur, 0, nCellKey, pMallocedKey);
  1109   1083     *pResult = memcmp(pMallocedKey, pKey, nKey>nCellKey?nCellKey:nKey);
  1110   1084     sqliteFree(pMallocedKey);
  1111   1085   
  1112   1086     return rc;
  1113   1087   }
         1088  +#endif
  1114   1089   
  1115   1090   /*
  1116   1091   ** The following functions:
  1117   1092   **
  1118   1093   ** sqlite3VdbeSerialType()
  1119   1094   ** sqlite3VdbeSerialTypeLen()
  1120   1095   ** sqlite3VdbeSerialRead()