mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge 4.1 -> 5.0.
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/sql/mysqld.dsp: Auto merged client/Makefile.am: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged configure.in: Auto merged include/my_global.h: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/mix_innodb_myisam_binlog.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/rpl_change_master.result: Auto merged mysql-test/r/rpl_log.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/r/rpl_flush_log_loop.result: Auto merged mysql-test/r/rpl_flush_tables.result: Auto merged mysql-test/r/rpl_loaddata.result: Auto merged mysql-test/r/rpl_loaddata_rule_m.result: Auto merged mysql-test/r/rpl_loaddata_rule_s.result: Auto merged mysql-test/r/rpl_max_relay_size.result: Auto merged mysql-test/r/rpl_reset_slave.result: Auto merged mysql-test/r/rpl_temporary.result: Auto merged mysql-test/r/rpl_until.result: Auto merged mysql-test/r/rpl_user_variables.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/func_sapdb.test: Auto merged mysql-test/t/mix_innodb_myisam_binlog.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/rpl_change_master.test: Auto merged mysql-test/t/rpl_log.test: Auto merged mysql-test/t/variables.test: Auto merged netware/BUILD/compile-linux-tools: Auto merged netware/BUILD/compile-netware-END: Auto merged netware/BUILD/compile-netware-all: Auto merged netware/BUILD/compile-netware-standard: Auto merged mysql-test/t/rpl_empty_master_crash.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysql-test/t/rpl_flush_log_loop.test: Auto merged mysql-test/t/rpl_loaddata.test: Auto merged mysql-test/t/rpl_loaddata_rule_m.test: Auto merged mysql-test/t/rpl_loaddata_rule_s.test: Auto merged mysql-test/t/rpl_max_relay_size.test: Auto merged mysql-test/t/rpl_openssl.test: Auto merged mysql-test/t/rpl_relayrotate-slave.opt: Auto merged mysql-test/t/rpl_reset_slave.test: Auto merged mysql-test/t/rpl_trunc_binlog.test: Auto merged mysql-test/t/rpl_until.test: Auto merged mysql-test/t/rpl_user_variables.test: Auto merged mysql-test/t/subselect.test: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged scripts/mysql_install_db.sh: Auto merged sql/filesort.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_berkeley.h: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.h: Auto merged sql/lock.cc: Auto merged sql/log_event.h: Auto merged sql/mysqld.cc: Auto merged sql/net_serv.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/repl_failsafe.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql-common/client.c: Auto merged tests/client_test.c: Auto merged
This commit is contained in:
@@ -126,8 +126,8 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
|
||||
str_charset=cs;
|
||||
if (decimals >= NOT_FIXED_DEC)
|
||||
{
|
||||
sprintf(buff,"%.14g",num); // Enough for a DATETIME
|
||||
return copy(buff, (uint32) strlen(buff), &my_charset_latin1, cs);
|
||||
uint32 len= my_sprintf(buff,(buff, "%.14g",num));// Enough for a DATETIME
|
||||
return copy(buff, len, &my_charset_latin1, cs);
|
||||
}
|
||||
#ifdef HAVE_FCONVERT
|
||||
int decpt,sign;
|
||||
@@ -453,7 +453,7 @@ bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
|
||||
if (!arg_length) // Default argument
|
||||
if (!(arg_length= (uint32) strlen(s)))
|
||||
return FALSE;
|
||||
if (str_charset->mbmaxlen > 1)
|
||||
if (cs != str_charset && str_charset->mbmaxlen > 1)
|
||||
{
|
||||
uint32 add_length=arg_length * str_charset->mbmaxlen;
|
||||
if (realloc(str_length+ add_length))
|
||||
@@ -671,9 +671,8 @@ int String::reserve(uint32 space_needed, uint32 grow_by)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void String::qs_append(const char *str)
|
||||
void String::qs_append(const char *str, uint32 len)
|
||||
{
|
||||
int len = strlen(str);
|
||||
memcpy(Ptr + str_length, str, len + 1);
|
||||
str_length += len;
|
||||
}
|
||||
@@ -681,8 +680,7 @@ void String::qs_append(const char *str)
|
||||
void String::qs_append(double d)
|
||||
{
|
||||
char *buff = Ptr + str_length;
|
||||
sprintf(buff,"%.14g", d);
|
||||
str_length += strlen(buff);
|
||||
str_length+= my_sprintf(buff, (buff, "%.14g", d));
|
||||
}
|
||||
|
||||
void String::qs_append(double *d)
|
||||
@@ -692,12 +690,6 @@ void String::qs_append(double *d)
|
||||
qs_append(ld);
|
||||
}
|
||||
|
||||
void String::qs_append(const char &c)
|
||||
{
|
||||
Ptr[str_length] = c;
|
||||
str_length += sizeof(c);
|
||||
}
|
||||
|
||||
void String::qs_append(int i)
|
||||
{
|
||||
char *buff = Ptr + str_length;
|
||||
@@ -712,12 +704,56 @@ void String::qs_append(uint i)
|
||||
str_length += strlen(buff);
|
||||
}
|
||||
|
||||
/*
|
||||
Compare strings according to collation, without end space.
|
||||
|
||||
int sortcmp(const String *x,const String *y, CHARSET_INFO *cs)
|
||||
SYNOPSIS
|
||||
sortcmp()
|
||||
s First string
|
||||
t Second string
|
||||
cs Collation
|
||||
|
||||
NOTE:
|
||||
Normally this is case sensitive comparison
|
||||
|
||||
RETURN
|
||||
< 0 s < t
|
||||
0 s == t
|
||||
> 0 s > t
|
||||
*/
|
||||
|
||||
|
||||
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
|
||||
{
|
||||
return cs->coll->strnncollsp(cs,
|
||||
(unsigned char *) x->ptr(),x->length(),
|
||||
(unsigned char *) y->ptr(),y->length());
|
||||
return cs->coll->strnncollsp(cs,
|
||||
(unsigned char *) s->ptr(),s->length(),
|
||||
(unsigned char *) t->ptr(),t->length());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Compare strings byte by byte. End spaces are also compared.
|
||||
|
||||
SYNOPSIS
|
||||
stringcmp()
|
||||
s First string
|
||||
t Second string
|
||||
|
||||
NOTE:
|
||||
Strings are compared as a stream of unsigned chars
|
||||
|
||||
RETURN
|
||||
< 0 s < t
|
||||
0 s == t
|
||||
> 0 s > t
|
||||
*/
|
||||
|
||||
|
||||
int stringcmp(const String *s,const String *t)
|
||||
{
|
||||
uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len);
|
||||
int cmp= memcmp(s->ptr(), t->ptr(), len);
|
||||
return (cmp) ? cmp : (int) (s_len - t_len);
|
||||
}
|
||||
|
||||
|
||||
@@ -771,10 +807,14 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
const uchar *from_end= (const uchar*) from+from_length;
|
||||
char *to_start= to;
|
||||
uchar *to_end= (uchar*) to+to_length;
|
||||
int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *,
|
||||
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;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ((cnvres= from_cs->cset->mb_wc(from_cs, &wc, (uchar*) from,
|
||||
if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from,
|
||||
from_end)) > 0)
|
||||
from+= cnvres;
|
||||
else if (cnvres == MY_CS_ILSEQ)
|
||||
@@ -786,7 +826,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
break; // Impossible char.
|
||||
|
||||
outp:
|
||||
if ((cnvres= to_cs->cset->wc_mb(to_cs, wc, (uchar*) to, to_end)) > 0)
|
||||
if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0)
|
||||
to+= cnvres;
|
||||
else if (cnvres == MY_CS_ILUNI && wc != '?')
|
||||
{
|
||||
@@ -799,6 +839,7 @@ outp:
|
||||
return (uint32) (to - to_start);
|
||||
}
|
||||
|
||||
|
||||
void String::print(String *str)
|
||||
{
|
||||
char *st= (char*)Ptr, *end= st+str_length;
|
||||
|
Reference in New Issue
Block a user