mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge with 3.23.51
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-mysql_fix_extensions.sh: Delete: scripts/mysql_fix_extensions.sh Build-tools/Do-rpm: Auto merged Makefile.am: Auto merged client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged extra/resolve_stack_dump.c: Auto merged include/my_pthread.h: Auto merged include/my_sys.h: Auto merged include/mysqld_error.h: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged isam/pack_isam.c: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/func_if.result: Auto merged mysql-test/t/join.test: Auto merged mysys/array.c: Auto merged mysys/charset.c: Auto merged mysys/default.c: Auto merged mysys/hash.c: Auto merged mysys/my_thr_init.c: Auto merged mysys/raid.cc: Auto merged mysql-test/t/type_decimal.test: Auto merged sql/hostname.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_timefunc.h: Auto merged sql/log.cc: Auto merged sql/mini_client.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged strings/Makefile.am: Auto merged
This commit is contained in:
48
sql/field.cc
48
sql/field.cc
@ -63,8 +63,8 @@ const char field_separator=',';
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
** Calculate length of number and its parts
|
||||
** Increment cuted_fields if wrong number
|
||||
Calculate length of number and its parts
|
||||
Increment cuted_fields if wrong number
|
||||
*/
|
||||
|
||||
static bool
|
||||
@ -381,13 +381,34 @@ Field_decimal::reset(void)
|
||||
void Field_decimal::overflow(bool negative)
|
||||
{
|
||||
uint len=field_length;
|
||||
char *to=ptr;
|
||||
if (negative && !unsigned_flag)
|
||||
char *to=ptr, filler= '9';
|
||||
if (negative)
|
||||
{
|
||||
*to++ = '-';
|
||||
len--;
|
||||
if (!unsigned_flag)
|
||||
{
|
||||
/* Put - sign as a first digit so we'll have -999..999 or 999..999 */
|
||||
*to++ = '-';
|
||||
len--;
|
||||
}
|
||||
else
|
||||
{
|
||||
filler= '0'; // Fill up with 0
|
||||
if (!zerofill)
|
||||
{
|
||||
/*
|
||||
Handle unsigned integer without zerofill, in which case
|
||||
the number should be of format ' 0' or ' 0.000'
|
||||
*/
|
||||
uint whole_part=field_length- (dec ? dec+2 : 1);
|
||||
// Fill with spaces up to the first digit
|
||||
bfill(to, whole_part, ' ');
|
||||
to+= whole_part;
|
||||
len-= whole_part;
|
||||
// The main code will also handle the 0 before the decimal point
|
||||
}
|
||||
}
|
||||
}
|
||||
bfill(to,len,negative && unsigned_flag ? '0' : '9');
|
||||
bfill(to, len, filler);
|
||||
if (dec)
|
||||
ptr[field_length-dec-1]='.';
|
||||
return;
|
||||
@ -422,10 +443,15 @@ void Field_decimal::store(const char *from,uint len)
|
||||
from++;
|
||||
if (unsigned_flag) // No sign with zerofill
|
||||
{
|
||||
if (!error)
|
||||
current_thd->cuted_fields++;
|
||||
Field_decimal::overflow(1);
|
||||
return;
|
||||
if (decstr.sign_char == '+') // just remove "+"
|
||||
decstr.sign= 0;
|
||||
else
|
||||
{
|
||||
if (!error)
|
||||
current_thd->cuted_fields++;
|
||||
Field_decimal::overflow(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
Reference in New Issue
Block a user