Commit 9c6947fd authored by marko's avatar marko

branches/zip: Merge revisions 838:861 from trunk.

parent 841f288a
...@@ -3881,8 +3881,8 @@ dict_update_statistics_low( ...@@ -3881,8 +3881,8 @@ dict_update_statistics_low(
index = dict_table_get_first_index(table); index = dict_table_get_first_index(table);
table->stat_n_rows = index->stat_n_diff_key_vals table->stat_n_rows = index->stat_n_diff_key_vals[
[dict_index_get_n_unique(index)]; dict_index_get_n_unique(index)];
table->stat_clustered_index_size = index->stat_index_size; table->stat_clustered_index_size = index->stat_index_size;
...@@ -4080,8 +4080,8 @@ dict_index_print_low( ...@@ -4080,8 +4080,8 @@ dict_index_print_low(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
if (index->n_user_defined_cols > 0) { if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals n_vals = index->stat_n_diff_key_vals[
[index->n_user_defined_cols]; index->n_user_defined_cols];
} else { } else {
n_vals = index->stat_n_diff_key_vals[1]; n_vals = index->stat_n_diff_key_vals[1];
} }
...@@ -4295,9 +4295,9 @@ dict_print_info_on_foreign_keys( ...@@ -4295,9 +4295,9 @@ dict_print_info_on_foreign_keys(
if (i) { if (i) {
putc(' ', file); putc(' ', file);
} }
ut_print_name(file, trx, FALSE, ut_print_name(
foreign->referenced_col_names file, trx, FALSE,
[i]); foreign->referenced_col_names[i]);
} }
putc(')', file); putc(')', file);
......
...@@ -38,7 +38,6 @@ do ...@@ -38,7 +38,6 @@ do
done done
cd to-mysql/storage/innobase cd to-mysql/storage/innobase
mv handler ../../sql
mv mysql-test/*.test mysql-test/*.opt ../../mysql-test/t mv mysql-test/*.test mysql-test/*.opt ../../mysql-test/t
mv mysql-test/*.result ../../mysql-test/r mv mysql-test/*.result ../../mysql-test/r
......
...@@ -1183,11 +1183,10 @@ fsp_try_extend_data_file( ...@@ -1183,11 +1183,10 @@ fsp_try_extend_data_file(
< srv_data_file_sizes[srv_n_data_files - 1]) { < srv_data_file_sizes[srv_n_data_files - 1]) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: Last data file" "InnoDB: Error: Last data file size"
" size is %lu," " is %lu, max size allowed %lu\n",
" max size allowed %lu\n", (ulong) srv_data_file_sizes[
(ulong) srv_data_file_sizes srv_n_data_files - 1],
[srv_n_data_files - 1],
(ulong) srv_last_file_size_max); (ulong) srv_last_file_size_max);
} }
......
This diff is collapsed.
...@@ -124,7 +124,7 @@ min(7) ...@@ -124,7 +124,7 @@ min(7)
NULL NULL
select min(7) from DUAL; select min(7) from DUAL;
min(7) min(7)
NULL 7
explain select min(7) from t2m join t1m; explain select min(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
...@@ -139,7 +139,7 @@ max(7) ...@@ -139,7 +139,7 @@ max(7)
NULL NULL
select max(7) from DUAL; select max(7) from DUAL;
max(7) max(7)
NULL 7
explain select max(7) from t2m join t1m; explain select max(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
...@@ -178,7 +178,7 @@ min(7) ...@@ -178,7 +178,7 @@ min(7)
NULL NULL
select min(7) from DUAL; select min(7) from DUAL;
min(7) min(7)
NULL 7
explain select min(7) from t2i join t1i; explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t2i ALL NULL NULL NULL NULL 1
...@@ -194,7 +194,7 @@ max(7) ...@@ -194,7 +194,7 @@ max(7)
NULL NULL
select max(7) from DUAL; select max(7) from DUAL;
max(7) max(7)
NULL 7
explain select max(7) from t2i join t1i; explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1 1 SIMPLE t2i ALL NULL NULL NULL NULL 1
...@@ -432,22 +432,44 @@ ifnull( c, ...@@ -432,22 +432,44 @@ ifnull( c,
0 ) + 1; 0 ) + 1;
select last_insert_id(); select last_insert_id();
last_insert_id() last_insert_id()
1 2
select last_insert_id(0);
last_insert_id(0)
0
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
0
select * from t2; select * from t2;
k a c k a c
1 6 1 1 6 2
2 7 NULL 2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1); insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id(); select last_insert_id();
last_insert_id() last_insert_id()
1 0
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id(); select last_insert_id();
last_insert_id() last_insert_id()
11 11
select * from t2; select * from t2;
k a c k a c
1 6 1 1 6 2
2 7 NULL
10 8 1
11 15 1
12 20 1
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 3
2 7 NULL 2 7 NULL
10 8 1 10 8 1
11 15 1 11 15 1
......
...@@ -369,8 +369,8 @@ insert into t1 values('aaa'); ...@@ -369,8 +369,8 @@ insert into t1 values('aaa');
drop table t1; drop table t1;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY # Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": now LAST_INSERT_ID() will return the id of the updated # UPDATE": if the row is updated, it's like a regular UPDATE:
# row. # LAST_INSERT_ID() is not affected.
CREATE TABLE `t2` ( CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment, `k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL, `a` int(11) default NULL,
...@@ -390,6 +390,12 @@ insert into t2 ( a ) values ( 6 ) on duplicate key update c = ...@@ -390,6 +390,12 @@ insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c, ifnull( c,
0 ) + 1; 0 ) + 1;
select last_insert_id(); select last_insert_id();
# test again when last_insert_id() is 0 initially
select last_insert_id(0);
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
select * from t2; select * from t2;
# Test of LAST_INSERT_ID() when autogenerated will fail: # Test of LAST_INSERT_ID() when autogenerated will fail:
...@@ -402,5 +408,14 @@ insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1); ...@@ -402,5 +408,14 @@ insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id(); select last_insert_id();
select * from t2; select * from t2;
drop table t2; # Test of the workaround which enables people to know the id of the
# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
select * from t2;
drop table t2;
...@@ -91,8 +91,9 @@ row_build_index_entry( ...@@ -91,8 +91,9 @@ row_build_index_entry(
} }
for (i = 0; i < entry_len; i++) { for (i = 0; i < entry_len; i++) {
const dict_col_t* col;
ind_field = dict_index_get_nth_field(index, i); ind_field = dict_index_get_nth_field(index, i);
const dict_col_t* col = ind_field->col; col = ind_field->col;
dfield = dtuple_get_nth_field(entry, i); dfield = dtuple_get_nth_field(entry, i);
......
...@@ -3005,8 +3005,8 @@ row_sel_pop_cached_row_for_mysql( ...@@ -3005,8 +3005,8 @@ row_sel_pop_cached_row_for_mysql(
if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread)) { if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread)) {
/* Copy cache record field by field, don't touch fields that /* Copy cache record field by field, don't touch fields that
are not covered by current key */ are not covered by current key */
cached_rec = prebuilt->fetch_cache cached_rec = prebuilt->fetch_cache[
[prebuilt->fetch_cache_first]; prebuilt->fetch_cache_first];
for (i = 0; i < prebuilt->n_template; i++) { for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i; templ = prebuilt->mysql_template + i;
...@@ -3018,8 +3018,7 @@ row_sel_pop_cached_row_for_mysql( ...@@ -3018,8 +3018,7 @@ row_sel_pop_cached_row_for_mysql(
if (templ->mysql_null_bit_mask) { if (templ->mysql_null_bit_mask) {
buf[templ->mysql_null_byte_offset] buf[templ->mysql_null_byte_offset]
^= (buf[templ->mysql_null_byte_offset] ^= (buf[templ->mysql_null_byte_offset]
^ cached_rec ^ cached_rec[templ->mysql_null_byte_offset])
[templ->mysql_null_byte_offset])
& (byte)templ->mysql_null_bit_mask; & (byte)templ->mysql_null_bit_mask;
} }
} }
......
...@@ -1387,8 +1387,8 @@ func_exit: ...@@ -1387,8 +1387,8 @@ func_exit:
} }
/*************************************************************** /***************************************************************
Updates secondary index record if it is changed in the row update. This Updates the secondary index record if it is changed in the row update or
should be quite rare in database applications. */ deletes it if this is a delete. */
UNIV_INLINE UNIV_INLINE
ulint ulint
row_upd_sec_step( row_upd_sec_step(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment