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
65f5a15a
Commit
65f5a15a
authored
May 05, 2005
by
ram@ram-book.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into ram-book.(none):/home/ram/work/5.0
parents
6b053194
b9ccbfd1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
17 deletions
+59
-17
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
include/my_handler.h
include/my_handler.h
+3
-2
mysql-test/r/type_bit.result
mysql-test/r/type_bit.result
+21
-0
mysql-test/t/type_bit.test
mysql-test/t/type_bit.test
+22
-0
sql/key.cc
sql/key.cc
+0
-6
sql/unireg.cc
sql/unireg.cc
+12
-9
No files found.
BitKeeper/etc/logging_ok
View file @
65f5a15a
...
...
@@ -219,6 +219,7 @@ ram@deer.(none)
ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@ram-book.(none)
ram@ram.(none)
ramil@mysql.com
ranger@regul.home.lan
...
...
include/my_handler.h
View file @
65f5a15a
...
...
@@ -72,10 +72,11 @@ typedef struct st_HA_KEYSEG /* Key-portion */
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
{ \
(bit_ptr)[0]= ((bit_ptr)[0] &
((1 << (bit_ofs)) - 1
)) | \
(bit_ptr)[0]= ((bit_ptr)[0] &
~(((1 << (bit_len)) - 1) << (bit_ofs)
)) | \
((bits) << (bit_ofs)); \
if ((bit_ofs) + (bit_len) > 8) \
(bit_ptr)[1]= ((bits) & ((1 << (bit_len)) - 1)) >> (8 - (bit_ofs)); \
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
((bits) >> (8 - (bit_ofs))); \
}
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
...
...
mysql-test/r/type_bit.result
View file @
65f5a15a
...
...
@@ -437,3 +437,24 @@ a+0 b+0
2303 2
12345 4
drop table t1, t2;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
g bit(1) NOT NULL default 1, h char(1) default 'a');
insert into t1 set a=1;
select hex(g), h from t1;
hex(g) h
1 a
drop table t1;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
g bit(1) NOT NULL default 1);
insert into t1 set a=1;
select hex(g) from t1;
hex(g)
1
drop table t1;
create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
h char(1) default 'a') engine=myisam;
insert into t1 set a=1;
select h from t1;
h
a
drop table t1;
mysql-test/t/type_bit.test
View file @
65f5a15a
...
...
@@ -140,3 +140,25 @@ drop table t1;
create
table
t1
select
*
from
t2
;
select
a
+
0
,
b
+
0
from
t1
;
drop
table
t1
,
t2
;
#
# Bug #10179: problem with NULLs and default values
#
create
table
t1
(
a
int
,
b
time
,
c
tinyint
,
d
bool
,
e
char
(
10
),
f
bit
(
1
),
g
bit
(
1
)
NOT
NULL
default
1
,
h
char
(
1
)
default
'a'
);
insert
into
t1
set
a
=
1
;
select
hex
(
g
),
h
from
t1
;
drop
table
t1
;
create
table
t1
(
a
int
,
b
time
,
c
tinyint
,
d
bool
,
e
char
(
10
),
f
bit
(
1
),
g
bit
(
1
)
NOT
NULL
default
1
);
insert
into
t1
set
a
=
1
;
select
hex
(
g
)
from
t1
;
drop
table
t1
;
create
table
t1
(
a
int
,
b
time
,
c
tinyint
,
d
bool
,
e
char
(
10
),
f
bit
(
1
),
h
char
(
1
)
default
'a'
)
engine
=
myisam
;
insert
into
t1
set
a
=
1
;
select
h
from
t1
;
drop
table
t1
;
sql/key.cc
View file @
65f5a15a
...
...
@@ -197,12 +197,6 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
(
key_part
->
null_bit
==
128
),
field
->
bit_ofs
,
field
->
bit_len
);
}
else
{
clr_rec_bits
(
to_record
+
key_part
->
null_offset
+
(
key_part
->
null_bit
==
128
),
field
->
bit_ofs
,
field
->
bit_len
);
}
}
if
(
key_part
->
key_part_flag
&
HA_BLOB_PART
)
{
...
...
sql/unireg.cc
View file @
65f5a15a
...
...
@@ -647,7 +647,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
{
int
error
;
Field
::
utype
type
;
uint
firstpos
,
null_count
,
null_length
;
uint
null_count
;
uchar
*
buff
,
*
null_pos
;
TABLE
table
;
create_field
*
field
;
...
...
@@ -671,15 +671,14 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
table
.
s
->
db_low_byte_first
=
handler
->
low_byte_first
();
table
.
s
->
blob_ptr_size
=
portable_sizeof_char_ptr
;
firstpos
=
reclength
;
null_count
=
0
;
if
(
!
(
table_options
&
HA_OPTION_PACK_RECORD
))
{
null_fields
++
;
// Need one bit for delete mark
null_count
++
;
*
buff
|=
1
;
}
bfill
(
buff
,(
null_length
=
(
null_fields
+
7
)
/
8
),
255
);
null_pos
=
buff
+
null_count
/
8
;
null_pos
=
buff
;
List_iterator
<
create_field
>
it
(
create_fields
);
thd
->
count_cuted_fields
=
CHECK_FIELD_WARN
;
// To find wrong default values
...
...
@@ -689,7 +688,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
regfield don't have to be deleted as it's allocated with sql_alloc()
*/
Field
*
regfield
=
make_field
((
char
*
)
buff
+
field
->
offset
,
field
->
length
,
null_pos
,
null_pos
+
null_count
/
8
,
null_count
&
7
,
field
->
pack_flag
,
field
->
sql_type
,
...
...
@@ -703,11 +702,13 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
goto
err
;
// End of memory
if
(
!
(
field
->
flags
&
NOT_NULL_FLAG
))
{
*
regfield
->
null_ptr
|=
regfield
->
null_bit
;
null_count
++
;
}
if
((
uint
)
field
->
offset
<
firstpos
&&
regfield
->
type
()
!=
FIELD_TYPE_NULL
)
firstpos
=
field
->
offset
;
if
(
field
->
sql_type
==
FIELD_TYPE_BIT
&&
!
f_bit_as_char
(
field
->
pack_flag
))
null_count
+=
field
->
length
&
7
;
type
=
(
Field
::
utype
)
MTYP_TYPENR
(
field
->
unireg_check
);
...
...
@@ -737,7 +738,9 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
}
/* Fill not used startpos */
bfill
((
byte
*
)
buff
+
null_length
,
firstpos
-
null_length
,
255
);
if
(
null_count
)
*
(
null_pos
+
null_count
/
8
)
|=
~
(((
uchar
)
1
<<
(
null_count
&
7
))
-
1
);
error
=
(
int
)
my_write
(
file
,(
byte
*
)
buff
,(
uint
)
reclength
,
MYF_RW
);
err:
...
...
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