mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
Change the replace() function to return a copy of its first argument when
the 2nd argument is an empty string. Ticket #3624. (CVS 6226) FossilOrigin-Name: ffebf10f6fb2c7f3083992e2c712682b4cdcc6f0
This commit is contained in:
12
src/func.c
12
src/func.c
@@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.211 2009/01/24 11:30:43 drh Exp $
|
||||
** $Id: func.c,v 1.212 2009/02/01 18:08:41 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <stdlib.h>
|
||||
@@ -820,7 +820,15 @@ static void replaceFunc(
|
||||
nStr = sqlite3_value_bytes(argv[0]);
|
||||
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
|
||||
zPattern = sqlite3_value_text(argv[1]);
|
||||
if( zPattern==0 || zPattern[0]==0 ) return;
|
||||
if( zPattern==0 ){
|
||||
assert( sqlite3_value_type(argv[1])==SQLITE_NULL );
|
||||
return;
|
||||
}
|
||||
if( zPattern[0]==0 ){
|
||||
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
|
||||
sqlite3_result_value(context, argv[0]);
|
||||
return;
|
||||
}
|
||||
nPattern = sqlite3_value_bytes(argv[1]);
|
||||
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
|
||||
zRep = sqlite3_value_text(argv[2]);
|
||||
|
||||
Reference in New Issue
Block a user