Discovered a small issue with new INSTR function in both 3.7.15.1 DLL
and Command Line EXE:

Select INSTR('test','blahblahtestblahblah');  returns 0
however
Select INSTR(''blahblahtestblahblah','test'); returns the right answer 9

Either the documentation or function needs to be corrected as
INSTR(X,Y) appear to operate dyslexically as INSTR(Y,X).

http://www.sqlite.org/lang_corefunc.html
instr(X,Y)      The instr(X,Y) function finds the first occurrence of
string X within string Y and returns the number of prior characters
plus 1, or 0 if X is nowhere found within Y. Or, if X and Y are both
BLOBs, then instr(X,Y) returns one more than the number bytes prior to
the first occurrence of X, or 0 if X does not occur anywhere within Y.
If both arguments X and Y to instr(X,Y) are non-NULL and are not BLOBs
then both are interpreted as strings. If either X or Y are NULL in
instr(X,Y) then the result is NULL.

Corrected version
instr(X,Y)      The instr(X,Y) function finds the first occurrence of
string Y within string X and returns the number of prior characters
plus 1, or 0 if Y is nowhere found within X. Or, if X and Y are both
BLOBs, then instr(X,Y) returns one more than the number bytes prior to
the first occurrence of Y, or 0 if Y does not occur anywhere within X.
If both arguments X and Y to instr(X,Y) are non-NULL and are not BLOBs
then both are interpreted as strings. If either X or Y are NULL in
instr(X,Y) then the result is NULL.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to