]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
:-) (CVS 65)
authordrh <drh@noemail.net>
Wed, 7 Jun 2000 00:12:24 +0000 (00:12 +0000)
committerdrh <drh@noemail.net>
Wed, 7 Jun 2000 00:12:24 +0000 (00:12 +0000)
FossilOrigin-Name: 80ee166ed1bb3694530a73c57544cb4d16964884

manifest
manifest.uuid
src/shell.c
src/vdbe.c
test/sort.test [new file with mode: 0644]

index 9f8d97d65672e9781c96e9b3333eab9189e9bc1a..ba7cda2996dc96f4fec98cf4411023f125fcf6d0 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C :-)\s(CVS\s64)
-D 2000-06-06T22:19:01
+C :-)\s(CVS\s65)
+D 2000-06-07T00:12:25
 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
 F Makefile.in 17ba1ccf8d2d40c627796bba8f72952365d6d644
 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
@@ -15,14 +15,14 @@ F src/insert.c 5e69dd70c3f91cf5ec5090f39fd6cd8e135af9bf
 F src/main.c 93a7ad14bb5a82ad13ad59da23ef674a94b0c3d6
 F src/parse.y 8b632f4c4ff2f4400f15592ca9d8fda27d97d0c4
 F src/select.c 74fa3af62bfa2e6e29f43153f883fd28c295b853
-F src/shell.c 5fa24c0bb678782ffe9070128e3e160674f297eb
+F src/shell.c a2a2c5c6d9a8f640307edaf560a33c463ad6e3eb
 F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268
 F src/sqliteInt.h 3cca846df0a8b5f811cf4f8021303547cd8f21fd
 F src/tclsqlite.c 9f358618ae803bedf4fb96da5154fd45023bc1f7
 F src/tokenize.c 09373590cc3942aa4744eb431ac5b5ce31e7cfea
 F src/update.c 18746f920f989b3d19d96c08263c92584823cd35
 F src/util.c 33f9baa01e45394ef0cf85361a0e872987884315
-F src/vdbe.c d78231479a357b69fa61283c18477f1c208088f9
+F src/vdbe.c 221e46a1e9f7b526d66939b536321113b1f7947a
 F src/vdbe.h 8f79f57c66ce1030f6371ff067b326d627a52c6d
 F src/where.c c9b90e7672f4662a83ef9a27a193020d69fe034c
 F test/all.test 0950c135cab7e60c07bd745ccfad1476211e5bd7
@@ -35,6 +35,7 @@ F test/insert.test b4c186ffa4b97a231643726f3bcee29815b24eaf
 F test/select1.test 2311bddd40bca257c27a7d141ed2a359bbdbc906
 F test/select2.test 3cd3c0f9d67e98b1b54af5853679b4a111224410
 F test/select3.test 73ae8c7b80c4e03a9c29d12f2ea1782e28b8e61f
+F test/sort.test d582086c4bb7df3fbf50aa72e69d7e235e9f8e31
 F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5
 F test/table.test 85d6f410d127ec508c6640f02d7c40d218414e81
 F test/tester.tcl 44690d463c1dc83a4c76ccde07cc146a988600f6
@@ -50,7 +51,7 @@ F www/c_interface.tcl 9ac800854272db5fe439e07b7435b243a5422293
 F www/changes.tcl 04e66b4257589ff78a7e1de93e9dda4725fb03d6
 F www/index.tcl 52e29a4eeda8d59e91af43c61fef177c5f2ffd53
 F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd
-P 65d2100d33350e6bce30d4d75f3cead9fcab3efb
-R e51fd857be77f5fde7a86a91f2309159
+P 3a2f4dcab299aceeba3afc223f424cd1d4d13c9d
+R 8071c3f31f98240ab06f25e12e1bf1fb
 U drh
-Z bce721fb4a38727dd225a300710a20ea
+Z bb54d229ead7ce076e23b0376d456ad7
index fb662c5a01eada684054f132d4bd5e60eda63c90..7fe9ba4ed65cc38ca8e8b2afb0aacaf9815bfddd 100644 (file)
@@ -1 +1 @@
-3a2f4dcab299aceeba3afc223f424cd1d4d13c9d
\ No newline at end of file
+80ee166ed1bb3694530a73c57544cb4d16964884
\ No newline at end of file
index a188b4bc0bf8ca5b8081234a2195ba81e3d8d142..c14f69bea0ab0d3b4128c00fad1e0928996164ea 100644 (file)
@@ -24,7 +24,7 @@
 ** This file contains code to implement the "sqlite" command line
 ** utility for accessing SQLite databases.
 **
-** $Id: shell.c,v 1.8 2000/06/05 02:07:04 drh Exp $
+** $Id: shell.c,v 1.9 2000/06/07 00:12:25 drh Exp $
 */
 #include <stdlib.h>
 #include <string.h>
