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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
572e18ae
Commit
572e18ae
authored
Oct 21, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>255 keys support in frm
parent
293a61ed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
sql/table.cc
sql/table.cc
+14
-3
sql/unireg.cc
sql/unireg.cc
+16
-9
No files found.
sql/table.cc
View file @
572e18ae
...
...
@@ -156,7 +156,16 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
VOID
(
my_seek
(
file
,(
ulong
)
uint2korr
(
head
+
6
),
MY_SEEK_SET
,
MYF
(
0
)));
if
(
read_string
(
file
,(
gptr
*
)
&
disk_buff
,
key_info_length
))
goto
err_not_open
;
/* purecov: inspected */
outparam
->
keys
=
keys
=
disk_buff
[
0
];
if
(
disk_buff
[
1
]
&
0x80
)
{
outparam
->
keys
=
keys
=
uint2korr
(
disk_buff
)
&
0x7fff
;
outparam
->
key_parts
=
key_parts
=
uint2korr
(
disk_buff
+
2
);
}
else
{
outparam
->
keys
=
keys
=
disk_buff
[
0
];
outparam
->
key_parts
=
key_parts
=
disk_buff
[
1
];
}
outparam
->
keys_for_keyread
.
init
().
set_prefix
(
keys
);
outparam
->
keys_in_use
.
init
().
set_prefix
(
keys
);
outparam
->
read_only_keys
.
init
().
clear_all
();
...
...
@@ -164,7 +173,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam
->
used_keys
.
init
();
outparam
->
keys_in_use_for_query
.
init
();
outparam
->
key_parts
=
key_parts
=
disk_buff
[
1
];
n_length
=
keys
*
sizeof
(
KEY
)
+
key_parts
*
sizeof
(
KEY_PART_INFO
);
if
(
!
(
keyinfo
=
(
KEY
*
)
alloc_root
(
&
outparam
->
mem_root
,
n_length
+
uint2korr
(
disk_buff
+
4
))))
...
...
@@ -269,7 +277,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
record
[
outparam
->
reclength
]
=
0
;
// For purify and ->c_ptr()
outparam
->
rec_buff_length
=
rec_buff_length
;
if
(
my_pread
(
file
,(
byte
*
)
record
,(
uint
)
outparam
->
reclength
,
(
ulong
)
(
uint2korr
(
head
+
6
)
+
uint2korr
(
head
+
14
)),
(
ulong
)
(
uint2korr
(
head
+
6
)
+
((
uint2korr
(
head
+
14
)
==
0xffff
?
uint4korr
(
head
+
10
)
:
uint2korr
(
head
+
14
)))),
MYF
(
MY_NABP
)))
goto
err_not_open
;
/* purecov: inspected */
/* HACK: table->record[2] is used instead of table->default_values here */
...
...
@@ -1114,6 +1124,7 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo,
key_length
=
keys
*
(
7
+
NAME_LEN
+
MAX_REF_PARTS
*
9
)
+
16
;
length
=
(
ulong
)
next_io_size
((
ulong
)
(
IO_SIZE
+
key_length
+
reclength
));
int4store
(
fileinfo
+
10
,
length
);
if
(
key_length
>
0xffff
)
key_length
=
0xffff
;
int2store
(
fileinfo
+
14
,
key_length
);
int2store
(
fileinfo
+
16
,
reclength
);
int4store
(
fileinfo
+
18
,
create_info
->
max_rows
);
...
...
sql/unireg.cc
View file @
572e18ae
...
...
@@ -92,15 +92,15 @@ int rea_create_table(THD *thd, my_string file_name,
DBUG_RETURN
(
1
);
}
uint
key_buff_length
=
uint2korr
(
fileinfo
+
14
)
;
keybuff
=
(
uchar
*
)
my_
alloca
(
key_buff_length
);
uint
key_buff_length
=
keys
*
(
7
+
NAME_LEN
+
MAX_REF_PARTS
*
9
)
+
16
;
keybuff
=
(
uchar
*
)
my_
malloc
(
key_buff_length
,
MYF
(
0
)
);
key_info_length
=
pack_keys
(
keybuff
,
keys
,
key_info
);
VOID
(
get_form_pos
(
file
,
fileinfo
,
&
formnames
));
if
(
!
(
filepos
=
make_new_entry
(
file
,
fileinfo
,
&
formnames
,
""
)))
goto
err
;
maxlength
=
(
uint
)
next_io_size
((
ulong
)
(
uint2korr
(
forminfo
)
+
1000
));
int2store
(
forminfo
+
2
,
maxlength
);
int4store
(
fileinfo
+
10
,
(
ulong
)
(
filepos
+
maxlength
)
);
int4store
(
fileinfo
+
10
,
key_buff_length
);
fileinfo
[
26
]
=
(
uchar
)
test
((
create_info
->
max_rows
==
1
)
&&
(
create_info
->
min_rows
==
1
)
&&
(
keys
==
0
));
int2store
(
fileinfo
+
28
,
key_info_length
);
...
...
@@ -148,7 +148,7 @@ int rea_create_table(THD *thd, my_string file_name,
#endif
my_free
((
gptr
)
screen_buff
,
MYF
(
0
));
my_
afree
((
gptr
)
keybuff
);
my_
free
((
gptr
)
keybuff
,
MYF
(
0
)
);
VOID
(
my_close
(
file
,
MYF
(
MY_WME
)));
if
(
ha_create_table
(
file_name
,
create_info
,
0
))
goto
err2
;
...
...
@@ -156,7 +156,7 @@ int rea_create_table(THD *thd, my_string file_name,
err:
my_free
((
gptr
)
screen_buff
,
MYF
(
0
));
my_
afree
((
gptr
)
keybuff
);
my_
free
((
gptr
)
keybuff
,
MYF
(
0
)
);
VOID
(
my_close
(
file
,
MYF
(
MY_WME
)));
err2:
my_delete
(
file_name
,
MYF
(
0
));
...
...
@@ -291,10 +291,17 @@ static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo)
}
*
(
pos
++
)
=
0
;
if
(
key_count
>
127
||
key_parts
>
127
)
{
key_count
|=
0x8000
;
int2store
(
keybuff
,
key_count
);
int2store
(
keybuff
+
2
,
key_parts
);
}
else
{
keybuff
[
0
]
=
(
uchar
)
key_count
;
keybuff
[
1
]
=
(
uchar
)
key_parts
;
length
=
(
uint
)
(
keyname_pos
-
keybuff
);
int2store
(
keybuff
+
2
,
length
);
}
length
=
(
uint
)
(
pos
-
keyname_pos
);
int2store
(
keybuff
+
4
,
length
);
DBUG_RETURN
((
uint
)
(
pos
-
keybuff
));
...
...
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