summaryrefslogtreecommitdiff
path: root/sql/my_decimal.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-02-15 16:45:00 +0200
committerunknown <monty@mysql.com>2005-02-15 16:45:00 +0200
commit67b16d202b6e6912d6018685a0f7b0bb55cfbbad (patch)
tree16b9cc851452c212c3d986a1f88c4ae9a2f5d862 /sql/my_decimal.cc
parent40ffce74eb09dc1fd59d9d67fd44688be7f92fca (diff)
downloadmariadb-git-67b16d202b6e6912d6018685a0f7b0bb55cfbbad.tar.gz
Fixed failing test cases 'row.test' when running with --ps-protocol
Simple optimzations done while reviewing code client/mysqltest.c: Added options --enable-ps-warnings and --disable-ps-warnings (to fix failing test case) mysql-test/t/row.test: Disable warnings that comes from 'parse' parth sql/field.cc: Removed calls to is_null() in field functions. (Not needed as NULL handling is done on the level above fields) Indentation fixes Removed calls to alloca() as buffer needed was quite small. sql/field.h: Indentation changes and comment fixes sql/filesort.cc: Simple optimization during code review sql/item.cc: Indentation fixes Removed some unnecessary tests (added DBUG_ASSERTS() instead) sql/item_buff.cc: Indentation fixes sql/my_decimal.cc: Indentation fixes Simple optimization Fixed compiler warning sql/sql_update.cc: Removed unnessessary assignment
Diffstat (limited to 'sql/my_decimal.cc')
-rw-r--r--sql/my_decimal.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 027b33f1d1c..f028b1fa1a1 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -23,16 +23,18 @@
decimal_operation_results()
result decimal library return code (E_DEC_* see include/decimal.h)
- return
+ TODO
+ Fix error messages
+
+ RETURN
result
*/
+
int decimal_operation_results(int result)
{
- switch (result)
- {
+ switch (result) {
case E_DEC_OK:
break;
-//TODO: fix error messages
case E_DEC_TRUNCATED:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
@@ -78,20 +80,18 @@ int decimal_operation_results(int result)
*/
int my_decimal2string(uint mask, const my_decimal *d,
- int fixed_prec, int fixed_dec,
- char filler, String *str)
+ int fixed_prec, int fixed_dec,
+ char filler, String *str)
{
int length= (fixed_prec ? (fixed_prec + 1) : my_decimal_string_length(d));
int result;
if (str->alloc(length))
- return check_result(mask, E_DEC_OOM);
- char *sptr= (char *)str->ptr();
- int res= decimal2string((decimal *)d, sptr,
- &length, fixed_prec, fixed_dec,
- filler);
- result= check_result(mask, res);
+ return check_result(mask, E_DEC_OOM);
+ result= decimal2string((decimal*) d, (char*) str->ptr(),
+ &length, fixed_prec, fixed_dec,
+ filler);
str->length(length);
- return result;
+ return check_result(mask, result);
}
@@ -171,7 +171,7 @@ int str2my_decimal(uint mask, const char *from, uint length,
}
my_decimal_set_zero(decimal_value);
err= string2decimal((char *)from, (decimal *)decimal_value, &end);
- if ((end-from) != length && !err)
+ if ((uint) (end-from) != length && !err)
err= E_DEC_TRUNCATED;
check_result(mask, err);
return err;