From: drh Date: Wed, 20 Jun 2007 16:13:23 +0000 (+0000) Subject: A column name preceded by a unary "+" operator is considered to be X-Git-Tag: version-3.6.10~2070 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e09fe0b8176c9290fe2425729a3b19fced41578;p=thirdparty%2Fsqlite.git A column name preceded by a unary "+" operator is considered to be a column name when computing the collating sequence to be used by a comparison operator or ORDER BY clause. (CVS 4104) FossilOrigin-Name: 99a20f6a427b5e0e0a793f59ebca9d17bc633437 --- diff --git a/manifest b/manifest index 42ea6151b4..fbf171cf44 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\sdependency\son\slibm\sfor\sisnan().\s\sTicket\s#2436.\s(CVS\s4103) -D 2007-06-20T15:29:25 +C A\scolumn\sname\spreceded\sby\sa\sunary\s"+"\soperator\sis\sconsidered\sto\sbe\na\scolumn\sname\swhen\scomputing\sthe\scollating\ssequence\sto\sbe\sused\sby\na\scomparison\soperator\sor\sORDER\sBY\sclause.\s(CVS\s4104) +D 2007-06-20T16:13:23 F Makefile.in 5babd49c427a0e82e849c89a4d3c3c1e607ec014 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -72,7 +72,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675 F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988 F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b -F src/expr.c b68f1b208be50413b407da92bd7b0fce840999cf +F src/expr.c 763ca2b39fe551a6dc7d37ba40544311622eee32 F src/func.c 4668843e6f0d27653939e12fc32276fb8e38d21a F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 @@ -197,6 +197,7 @@ F test/collate4.test daf498e294dcd596b961d425c3f2dda117e4717e F test/collate5.test 8fb4e7e0241839356bd8710f437c32efb47bfff8 F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638 F test/collate7.test e23677b1fd271505302643a98178952bb65b6f21 +F test/collate8.test 7ed2461305ac959886a064dc1e3cf15e155a183f F test/colmeta.test 6505c73ab58796afcb7c89ba9f429d573fbc6e53 F test/conflict.test ac40064d46c4c259cf6c216d30aa5bcc26e7eea2 F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083 @@ -470,7 +471,7 @@ F www/conflict.tcl cdd0f4b59b0ba6d61f67e6a38f3ae45853bacb30 F www/copyright-release.html 294e011760c439c44951a6bfecd4c81a1ae359e8 F www/copyright-release.pdf cfca3558fc97095e57c6117d08f1f5b80d95125a F www/copyright.tcl b698824cea9b503751bf7380a98883a264d600a0 -F www/datatype3.tcl eca9badcfe2a898d64ebda88e804eb6ac7c4626c +F www/datatype3.tcl f7b6831c9088549efe021df4f71a34c0095d4e94 F www/datatypes.tcl 7c786d2e8ff434346764534ec015966d17efce60 F www/different.tcl 8b76ae88bf73e38097b7936e198df4f89baf587c F www/direct1b.gif 32b48b764244817b6b591898dc52a04299a7b8a7 @@ -508,7 +509,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P cb47a8297fd91becdc4e1c50fd84b3efedd3951f -R 6ebcd51f9fd0054745685eecbc671d5d +P 406675bb1c954dae95b9059f7f533ed57e3947d9 +R 451220594349c2cd54b6f02b90cec2b6 U drh -Z 72f79d91f079bd73d6674fde4cba4b70 +Z 2ba114933a917ec8eae9630f8aa1ded1 diff --git a/manifest.uuid b/manifest.uuid index 5a3ac3ae13..6d3eebfc55 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -406675bb1c954dae95b9059f7f533ed57e3947d9 \ No newline at end of file +99a20f6a427b5e0e0a793f59ebca9d17bc633437 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index b2ff41a79f..688d19441f 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.298 2007/06/15 16:37:29 danielk1977 Exp $ +** $Id: expr.c,v 1.299 2007/06/20 16:13:23 drh Exp $ */ #include "sqliteInt.h" #include @@ -71,8 +71,10 @@ Expr *sqlite3ExprSetColl(Parse *pParse, Expr *pExpr, Token *pName){ CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ CollSeq *pColl = 0; if( pExpr ){ + int op; pColl = pExpr->pColl; - if( pExpr->op==TK_CAST && !pColl ){ + op = pExpr->op; + if( (op==TK_CAST || op==TK_UPLUS) && !pColl ){ return sqlite3ExprCollSeq(pParse, pExpr->pLeft); } } diff --git a/test/collate8.test b/test/collate8.test new file mode 100644 index 0000000000..3e90c38c8c --- /dev/null +++ b/test/collate8.test @@ -0,0 +1,52 @@ +# +# 2007 June 20 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this script is making sure collations pass through the +# unary + operator. +# +# $Id: collate8.test,v 1.1 2007/06/20 16:13:23 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_test collate8-1.1 { + execsql { + CREATE TABLE t1(a TEXT COLLATE nocase); + INSERT INTO t1 VALUES('aaa'); + INSERT INTO t1 VALUES('BBB'); + INSERT INTO t1 VALUES('ccc'); + INSERT INTO t1 VALUES('DDD'); + SELECT a FROM t1 ORDER BY a; + } +} {aaa BBB ccc DDD} +do_test collate8-1.2 { + execsql { + SELECT rowid FROM t1 WHERE a<'ccc' ORDER BY 1 + } +} {1 2} +do_test collate8-1.3 { + execsql { + SELECT rowid FROM t1 WHERE a<'ccc' COLLATE binary ORDER BY 1 + } +} {1 2 4} +do_test collate8-1.4 { + execsql { + SELECT rowid FROM t1 WHERE +a<'ccc' ORDER BY 1 + } +} {1 2} +do_test collate8-1.5 { + execsql { + SELECT a FROM t1 ORDER BY +a + } +} {aaa BBB ccc DDD} + +finish_test diff --git a/www/datatype3.tcl b/www/datatype3.tcl index b79a589c9e..da400aefea 100644 --- a/www/datatype3.tcl +++ b/www/datatype3.tcl @@ -1,4 +1,4 @@ -set rcsid {$Id: datatype3.tcl,v 1.16 2007/02/23 14:20:38 drh Exp $} +set rcsid {$Id: datatype3.tcl,v 1.17 2007/06/20 16:13:23 drh Exp $} source common.tcl header {Datatypes In SQLite Version 3} puts { @@ -363,7 +363,8 @@ column, then the default collation type of the column determines the collation sequence to use for the comparison. If both operands are columns, then the collation type for the left operand determines the collation sequence used. If neither operand is a column, then the BINARY collation -sequence is used. +sequence is used. For the purposes of this paragraph, a column name +preceded by one or more unary "+" operators is considered a column name.