Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
1cbe701d
Commit
1cbe701d
authored
Apr 12, 2005
by
georg@lmy002.wdf.sap.corp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for verification tests: loss of decimal places should not
return an error
parent
698399dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
libmysql/libmysql.c
libmysql/libmysql.c
+6
-7
tests/mysql_client_test.c
tests/mysql_client_test.c
+2
-3
No files found.
libmysql/libmysql.c
View file @
1cbe701d
...
@@ -3656,8 +3656,6 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3656,8 +3656,6 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
}
}
}
}
#define MY_TRUNC(val) (val < 0 ? - floor(-val) : floor(val))
/*
/*
Convert double/float column to supplied buffer of any type.
Convert double/float column to supplied buffer of any type.
...
@@ -3674,6 +3672,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3674,6 +3672,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
double
value
,
int
width
)
double
value
,
int
width
)
{
{
char
*
buffer
=
(
char
*
)
param
->
buffer
;
char
*
buffer
=
(
char
*
)
param
->
buffer
;
double
val64
=
(
value
<
0
?
-
floor
(
-
value
)
:
floor
(
value
));
switch
(
param
->
buffer_type
)
{
switch
(
param
->
buffer_type
)
{
case
MYSQL_TYPE_NULL
:
/* do nothing */
case
MYSQL_TYPE_NULL
:
/* do nothing */
...
@@ -3689,8 +3688,8 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3689,8 +3688,8 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
*
buffer
=
(
uint8
)
value
;
*
buffer
=
(
uint8
)
value
;
else
else
*
buffer
=
(
int8
)
value
;
*
buffer
=
(
int8
)
value
;
*
param
->
error
=
MY_TRUNC
(
value
)
!=
(
param
->
is_unsigned
?
(
double
)
((
uint8
)
*
buffer
)
:
*
param
->
error
=
val64
!=
(
param
->
is_unsigned
?
(
double
)
((
uint8
)
*
buffer
)
:
(
double
)
((
int8
)
*
buffer
));
(
double
)((
int8
)
*
buffer
));
break
;
break
;
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_SHORT
:
if
(
param
->
is_unsigned
)
if
(
param
->
is_unsigned
)
...
@@ -3703,7 +3702,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3703,7 +3702,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
short
data
=
(
short
)
value
;
short
data
=
(
short
)
value
;
shortstore
(
buffer
,
data
);
shortstore
(
buffer
,
data
);
}
}
*
param
->
error
=
MY_TRUNC
(
value
)
!=
(
param
->
is_unsigned
?
(
double
)
(
*
(
ushort
*
)
buffer
)
:
*
param
->
error
=
val64
!=
(
param
->
is_unsigned
?
(
double
)
(
*
(
ushort
*
)
buffer
)
:
(
double
)
(
*
(
short
*
)
buffer
));
(
double
)
(
*
(
short
*
)
buffer
));
break
;
break
;
case
MYSQL_TYPE_LONG
:
case
MYSQL_TYPE_LONG
:
...
@@ -3717,7 +3716,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3717,7 +3716,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
int32
data
=
(
int32
)
value
;
int32
data
=
(
int32
)
value
;
longstore
(
buffer
,
data
);
longstore
(
buffer
,
data
);
}
}
*
param
->
error
=
MY_TRUNC
(
value
)
!=
(
param
->
is_unsigned
?
(
double
)
(
*
(
uint32
*
)
buffer
)
:
*
param
->
error
=
val64
!=
(
param
->
is_unsigned
?
(
double
)
(
*
(
uint32
*
)
buffer
)
:
(
double
)
(
*
(
int32
*
)
buffer
));
(
double
)
(
*
(
int32
*
)
buffer
));
break
;
break
;
case
MYSQL_TYPE_LONGLONG
:
case
MYSQL_TYPE_LONGLONG
:
...
@@ -3731,7 +3730,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3731,7 +3730,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
longlong
data
=
(
longlong
)
value
;
longlong
data
=
(
longlong
)
value
;
longlongstore
(
buffer
,
data
);
longlongstore
(
buffer
,
data
);
}
}
*
param
->
error
=
MY_TRUNC
(
value
)
!=
(
param
->
is_unsigned
?
*
param
->
error
=
val64
!=
(
param
->
is_unsigned
?
ulonglong2double
(
*
(
ulonglong
*
)
buffer
)
:
ulonglong2double
(
*
(
ulonglong
*
)
buffer
)
:
(
double
)
(
*
(
longlong
*
)
buffer
));
(
double
)
(
*
(
longlong
*
)
buffer
));
break
;
break
;
...
...
tests/mysql_client_test.c
View file @
1cbe701d
...
@@ -3654,8 +3654,8 @@ static void test_bind_result_ext1()
...
@@ -3654,8 +3654,8 @@ static void test_bind_result_ext1()
check_execute
(
stmt
,
rc
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_fetch
(
stmt
);
rc
=
mysql_stmt_fetch
(
stmt
);
DIE_UNLESS
(
rc
==
MYSQL_DATA_TRUNCATED
);
printf
(
"rc=%d
\n
"
,
rc
);
DIE_UNLESS
(
bind
[
4
].
error_value
==
1
);
DIE_UNLESS
(
rc
==
0
);
if
(
!
opt_silent
)
if
(
!
opt_silent
)
{
{
...
@@ -12462,7 +12462,6 @@ static void test_truncation()
...
@@ -12462,7 +12462,6 @@ static void test_truncation()
/* double -> longlong: fractional part is lost */
/* double -> longlong: fractional part is lost */
DIE_UNLESS
(
++
bind
<
bind_array
+
bind_count
);
DIE_UNLESS
(
++
bind
<
bind_array
+
bind_count
);
DIE_UNLESS
(
*
bind
->
error
&&
*
(
longlong
*
)
bind
->
buffer
==
123
);
/* double -> ulonglong, negative fp number to unsigned integer */
/* double -> ulonglong, negative fp number to unsigned integer */
DIE_UNLESS
(
++
bind
<
bind_array
+
bind_count
);
DIE_UNLESS
(
++
bind
<
bind_array
+
bind_count
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment