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
a2cc8218
Commit
a2cc8218
authored
Mar 02, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents
14ea63cd
6a933b2e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
6 deletions
+26
-6
include/myisam.h
include/myisam.h
+1
-0
myisam/mi_check.c
myisam/mi_check.c
+2
-2
myisam/mi_create.c
myisam/mi_create.c
+1
-1
mysql-test/r/auto_increment.result
mysql-test/r/auto_increment.result
+10
-0
mysql-test/t/auto_increment.test
mysql-test/t/auto_increment.test
+8
-0
sql/ha_myisam.cc
sql/ha_myisam.cc
+4
-3
No files found.
include/myisam.h
View file @
a2cc8218
...
...
@@ -100,6 +100,7 @@ typedef struct st_mi_create_info
ulong
raid_chunksize
;
uint
old_options
;
uint8
language
;
my_bool
with_auto_increment
;
}
MI_CREATE_INFO
;
struct
st_myisam_info
;
/* For referense */
...
...
myisam/mi_check.c
View file @
a2cc8218
...
...
@@ -3694,8 +3694,8 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
MI_KEYDEF
*
key
=
share
->
keyinfo
;
for
(
i
=
0
;
i
<
share
->
base
.
keys
;
i
++
,
key
++
)
{
if
(
!
(
key
->
flag
&
HA_NOSAME
)
&&
!
mi_too_big_key_for_sort
(
key
,
rows
)
&&
info
->
s
->
base
.
auto_key
!=
i
+
1
)
if
(
!
(
key
->
flag
&
(
HA_NOSAME
|
HA_AUTO_KEY
)
)
&&
!
mi_too_big_key_for_sort
(
key
,
rows
)
)
{
share
->
state
.
key_map
&=
~
((
ulonglong
)
1
<<
i
);
info
->
update
|=
HA_STATE_CHANGED
;
...
...
myisam/mi_create.c
View file @
a2cc8218
...
...
@@ -304,7 +304,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if
(
keydef
->
flag
&
HA_BINARY_PACK_KEY
)
options
|=
HA_OPTION_PACK_KEYS
;
/* Using packed keys */
if
(
keydef
->
flag
&
HA_AUTO_KEY
)
if
(
keydef
->
flag
&
HA_AUTO_KEY
&&
ci
->
with_auto_increment
)
share
.
base
.
auto_key
=
i
+
1
;
for
(
j
=
0
,
keyseg
=
keydef
->
seg
;
j
<
keydef
->
keysegs
;
j
++
,
keyseg
++
)
{
...
...
mysql-test/r/auto_increment.result
View file @
a2cc8218
...
...
@@ -84,6 +84,16 @@ ordid ord
3 sdj
1 zzz
drop table t1;
create table t1 (sid char(5), id int(2) NOT NULL auto_increment, key(sid, id));
create table t2 (sid char(20), id int(2));
insert into t2 values ('skr',NULL),('skr',NULL),('test',NULL);
insert into t1 select * from t2;
select * from t1;
sid id
skr 1
skr 2
test 1
drop table t1,t2;
create table t1 (a int not null primary key auto_increment);
insert into t1 values (0);
update t1 set a=0;
...
...
mysql-test/t/auto_increment.test
View file @
a2cc8218
...
...
@@ -52,6 +52,13 @@ insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,
select
*
from
t1
;
drop
table
t1
;
create
table
t1
(
sid
char
(
5
),
id
int
(
2
)
NOT
NULL
auto_increment
,
key
(
sid
,
id
));
create
table
t2
(
sid
char
(
20
),
id
int
(
2
));
insert
into
t2
values
(
'skr'
,
NULL
),(
'skr'
,
NULL
),(
'test'
,
NULL
);
insert
into
t1
select
*
from
t2
;
select
*
from
t1
;
drop
table
t1
,
t2
;
#
# Test of auto_increment columns when they are set to 0
#
...
...
@@ -62,3 +69,4 @@ update t1 set a=0;
select
*
from
t1
;
check
table
t1
;
drop
table
t1
;
sql/ha_myisam.cc
View file @
a2cc8218
...
...
@@ -1021,7 +1021,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
{
int
error
;
uint
i
,
j
,
recpos
,
minpos
,
fieldpos
,
temp_length
,
length
;
bool
found_auto_increment
=
0
;
bool
found_auto_increment
=
0
,
found_real_auto_increment
=
0
;
enum
ha_base_keytype
type
;
char
buff
[
FN_REFLEN
];
KEY
*
pos
;
...
...
@@ -1091,11 +1091,11 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
keydef
[
i
].
seg
[
j
].
null_bit
=
0
;
keydef
[
i
].
seg
[
j
].
null_pos
=
0
;
}
if
(
j
==
0
&&
field
->
flags
&
AUTO_INCREMENT_FLAG
&&
!
found_auto_increment
)
if
(
field
->
flags
&
AUTO_INCREMENT_FLAG
&&
!
found_auto_increment
)
{
keydef
[
i
].
flag
|=
HA_AUTO_KEY
;
found_auto_increment
=
1
;
found_real_auto_increment
=
(
j
==
0
);
}
if
(
field
->
type
()
==
FIELD_TYPE_BLOB
)
{
...
...
@@ -1177,6 +1177,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
bzero
((
char
*
)
&
create_info
,
sizeof
(
create_info
));
create_info
.
max_rows
=
table_arg
->
max_rows
;
create_info
.
reloc_rows
=
table_arg
->
min_rows
;
create_info
.
with_auto_increment
=
found_real_auto_increment
;
create_info
.
auto_increment
=
(
info
->
auto_increment_value
?
info
->
auto_increment_value
-
1
:
(
ulonglong
)
0
);
...
...
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