]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The replace() function should return NULL if the second argument is an
authordrh <drh@noemail.net>
Fri, 27 Apr 2007 01:18:02 +0000 (01:18 +0000)
committerdrh <drh@noemail.net>
Fri, 27 Apr 2007 01:18:02 +0000 (01:18 +0000)
empty string.  Ticket #2324. (CVS 3877)

FossilOrigin-Name: e6a0c90dd9b4f7efe2153dd0c899b6e3d9846bd8

manifest
manifest.uuid
src/func.c
test/func.test

index 817c9f3c104ebeb526deff45e386700f33fb55b3..3cb57fd514f7aa5efb2783f511b27c1686b706c9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\slargely\suntested\scode\sfor\sthe\sincremental\svacuum\sfunction.\s(CVS\s3876)
-D 2007-04-26T14:42:35
+C The\sreplace()\sfunction\sshould\sreturn\sNULL\sif\sthe\ssecond\sargument\sis\san\nempty\sstring.\s\sTicket\s#2324.\s(CVS\s3877)
+D 2007-04-27T01:18:03
 F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -68,7 +68,7 @@ F src/date.c 94a6777df13d2aaacd19de080d9e8d3444364133
 F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
 F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
 F src/expr.c 2f0f9f89efe9170e5e6ca5d5e93a9d5896fff5ac
-F src/func.c acb2c5055629ae3eebd71868af10fe425ef05f06
+F src/func.c b989aa0ecc66a6d48b46f297299d52f12d84bce9
 F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
 F src/insert.c 413cc06990cb3c401e64e596776c1e43934f8841
@@ -235,7 +235,7 @@ F test/fts2j.test f68d7611f76309bc8b94170f3740d9fbbc061d9b
 F test/fts2k.test 222d0b3bc8667753f18406aaea9906a6098ea016
 F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3
 F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51
-F test/func.test 865febfd5b968f62b85c841c6a305b20346f7f44
+F test/func.test d66c42af501a77bd9b36c3d675d844b04db04765
 F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
 F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
 F test/incrvacuum.test ee05edff95770f211fab28132291c175cd282e0c
@@ -463,7 +463,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P d0745a43b6e037d16e1ec38c7c4d961a80d1ef48
-R 9a772b637e3a7b43df139e14c80416c0
-U danielk1977
-Z d70505e165a313929d975eb44dd8ca1a
+P f6a6d2b8872c05089810b1e095f39011f3035408
+R 6f143466ef3a026d3b533ab40fb9e7d5
+U drh
+Z 760fc2fbeee76e7c0e692c114576d572
index d22a631dfef213657355a3abfe9d10702cb8c690..0a29957bcd5bec98f4a956575ca8b600f8ef9c55 100644 (file)
@@ -1 +1 @@
-f6a6d2b8872c05089810b1e095f39011f3035408
\ No newline at end of file
+e6a0c90dd9b4f7efe2153dd0c899b6e3d9846bd8
\ No newline at end of file
index c6d67e01fede350d3e96a8ca5ab2c64b86ca9261..ad1bb59155ee15f50b47c138124392897285339f 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.140 2007/04/25 18:23:53 drh Exp $
+** $Id: func.c,v 1.141 2007/04/27 01:18:03 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -707,7 +707,7 @@ static void replaceFunc(
   if( zStr==0 ) return;
   nStr = sqlite3_value_bytes(argv[0]);
   zPattern = sqlite3_value_text(argv[1]);
-  if( zPattern==0 ) return;
+  if( zPattern==0 || zPattern[0]==0 ) return;
   nPattern = sqlite3_value_bytes(argv[1]);
   zRep = sqlite3_value_text(argv[2]);
   if( zRep==0 ) return;
index 6c57122153c1ef6bbf4ee3a49a61646ad0796daa..dc2df85f672552b7f4100c0dc542e2f4a7523f7e 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing built-in functions.
 #
-# $Id: func.test,v 1.60 2007/04/10 13:51:19 drh Exp $
+# $Id: func.test,v 1.61 2007/04/27 01:18:03 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -328,6 +328,12 @@ do_test func-9.10 {
 do_test func-9.11 {
   execsql {SELECT hex(replace('abcdefg','ef','12'))}
 } {61626364313267}
+do_test func-9.12 {
+  execsql {SELECT hex(replace('abcdefg','','12'))}
+} {{}}
+do_test func-9.13 {
+  execsql {SELECT hex(replace('aabcdefg','a','aaa'))}
+} {616161616161626364656667}
 
 # Use the "sqlite_register_test_function" TCL command which is part of
 # the text fixture in order to verify correct operation of some of