mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
merge with 4.1
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/triggers/post-commit: Auto merged Docs/Support/texi2html: Auto merged Makefile.am: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/my_time.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/examples/Makefile.am: Auto merged myisam/mi_check.c: Auto merged mysql-test/include/ps_modify.inc: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/auto_increment.result: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/insert.test: merge with 4.1 Fixed test case to not use 'if exists' when it shouldn't mysql-test/t/range.test: merge with 4.1 Added missing drop table sql/ha_ndbcluster.cc: merge with 4.1 Simple optimization: use max() instead of ? : sql/item_func.cc: merge with 4.1 (Added back old variable names for easier merges) sql/opt_range.cc: merge with 4.1 Removed argument 'parent_alloc' from QUICK_RANGE_SELECT as this was not used Added assert if using QUICK_GROUP_MIN_MAX_SELECT with parent_alloc as the init() function can't handle this Changed back get_quick_select_for_ref() to use it's own alloc root becasue this function may be called several times for one query sql/sql_handler.cc: merge with 4.1 change variable 'err' to 'error' as same function had a label named 'err' sql/sql_update.cc: Use multi-update code from 5.0 instead of 4.1 We will fix the locking code shortly in 5.0 to be faster than in 4.1
This commit is contained in:
@@ -331,19 +331,26 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
|
||||
/* Copy with charset convertion */
|
||||
|
||||
bool String::copy(const char *str, uint32 arg_length,
|
||||
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
||||
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs, uint *errors)
|
||||
{
|
||||
uint32 offset;
|
||||
if (!needs_conversion(arg_length, from_cs, to_cs, &offset))
|
||||
{
|
||||
if (errors)
|
||||
*errors= 0;
|
||||
return copy(str, arg_length, to_cs);
|
||||
}
|
||||
if ((from_cs == &my_charset_bin) && offset)
|
||||
{
|
||||
if (errors)
|
||||
*errors= 0;
|
||||
return copy_aligned(str, arg_length, offset, to_cs);
|
||||
|
||||
}
|
||||
uint32 new_length= to_cs->mbmaxlen*arg_length;
|
||||
if (alloc(new_length))
|
||||
return TRUE;
|
||||
str_length=copy_and_convert((char*) Ptr, new_length, to_cs,
|
||||
str, arg_length, from_cs);
|
||||
str, arg_length, from_cs, errors);
|
||||
str_charset=to_cs;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -537,7 +544,8 @@ uint32 String::numchars()
|
||||
|
||||
int String::charpos(int i,uint32 offset)
|
||||
{
|
||||
if (i<0) return i;
|
||||
if (i <= 0)
|
||||
return i;
|
||||
return str_charset->cset->charpos(str_charset,Ptr+offset,Ptr+str_length,i);
|
||||
}
|
||||
|
||||
@@ -781,7 +789,8 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
|
||||
|
||||
uint32
|
||||
copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
const char *from, uint32 from_length, CHARSET_INFO *from_cs)
|
||||
const char *from, uint32 from_length, CHARSET_INFO *from_cs,
|
||||
uint *errors)
|
||||
{
|
||||
int cnvres;
|
||||
my_wc_t wc;
|
||||
@@ -792,6 +801,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
const uchar *) = from_cs->cset->mb_wc;
|
||||
int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)=
|
||||
to_cs->cset->wc_mb;
|
||||
uint error_count= 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -800,6 +810,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
from+= cnvres;
|
||||
else if (cnvres == MY_CS_ILSEQ)
|
||||
{
|
||||
error_count++;
|
||||
from++;
|
||||
wc= '?';
|
||||
}
|
||||
@@ -811,12 +822,15 @@ outp:
|
||||
to+= cnvres;
|
||||
else if (cnvres == MY_CS_ILUNI && wc != '?')
|
||||
{
|
||||
error_count++;
|
||||
wc= '?';
|
||||
goto outp;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (errors)
|
||||
*errors= error_count;
|
||||
return (uint32) (to - to_start);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user