/ Check-in [2438da79]
Login

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

Overview
Comment:Disable sorting by indices if there is a COLLATE subclause in the ORDER BY clause. (CVS 713)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2438da791afb53b4f1c7a9ff9705d393c86f3cbd
User & Date: drh 2002-08-14 03:03:57
Context
2002-08-14
12:56
Implement probabilistic reader/writer locks under windows so that windows can have multiple simultaneous readers. (CVS 714) check-in: 2127de3f user: drh tags: trunk
03:03
Disable sorting by indices if there is a COLLATE subclause in the ORDER BY clause. (CVS 713) check-in: 2438da79 user: drh tags: trunk
00:10
Fix for ticket #132: make the working directory the last choice for where to write temporary files, not the first choice. (CVS 712) check-in: 26a4e7e7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  Also found here are subroutines
    14     14   ** to generate VDBE code to evaluate expressions.
    15     15   **
    16         -** $Id: where.c,v 1.61 2002/08/13 23:02:58 drh Exp $
           16  +** $Id: where.c,v 1.62 2002/08/14 03:03:57 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   
    20     20   /*
    21     21   ** The query generator uses an array of instances of this structure to
    22     22   ** help it analyze the subexpressions of the WHERE clause.  Each WHERE
    23     23   ** clause subexpression is separated from the others by an AND operator.
................................................................................
   176    176     assert( pOrderBy!=0 );
   177    177     assert( pOrderBy->nExpr>0 );
   178    178     for(i=0; i<pOrderBy->nExpr; i++){
   179    179       Expr *p;
   180    180       if( (pOrderBy->a[i].sortOrder & SQLITE_SO_DIRMASK)!=SQLITE_SO_ASC ){
   181    181         /* Indices can only be used for ascending sort order */
   182    182         return 0;
          183  +    }
          184  +    if( (pOrderBy->a[i].sortOrder & SQLITE_SO_TYPEMASK)!=SQLITE_SO_UNK ){
          185  +      /* Do not sort by index if there is a COLLATE clause */
          186  +      return 0;
   183    187       }
   184    188       p = pOrderBy->a[i].pExpr;
   185    189       if( p->op!=TK_COLUMN || p->iTable!=base ){
   186    190         /* Can not use an index sort on anything that is not a column in the
   187    191         ** left-most table of the FROM clause */
   188    192         return 0;
   189    193       }

Changes to test/where.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the use of indices in WHERE clases.
    13     13   #
    14         -# $Id: where.test,v 1.9 2002/06/19 14:27:06 drh Exp $
           14  +# $Id: where.test,v 1.10 2002/08/14 03:03:58 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Build some test data
    20     20   #
    21     21   do_test where-1.0 {
................................................................................
   438    438     }
   439    439   } {1 0 2 1 3 1 nosort}
   440    440   do_test where-6.16 {
   441    441     cksort {
   442    442       SELECT t3.a, t1.x FROM t3, t1 WHERE t3.a=t1.w ORDER BY t1.x, t3.a LIMIT 3
   443    443     }
   444    444   } {1 0 2 1 3 1 sort}
          445  +do_test where-6.17 {
          446  +  cksort {
          447  +    SELECT y FROM t1 ORDER BY w COLLATE text LIMIT 3;
          448  +  }
          449  +} {4 121 10201 sort}
          450  +do_test where-6.18 {
          451  +  cksort {
          452  +    SELECT y FROM t1 ORDER BY w COLLATE numeric LIMIT 3;
          453  +  }
          454  +} {4 9 16 sort}
          455  +do_test where-6.19 {
          456  +  cksort {
          457  +    SELECT y FROM t1 ORDER BY w LIMIT 3;
          458  +  }
          459  +} {4 9 16 nosort}
          460  +
   445    461   
   446    462   
   447    463   finish_test

Changes to www/datatypes.tcl.

     1      1   #
     2      2   # Run this script to generated a datatypes.html output file
     3      3   #
     4         -set rcsid {$Id: datatypes.tcl,v 1.1 2002/08/14 00:08:13 drh Exp $}
            4  +set rcsid {$Id: datatypes.tcl,v 1.2 2002/08/14 03:03:58 drh Exp $}
     5      5   
     6      6   puts {<html>
     7      7   <head>
     8      8     <title>Datatypes In SQLite</title>
     9      9   </head>
    10     10   <body bgcolor="white">
    11     11   <h1 align="center">
................................................................................
   165    165   sqlite&gt; SELECT typeof('abc'+123);
   166    166   numeric
   167    167   sqlite&gt; SELECT typeof('abc'||123);
   168    168   text
   169    169   </pre></blockquote>
   170    170   
   171    171   <p>
   172         -For table columns, the datatype is determined by the datatype declaration
          172  +For table columns, the datatype is determined by the type declaration
   173    173   of the CREATE TABLE statement.  The datatype is text if and only if
   174    174   the type declaration contains one or more of the following strings:
   175    175   </p>
   176    176   
   177    177   <blockquote>
   178    178   BLOB<br>
   179    179   CHAR<br>