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
3d2c5738
Commit
3d2c5738
authored
Sep 13, 2006
by
kaa@polly.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into polly.local:/home/kaa/src/maint/m50-maint--07OGt
parents
b9811a6d
37eaf5cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
10 deletions
+96
-10
mysql-test/r/type_bit.result
mysql-test/r/type_bit.result
+30
-0
mysql-test/t/type_bit.test
mysql-test/t/type_bit.test
+15
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+24
-8
vio/viosocket.c
vio/viosocket.c
+27
-2
No files found.
mysql-test/r/type_bit.result
View file @
3d2c5738
...
@@ -572,4 +572,34 @@ def test t1 t1 a a 16 7 1 Y 0 0 63
...
@@ -572,4 +572,34 @@ def test t1 t1 a a 16 7 1 Y 0 0 63
a
a
`
`
drop table t1;
drop table t1;
create table bug15583(b BIT(8), n INT);
insert into bug15583 values(128, 128);
insert into bug15583 values(null, null);
insert into bug15583 values(0, 0);
insert into bug15583 values(255, 255);
select hex(b), bin(b), oct(b), hex(n), bin(n), oct(n) from bug15583;
hex(b) bin(b) oct(b) hex(n) bin(n) oct(n)
80 10000000 200 80 10000000 200
NULL NULL NULL NULL NULL NULL
0 0 0 0 0 0
FF 11111111 377 FF 11111111 377
select hex(b)=hex(n) as should_be_onetrue, bin(b)=bin(n) as should_be_onetrue, oct(b)=oct(n) as should_be_onetrue from bug15583;
should_be_onetrue should_be_onetrue should_be_onetrue
1 1 1
NULL NULL NULL
1 1 1
1 1 1
select hex(b + 0), bin(b + 0), oct(b + 0), hex(n), bin(n), oct(n) from bug15583;
hex(b + 0) bin(b + 0) oct(b + 0) hex(n) bin(n) oct(n)
80 10000000 200 80 10000000 200
NULL NULL NULL NULL NULL NULL
0 0 0 0 0 0
FF 11111111 377 FF 11111111 377
select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
conv(b, 10, 2) conv(b + 0, 10, 2)
10000000 10000000
NULL NULL
0 0
11111111 11111111
drop table bug15583;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/type_bit.test
View file @
3d2c5738
...
@@ -238,4 +238,19 @@ select * from t1;
...
@@ -238,4 +238,19 @@ select * from t1;
--
disable_metadata
--
disable_metadata
drop
table
t1
;
drop
table
t1
;
#
# Bug#15583: BIN()/OCT()/CONV() do not work with BIT values
#
create
table
bug15583
(
b
BIT
(
8
),
n
INT
);
insert
into
bug15583
values
(
128
,
128
);
insert
into
bug15583
values
(
null
,
null
);
insert
into
bug15583
values
(
0
,
0
);
insert
into
bug15583
values
(
255
,
255
);
select
hex
(
b
),
bin
(
b
),
oct
(
b
),
hex
(
n
),
bin
(
n
),
oct
(
n
)
from
bug15583
;
select
hex
(
b
)
=
hex
(
n
)
as
should_be_onetrue
,
bin
(
b
)
=
bin
(
n
)
as
should_be_onetrue
,
oct
(
b
)
=
oct
(
n
)
as
should_be_onetrue
from
bug15583
;
select
hex
(
b
+
0
),
bin
(
b
+
0
),
oct
(
b
+
0
),
hex
(
n
),
bin
(
n
),
oct
(
n
)
from
bug15583
;
select
conv
(
b
,
10
,
2
),
conv
(
b
+
0
,
10
,
2
)
from
bug15583
;
drop
table
bug15583
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item_strfunc.cc
View file @
3d2c5738
...
@@ -2381,17 +2381,33 @@ String *Item_func_conv::val_str(String *str)
...
@@ -2381,17 +2381,33 @@ String *Item_func_conv::val_str(String *str)
abs
(
to_base
)
>
36
||
abs
(
to_base
)
<
2
||
abs
(
to_base
)
>
36
||
abs
(
to_base
)
<
2
||
abs
(
from_base
)
>
36
||
abs
(
from_base
)
<
2
||
!
(
res
->
length
()))
abs
(
from_base
)
>
36
||
abs
(
from_base
)
<
2
||
!
(
res
->
length
()))
{
{
null_value
=
1
;
null_value
=
1
;
return
0
;
return
NULL
;
}
}
null_value
=
0
;
null_value
=
0
;
unsigned_flag
=
!
(
from_base
<
0
);
unsigned_flag
=
!
(
from_base
<
0
);
if
(
from_base
<
0
)
dec
=
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
-
from_base
,
&
endptr
,
&
err
);
if
(
args
[
0
]
->
field_type
()
==
MYSQL_TYPE_BIT
)
{
/*
Special case: The string representation of BIT doesn't resemble the
decimal representation, so we shouldn't change it to string and then to
decimal.
*/
dec
=
args
[
0
]
->
val_int
();
}
else
else
dec
=
(
longlong
)
my_strntoull
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
from_base
,
&
endptr
,
&
err
);
{
ptr
=
longlong2str
(
dec
,
ans
,
to_base
);
if
(
from_base
<
0
)
if
(
str
->
copy
(
ans
,(
uint32
)
(
ptr
-
ans
),
default_charset
()))
dec
=
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
-
from_base
,
&
endptr
,
&
err
);
else
dec
=
(
longlong
)
my_strntoull
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
from_base
,
&
endptr
,
&
err
);
}
ptr
=
longlong2str
(
dec
,
ans
,
to_base
);
if
(
str
->
copy
(
ans
,
(
uint32
)
(
ptr
-
ans
),
default_charset
()))
return
&
my_empty_string
;
return
&
my_empty_string
;
return
str
;
return
str
;
}
}
...
...
vio/viosocket.c
View file @
3d2c5738
...
@@ -559,9 +559,13 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
...
@@ -559,9 +559,13 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
}
}
/**
Close shared memory and DBUG_PRINT any errors that happen on closing.
@return Zero if all closing functions succeed, and nonzero otherwise.
*/
int
vio_close_shared_memory
(
Vio
*
vio
)
int
vio_close_shared_memory
(
Vio
*
vio
)
{
{
int
r
;
int
error_count
=
0
;
DBUG_ENTER
(
"vio_close_shared_memory"
);
DBUG_ENTER
(
"vio_close_shared_memory"
);
if
(
vio
->
type
!=
VIO_CLOSED
)
if
(
vio
->
type
!=
VIO_CLOSED
)
{
{
...
@@ -575,23 +579,44 @@ int vio_close_shared_memory(Vio * vio)
...
@@ -575,23 +579,44 @@ int vio_close_shared_memory(Vio * vio)
result if they are success.
result if they are success.
*/
*/
if
(
UnmapViewOfFile
(
vio
->
handle_map
)
==
0
)
if
(
UnmapViewOfFile
(
vio
->
handle_map
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"UnmapViewOfFile() failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"UnmapViewOfFile() failed"
));
}
if
(
CloseHandle
(
vio
->
event_server_wrote
)
==
0
)
if
(
CloseHandle
(
vio
->
event_server_wrote
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->esw) failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->esw) failed"
));
}
if
(
CloseHandle
(
vio
->
event_server_read
)
==
0
)
if
(
CloseHandle
(
vio
->
event_server_read
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->esr) failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->esr) failed"
));
}
if
(
CloseHandle
(
vio
->
event_client_wrote
)
==
0
)
if
(
CloseHandle
(
vio
->
event_client_wrote
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecw) failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecw) failed"
));
}
if
(
CloseHandle
(
vio
->
event_client_read
)
==
0
)
if
(
CloseHandle
(
vio
->
event_client_read
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecr) failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecr) failed"
));
}
if
(
CloseHandle
(
vio
->
handle_file_map
)
==
0
)
if
(
CloseHandle
(
vio
->
handle_file_map
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->hfm) failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->hfm) failed"
));
}
if
(
CloseHandle
(
vio
->
event_conn_closed
)
==
0
)
if
(
CloseHandle
(
vio
->
event_conn_closed
)
==
0
)
{
error_count
++
;
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecc) failed"
));
DBUG_PRINT
(
"vio_error"
,
(
"CloseHandle(vio->ecc) failed"
));
}
}
}
vio
->
type
=
VIO_CLOSED
;
vio
->
type
=
VIO_CLOSED
;
vio
->
sd
=
-
1
;
vio
->
sd
=
-
1
;
DBUG_RETURN
(
!
r
);
DBUG_RETURN
(
error_count
);
}
}
#endif
/* HAVE_SMEM */
#endif
/* HAVE_SMEM */
#endif
/* __WIN__ */
#endif
/* __WIN__ */
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