From 0040077d779749a21179863d73e6f6f9cd856fe9 Mon Sep 17 00:00:00 2001
From: drh
Date: Fri, 16 Jun 2000 20:51:26 +0000
Subject: [PATCH] :-) (CVS 100)
FossilOrigin-Name: 1d4fe5599ed0bae18dba5842ab7ea1d34b8ec3ad
---
manifest | 22 +++++++++++-----------
manifest.uuid | 2 +-
src/expr.c | 8 +++++++-
src/parse.y | 4 +++-
src/tokenize.c | 11 ++++++++++-
test/expr.test | 6 +++++-
test/main.test | 9 ++++++++-
www/changes.tcl | 4 ++++
8 files changed, 49 insertions(+), 17 deletions(-)
diff --git a/manifest b/manifest
index f4ec6d1cde..298b135172 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C :-)\s(CVS\s99)
-D 2000-06-15T16:49:49
+C :-)\s(CVS\s100)
+D 2000-06-16T20:51:26
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 4dc16840f68e3b599915e1ec8463d365474dd286
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
@@ -10,16 +10,16 @@ F src/build.c 925a785da2758269cb8773691e157ea5269178ba
F src/dbbe.c 4129779d7199c05200482046182f718a122f8c96
F src/dbbe.h a8a46f71238e0f09f3ec08fd9d1c8c7f4cdc49bf
F src/delete.c c267b93f7ccb5493b677fa18201880267c699aa8
-F src/expr.c 81512e0ae54de0d347c9dbd7ed8928028f4e1b41
+F src/expr.c a6797a4bd02b22835ffbbab8bd63dd91cc60ca3d
F src/insert.c ac4edfff474589c00b2490f206317dc5822122e5
F src/main.c e3297835b8e38ca726ac73f2c2bdb7cf08103197
-F src/parse.y 6a3085fd8e2c477e73468e6d1a278cb72254c0c9
+F src/parse.y 766844e4c695d560b4df5b5999162d5e167e3c90
F src/select.c 3a12d76074fa57d7c39c4436bdeb8d7e1eb6fdf4
F src/shell.c 78a35607a88b3d557e1666ae9d0c2c03cbb3553e
F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268
F src/sqliteInt.h 19954bd2f75632849b265b9d7163a67391ec5148
F src/tclsqlite.c 9f358618ae803bedf4fb96da5154fd45023bc1f7
-F src/tokenize.c 344754f81b55da5b19ea9504dfa16a9de68cd5ba
+F src/tokenize.c 77ff8164a8751994bc9926ce282847f653ac0c16
F src/update.c d8d90df714bac99c68446a0c49f3d957ca6fc3c8
F src/util.c 38e4bb5edf6fa92e677698c45785bf73c69b9e9f
F src/vdbe.c 00b2ab7e0c0df2ac6eb4bf659656afc30e76c66b
@@ -29,12 +29,12 @@ F test/all.test 0950c135cab7e60c07bd745ccfad1476211e5bd7
F test/copy.test b77a1214bd7756f2849d5c4fa6e715c0ff0c34eb
F test/dbbe.test 0a8e4293cf816e590dcbb01be4cd4e8f7f95bdc8
F test/delete.test 30edd2c7484274fb2e7dbc4a1ac769bb330b322e
-F test/expr.test 2209a2b06ea10ebb844b2c4ae08fe8345e5b87b2
+F test/expr.test 09b55ccf81cb8cc2f9cd83d592a2ba187ee48ba8
F test/in.test 962a605b6a3a619214f84d1950dfc44fcf0d8b8f
F test/index.test 79550e86e5c6954f8b7a8a8c5221224dfd8c3f11
F test/insert.test 66f4c3bd600fec8eb1e733b928cbe6fa885eff0c
F test/insert2.test 732405e30331635af8d159fccabe835eea5cd0c6
-F test/main.test a6c92ebc66b990b601a2f67bbd02404310a820e4
+F test/main.test b7366cc6f3690915a11834bc1090deeff08acaf9
F test/select1.test 64703852af34c85bb31b0a74bd73b340e8267f42
F test/select2.test 5e2783a48360b83956366ea24b2c5f0293015a84
F test/select3.test a9234b8424b6c6d71de534f43b91ade9be68e9cc
@@ -58,13 +58,13 @@ F www/arch.fig 4e26e9dca3c49724fc8f554c695ddea9f2413156
F www/arch.png c4d908b79065a72e7dcf19317f36d1324c550e87
F www/arch.tcl 4f6a9afecc099a27bba17b4f8cc9561abc15dc40
F www/c_interface.tcl 9ac800854272db5fe439e07b7435b243a5422293
-F www/changes.tcl d78eb88c0577b72b87b4bbd89732de6fa7fac17a
+F www/changes.tcl 7430f73d9426021bceb5316afbbdd227848a9967
F www/fileformat.tcl b11435fcd2cf2238a1c5e6d16fe5e83bcd14d434
F www/index.tcl 4116afce6a8c63d68882d2b00aa10b079e0129cd
F www/lang.tcl 1645e9107d75709be4c6099b643db235bbe0a151
F www/opcode.tcl 3cdc4bb2515fcfcbe853e3f0c91cd9199e82dadd
F www/sqlite.tcl 5420eab24b539928f80ea9b3088e2549d34f438d
-P f26d0cdf45221a8fc97253c2a1939e79ae866fc9
-R 3d6fd2505d53920665c06f6bc8a3f7f8
+P ac38f460c8f5b9e5bb9d3cf2549f1787055f05cf
+R eb3ea9e7c9df77f640bf4616de9a692b
U drh
-Z 2f294d1f9fc8c0dea244e0fb7909addf
+Z 1e0f1e829cfb4a46f528efe2fb7a735b
diff --git a/manifest.uuid b/manifest.uuid
index 84c6bdd81e..4cc60aef3b 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ac38f460c8f5b9e5bb9d3cf2549f1787055f05cf
\ No newline at end of file
+1d4fe5599ed0bae18dba5842ab7ea1d34b8ec3ad
\ No newline at end of file
diff --git a/src/expr.c b/src/expr.c
index 01d41f7048..7ca7123009 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -23,7 +23,7 @@
*************************************************************************
** This file contains C code routines used for processing expressions
**
-** $Id: expr.c,v 1.15 2000/06/11 23:50:13 drh Exp $
+** $Id: expr.c,v 1.16 2000/06/16 20:51:26 drh Exp $
*/
#include "sqliteInt.h"
@@ -505,6 +505,12 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
sqliteVdbeAddOp(v, op, 0, 0, 0, 0);
break;
}
+ case TK_CONCAT: {
+ sqliteExprCode(pParse, pExpr->pLeft);
+ sqliteExprCode(pParse, pExpr->pRight);
+ sqliteVdbeAddOp(v, OP_Concat, 2, 0, 0, 0);
+ break;
+ }
case TK_LT:
case TK_LE:
case TK_GT:
diff --git a/src/parse.y b/src/parse.y
index 6e17705fba..417891122d 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -26,7 +26,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.20 2000/06/09 14:14:33 drh Exp $
+** @(#) $Id: parse.y,v 1.21 2000/06/16 20:51:26 drh Exp $
*/
%token_prefix TK_
%token_type {Token}
@@ -297,6 +297,7 @@ fieldlist(A) ::= id(Y). {A = sqliteIdListAppend(0,&Y);}
%left GT GE LT LE.
%left PLUS MINUS.
%left STAR SLASH.
+%left CONCAT.
%right UMINUS.
%type expr {Expr*}
@@ -335,6 +336,7 @@ expr(A) ::= expr(X) PLUS expr(Y). {A = sqliteExpr(TK_PLUS, X, Y, 0);}
expr(A) ::= expr(X) MINUS expr(Y). {A = sqliteExpr(TK_MINUS, X, Y, 0);}
expr(A) ::= expr(X) STAR expr(Y). {A = sqliteExpr(TK_STAR, X, Y, 0);}
expr(A) ::= expr(X) SLASH expr(Y). {A = sqliteExpr(TK_SLASH, X, Y, 0);}
+expr(A) ::= expr(X) CONCAT expr(Y). {A = sqliteExpr(TK_CONCAT, X, Y, 0);}
expr(A) ::= expr(X) ISNULL. {A = sqliteExpr(TK_ISNULL, X, 0, 0);}
expr(A) ::= expr(X) NOTNULL. {A = sqliteExpr(TK_NOTNULL, X, 0, 0);}
expr(A) ::= NOT expr(X). {A = sqliteExpr(TK_NOT, X, 0, 0);}
diff --git a/src/tokenize.c b/src/tokenize.c
index c583930dde..c4d29f5857 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -27,7 +27,7 @@
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
-** $Id: tokenize.c,v 1.11 2000/06/08 16:26:24 drh Exp $
+** $Id: tokenize.c,v 1.12 2000/06/16 20:51:26 drh Exp $
*/
#include "sqliteInt.h"
#include
@@ -217,6 +217,15 @@ int sqliteGetToken(const char *z, int *tokenType){
return 2;
}
}
+ case '|': {
+ if( z[1]!='|' ){
+ *tokenType = TK_ILLEGAL;
+ return 1;
+ }else{
+ *tokenType = TK_CONCAT;
+ return 2;
+ }
+ }
case ',': {
*tokenType = TK_COMMA;
return 1;
diff --git a/test/expr.test b/test/expr.test
index d6341958a2..da529d856f 100644
--- a/test/expr.test
+++ b/test/expr.test
@@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing expressions.
#
-# $Id: expr.test,v 1.7 2000/06/08 16:26:25 drh Exp $
+# $Id: expr.test,v 1.8 2000/06/16 20:51:26 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -129,6 +129,10 @@ test_expr expr-3.25 {t1=NULL, t2='hi'} {t1 isnull} 1
test_expr expr-3.26 {t1=NULL, t2='hi'} {t2 isnull} 0
test_expr expr-3.27 {t1=NULL, t2='hi'} {t1 notnull} 0
test_expr expr-3.28 {t1=NULL, t2='hi'} {t2 notnull} 1
+test_expr expr-3.29 {t1='xyz', t2='abc'} {t1||t2} {xyzabc}
+test_expr expr-3.30 {t1=NULL, t2='abc'} {t1||t2} {abc}
+test_expr expr-3.31 {t1='xyz', t2=NULL} {t1||t2} {xyz}
+test_expr expr-3.32 {t1='xyz', t2='abc'} {t1||' hi '||t2} {{xyz hi abc}}
test_expr expr-4.1 {t1='abc', t2='Abc'} {t1t2} 1
diff --git a/test/main.test b/test/main.test
index 07763e6a29..c2807970b3 100644
--- a/test/main.test
+++ b/test/main.test
@@ -23,7 +23,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is exercising the code in main.c.
#
-# $Id: main.test,v 1.2 2000/06/08 16:26:25 drh Exp $
+# $Id: main.test,v 1.3 2000/06/16 20:51:26 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -78,6 +78,13 @@ do_test main-3.2 {
set v [catch {execsql {SELECT * from T1 where ~x}} msg]
lappend v $msg
} {1 {unrecognized token: "~"}}
+do_test main-3.3 {
+ catch {db close}
+ file delete -force testdb
+ sqlite db testdb
+ set v [catch {execsql {SELECT a|b from T1 where x}} msg]
+ lappend v $msg
+} {1 {unrecognized token: "|"}}
do_test main-3.3 {
catch {db close}
diff --git a/www/changes.tcl b/www/changes.tcl
index 452bf7cccb..3058979c68 100644
--- a/www/changes.tcl
+++ b/www/changes.tcl
@@ -17,6 +17,10 @@ proc chng {date desc} {
puts "
"
}
+chng {2000 June 16} {
+Added the concatenate string operator (||)
+}
+
chng {2000 June 12} {
Added the fcnt() function to the SQL interpreter. The fcnt() function
returns the number of database "Fetch" operations that have occurred.