1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug10963/my50-bug10963

into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug10963/my51-bug10963


mysql-test/r/func_str.result:
  Auto merged
mysql-test/t/func_str.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
This commit is contained in:
unknown
2006-11-08 10:12:06 -05:00
4 changed files with 1096 additions and 55 deletions

View File

@ -2330,21 +2330,27 @@ longlong Item_func_locate::val_int()
return 0; /* purecov: inspected */
}
null_value=0;
uint start=0;
uint start0=0;
/* must be longlong to avoid truncation */
longlong start= 0;
longlong start0= 0;
my_match_t match;
if (arg_count == 3)
{
start0= start =(uint) args[2]->val_int()-1;
start=a->charpos(start);
if (start > a->length() || start+b->length() > a->length())
start0= start= args[2]->val_int() - 1;
if ((start < 0) || (start > a->length()))
return 0;
/* start is now sufficiently valid to pass to charpos function */
start= a->charpos(start);
if (start + b->length() > a->length())
return 0;
}
if (!b->length()) // Found empty string at start
return (longlong) (start+1);
return start + 1;
if (!cmp_collation.collation->coll->instr(cmp_collation.collation,
a->ptr()+start, a->length()-start,