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
ab0acbe1
Commit
ab0acbe1
authored
Apr 16, 2005
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
571ee3c8
e0e3def7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
11 deletions
+88
-11
myisam/mi_search.c
myisam/mi_search.c
+43
-8
myisam/mi_write.c
myisam/mi_write.c
+24
-2
mysql-test/r/myisam.result
mysql-test/r/myisam.result
+8
-0
mysql-test/t/myisam.test
mysql-test/t/myisam.test
+10
-0
sql/sql_delete.cc
sql/sql_delete.cc
+3
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+0
-1
No files found.
myisam/mi_search.c
View file @
ab0acbe1
...
...
@@ -211,9 +211,31 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
}
/* _mi_bin_search */
/* Used instead of _mi_bin_search() when key is packed */
/* Puts smaller or identical key in buff */
/* Key is searched sequentially */
/*
Locate a packed key in a key page.
SYNOPSIS
_mi_seq_search()
info Open table information.
keyinfo Key definition information.
page Key page (beginning).
key Search key.
key_len Length to use from search key or USE_WHOLE_KEY
comp_flag Search flags like SEARCH_SAME etc.
ret_pos RETURN Position in key page behind this key.
buff RETURN Copy of previous or identical unpacked key.
last_key RETURN If key is last in page.
DESCRIPTION
Used instead of _mi_bin_search() when key is packed.
Puts smaller or identical key in buff.
Key is searched sequentially.
RETURN
> 0 Key in 'buff' is smaller than search key.
0 Key in 'buff' is identical to search key.
< 0 Not found.
*/
int
_mi_seq_search
(
MI_INFO
*
info
,
register
MI_KEYDEF
*
keyinfo
,
uchar
*
page
,
uchar
*
key
,
uint
key_len
,
uint
comp_flag
,
uchar
**
ret_pos
,
...
...
@@ -722,7 +744,19 @@ uint _mi_get_static_key(register MI_KEYDEF *keyinfo, uint nod_flag,
}
/* _mi_get_static_key */
/* Key with is packed against previous key or key with a NULL column */
/*
get key witch is packed against previous key or key with a NULL column.
SYNOPSIS
_mi_get_pack_key()
keyinfo key definition information.
nod_flag If nod: Length of node pointer, else zero.
page_pos RETURN position in key page behind this key.
key IN/OUT in: prev key, out: unpacked key.
RETURN
key_length + length of data pointer
*/
uint
_mi_get_pack_key
(
register
MI_KEYDEF
*
keyinfo
,
uint
nod_flag
,
register
uchar
**
page_pos
,
register
uchar
*
key
)
...
...
@@ -1353,12 +1387,12 @@ _mi_calc_var_key_length(MI_KEYDEF *keyinfo,uint nod_flag,
Keys are compressed the following way:
If the max length of first key segment <= 127
character
s the prefix is
If the max length of first key segment <= 127
byte
s the prefix is
1 byte else it's 2 byte
prefix byte
The high bit is set if this is a prefix for the prev key
prefix byte
(s)
The high bit is set if this is a prefix for the prev key
length Packed length if the previous was a prefix byte
[length]
Length character of data
[length]
data bytes ('length' bytes)
next-key-seg Next key segments
If the first segment can have NULL:
...
...
@@ -1552,7 +1586,8 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
s_temp
->
part_of_prev_key
=
new_ref_length
;
s_temp
->
prev_length
=
org_key_length
-
(
new_ref_length
-
pack_marker
);
s_temp
->
n_ref_length
=
s_temp
->
n_length
=
s_temp
->
prev_length
;
s_temp
->
n_ref_length
=
s_temp
->
part_of_prev_key
;
s_temp
->
n_length
=
s_temp
->
prev_length
;
n_length
=
get_pack_length
(
s_temp
->
prev_length
);
s_temp
->
prev_key
+=
(
new_ref_length
-
pack_marker
);
length
+=
s_temp
->
prev_length
+
n_length
;
...
...
myisam/mi_write.c
View file @
ab0acbe1
...
...
@@ -421,8 +421,30 @@ err:
}
/* w_search */
/* Insert new key at right of key_pos */
/* Returns 2 if key contains key to upper level */
/*
Insert new key.
SYNOPSIS
_mi_insert()
info Open table information.
keyinfo Key definition information.
key New key.
anc_buff Key page (beginning).
key_pos Position in key page where to insert.
key_buff Copy of previous key.
father_buff parent key page for balancing.
father_key_pos position in parent key page for balancing.
father_page position of parent key page in file.
insert_last If to append at end of page.
DESCRIPTION
Insert new key at right of key_pos.
RETURN
2 if key contains key to upper level.
0 OK.
< 0 Error.
*/
int
_mi_insert
(
register
MI_INFO
*
info
,
register
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
uchar
*
anc_buff
,
uchar
*
key_pos
,
uchar
*
key_buff
,
...
...
mysql-test/r/myisam.result
View file @
ab0acbe1
...
...
@@ -586,6 +586,14 @@ truncate table t1;
ERROR HY000: MyISAM table 't1' is in use (most likely by a MERGE table). Try FLUSH TABLES.
insert into t1 values (1);
drop table t1,t2;
create table t1 (c1 int, c2 varchar(4) not null default '',
key(c2(3))) default charset=utf8;
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
update t1 set c2='A B' where c1=2;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
set storage_engine=MyISAM;
drop table if exists t1,t2,t3;
--- Testing varchar ---
...
...
mysql-test/t/myisam.test
View file @
ab0acbe1
...
...
@@ -553,6 +553,16 @@ truncate table t1;
insert
into
t1
values
(
1
);
drop
table
t1
,
t2
;
#
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
#
create
table
t1
(
c1
int
,
c2
varchar
(
4
)
not
null
default
''
,
key
(
c2
(
3
)))
default
charset
=
utf8
;
insert
into
t1
values
(
1
,
'A'
),
(
2
,
'B'
),
(
3
,
'A'
);
update
t1
set
c2
=
'A B'
where
c1
=
2
;
check
table
t1
;
drop
table
t1
;
#
# Test varchar
#
...
...
sql/sql_delete.cc
View file @
ab0acbe1
...
...
@@ -759,12 +759,15 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
if
(
!
ha_supports_generate
(
table_type
)
||
thd
->
lex
->
sphead
)
{
/* Probably InnoDB table */
ulong
save_options
=
thd
->
options
;
table_list
->
lock_type
=
TL_WRITE
;
thd
->
options
&=
~
(
ulong
)
(
OPTION_BEGIN
|
OPTION_NOT_AUTOCOMMIT
);
ha_enable_transaction
(
thd
,
FALSE
);
mysql_init_select
(
thd
->
lex
);
error
=
mysql_delete
(
thd
,
table_list
,
(
COND
*
)
0
,
(
SQL_LIST
*
)
0
,
HA_POS_ERROR
,
0
);
ha_enable_transaction
(
thd
,
TRUE
);
thd
->
options
=
save_options
;
DBUG_RETURN
(
error
);
}
if
(
lock_and_wait_for_table_name
(
thd
,
table_list
))
...
...
sql/sql_yacc.yy
View file @
ab0acbe1
...
...
@@ -3932,7 +3932,6 @@ select_part2:
{
LEX *lex= Lex;
SELECT_LEX *sel= lex->current_select;
lex->lock_option= TL_READ;
if (sel->linkage != UNION_TYPE)
mysql_init_select(lex);
lex->current_select->parsing_place= SELECT_LIST;
...
...
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