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
c8324002
Commit
c8324002
authored
Sep 17, 2008
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
845d7c71
53e01083
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
5 deletions
+39
-5
mysql-test/r/auto_increment.result
mysql-test/r/auto_increment.result
+8
-0
mysql-test/t/auto_increment.test
mysql-test/t/auto_increment.test
+10
-0
mysys/stacktrace.c
mysys/stacktrace.c
+10
-5
sql/sql_insert.cc
sql/sql_insert.cc
+11
-0
No files found.
mysql-test/r/auto_increment.result
View file @
c8324002
...
...
@@ -454,3 +454,11 @@ select last_insert_id();
last_insert_id()
3
drop table t1;
create table t1 (a int primary key auto_increment, b int, c int, e int, d timestamp default current_timestamp, unique(b),unique(c),unique(e));
insert into t1 values(null,1,1,1,now());
insert into t1 values(null,0,0,0,null);
replace into t1 values(null,1,0,2,null);
select last_insert_id();
last_insert_id()
3
drop table t1;
mysql-test/t/auto_increment.test
View file @
c8324002
...
...
@@ -314,5 +314,15 @@ insert into t1 values(null,0,0,null);
# this will delete two rows
replace
into
t1
values
(
null
,
1
,
0
,
null
);
select
last_insert_id
();
drop
table
t1
;
# Test of REPLACE when it does a INSERT+DELETE for all the conflicting rows
# (i.e.) when there are three rows conflicting in unique key columns with
# a row that is being inserted, all the three rows will be deleted and then
# the new rows will be inserted.
create
table
t1
(
a
int
primary
key
auto_increment
,
b
int
,
c
int
,
e
int
,
d
timestamp
default
current_timestamp
,
unique
(
b
),
unique
(
c
),
unique
(
e
));
insert
into
t1
values
(
null
,
1
,
1
,
1
,
now
());
insert
into
t1
values
(
null
,
0
,
0
,
0
,
null
);
replace
into
t1
values
(
null
,
1
,
0
,
2
,
null
);
select
last_insert_id
();
drop
table
t1
;
mysys/stacktrace.c
View file @
c8324002
...
...
@@ -451,7 +451,12 @@ static void get_symbol_path(char *path, size_t size)
if
(
!
strstr
(
path
,
module_dir
))
{
strncat
(
path
,
module_dir
,
size
);
size_t
dir_len
=
strlen
(
module_dir
);
if
(
size
>
dir_len
)
{
strncat
(
path
,
module_dir
,
size
-
1
);
size
-=
dir_len
;
}
}
}
CloseHandle
(
hSnap
);
...
...
@@ -459,9 +464,9 @@ static void get_symbol_path(char *path, size_t size)
/* Add _NT_SYMBOL_PATH, if present. */
envvar
=
getenv
(
"_NT_SYMBOL_PATH"
);
if
(
envvar
)
if
(
envvar
&&
size
)
{
strncat
(
path
,
envvar
,
size
);
strncat
(
path
,
envvar
,
size
-
1
);
}
}
...
...
@@ -483,7 +488,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
int
i
;
CONTEXT
context
;
STACKFRAME64
frame
=
{
0
};
static
char
symbol_path
[
MAX_SYMBOL_PATH
+
1
];
static
char
symbol_path
[
MAX_SYMBOL_PATH
];
if
(
!
exception_ptrs
||
!
init_dbghelp_functions
())
return
;
...
...
@@ -492,7 +497,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
context
=
*
(
exception_ptrs
->
ContextRecord
);
/*Initialize symbols.*/
pSymSetOptions
(
SYMOPT_LOAD_LINES
|
SYMOPT_NO_PROMPTS
|
SYMOPT_DEFERRED_LOADS
|
SYMOPT_DEBUG
);
get_symbol_path
(
symbol_path
,
MAX_SYMBOL_PATH
);
get_symbol_path
(
symbol_path
,
sizeof
(
symbol_path
)
);
pSymInitialize
(
hProcess
,
symbol_path
,
TRUE
);
/*Prepare stackframe for the first StackWalk64 call*/
...
...
sql/sql_insert.cc
View file @
c8324002
...
...
@@ -1545,6 +1545,17 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
}
}
}
/*
If more than one iteration of the above while loop is done, from the second
one the row being inserted will have an explicit value in the autoinc field,
which was set at the first call of handler::update_auto_increment(). This
value is saved to avoid thd->insert_id_for_cur_row becoming 0. Use this saved
autoinc value.
*/
if
(
table
->
file
->
insert_id_for_cur_row
==
0
)
table
->
file
->
insert_id_for_cur_row
=
insert_id_for_cur_row
;
thd
->
record_first_successful_insert_id_in_cur_stmt
(
table
->
file
->
insert_id_for_cur_row
);
/*
Restore column maps if they where replaced during an duplicate key
...
...
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