@@ -365,7 +365,9 @@ static void do_meta_command(char *zLine, sqlite *db, struct callback_data *p){
     data.showHeader = 0;
     data.mode = MODE_List;
     if( nArg>1 ){
-      sprintf(zSql, "SELECT sql FROM sqlite_master WHERE name LIKE '%.900s'",
+      sprintf(zSql, "SELECT sql FROM sqlite_master "
+                    "WHERE tbl_name LIKE '%.800s'"
+                    "ORDER BY type DESC, name",
          azArg[1]);
     }else{
       sprintf(zSql, "SELECT sql FROM sqlite_master "
index 83118cec8b9cd54e219f2469e37810964c718d06..9b8bfd15fff4dc235531b6f46b15305411eabce5 100644 (file)
@@ -41,7 +41,7 @@
 ** But other routines are also provided to help in building up
 ** a program instruction by instruction.
 **
-** $Id: vdbe.c,v 1.24 2000/06/06 22:13:55 drh Exp $
+** $Id: vdbe.c,v 1.25 2000/06/07 00:12:25 drh Exp $
 */
 #include "sqliteInt.h"
 #include <unistd.h>
@@ -2375,9 +2375,9 @@ int sqliteVdbeExec(
         zNewKey = sqliteMalloc( nByte );
         if( zNewKey==0 ) goto no_mem;
         j = 0;
-        k = nField-1;
+        k = 0;
         for(i=p->tos-nField+1; i<=p->tos; i++){
-          zNewKey[j++] = pOp->p3[k--];
+          zNewKey[j++] = pOp->p3[k++];
           memcpy(&zNewKey[j], p->zStack[i], p->aStack[i].n-1);
           j += p->aStack[i].n-1;
           zNewKey[j++] = 0;
diff --git a/test/sort.test b/test/sort.test
new file mode 100644 (file)
index 0000000..ae1abd9
--- /dev/null
@@ -0,0 +1,95 @@
+# Copyright (c) 1999, 2000 D. Richard Hipp
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA  02111-1307, USA.
+#
+# Author contact information:
+#   drh@hwaci.com
+#   http://www.hwaci.com/drh/
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.  The
+# focus of this file is testing the CREATE TABLE statement.
+#
+# $Id: sort.test,v 1.1 2000/06/07 00:12:25 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Create a bunch of data to sort against
+#
+do_test sort-1.0 {
+  set fd [open data.txt w]
+  puts $fd "1\tone\t0\tI\t3.141592653"
+  puts $fd "2\ttwo\t1\tII\t2.15"
+  puts $fd "3\tthree\t1\tIII\t4221.0"
+  puts $fd "4\tfour\t2\tIV\t-0.0013442"
+  puts $fd "5\tfive\t2\tV\t-11"
+  puts $fd "6\tsix\t2\tVI\t0.123"
+  puts $fd "7\tseven\t2\tVII\t123.0"
+  puts $fd "8\teight\t3\tVIII\t-1.6"
+  close $fd
+  execsql {
+    CREATE TABLE t1(
+       n int,
+       v varchar(10),
+       log int,
+       roman varchar(10),
+       flt real
+    );
+    COPY t1 FROM 'data.txt'
+  }
+  file delete data.txt
+  execsql {SELECT count(*) FROM t1}
+} {8}
+
+do_test sort-1.1 {
+  execsql {SELECT n FROM t1 ORDER BY n}
+} {1 2 3 4 5 6 7 8}
+do_test sort-1.2 {
+  execsql {SELECT n FROM t1 ORDER BY n DESC}
+} {8 7 6 5 4 3 2 1}
+do_test sort-1.3a {
+  execsql {SELECT v FROM t1 ORDER BY v}
+} {eight five four one seven six three two}
+do_test sort-1.3b {
+  execsql {SELECT n FROM t1 ORDER BY v}
+} {8 5 4 1 7 6 3 2}
+do_test sort-1.4 {
+  execsql {SELECT n FROM t1 ORDER BY v DESC}
+} {2 3 6 7 1 4 5 8}
+do_test sort-1.5 {
+  execsql {SELECT flt FROM t1 ORDER BY flt}
+} {-11 -1.6 -0.0013442 0.123 2.15 3.141592653 123.0 4221.0}
+do_test sort-1.6 {
+  execsql {SELECT flt FROM t1 ORDER BY flt DESC}
+} {4221.0 123.0 3.141592653 2.15 0.123 -0.0013442 -1.6 -11}
+do_test sort-1.7 {
+  execsql {SELECT roman FROM t1 ORDER BY roman}
+} {I II III IV V VI VII VIII}
+do_test sort-1.8 {
+  execsql {SELECT n FROM t1 ORDER BY log, flt}
+} {1 2 3 5 4 6 7 8}
+do_test sort-1.9 {
+  execsql {SELECT n FROM t1 ORDER BY log, flt DESC}
+} {1 3 2 7 6 4 5 8}
+do_test sort-1.10 {
+  execsql {SELECT n FROM t1 ORDER BY log DESC, flt}
+} {8 5 4 6 7 2 3 1}
+do_test sort-1.11 {
+  execsql {SELECT n FROM t1 ORDER BY log DESC, flt DESC}
+} {8 7 6 4 5 3 2 1}
+
+finish_test