mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge acurtis@bk-internal.mysql.com:/home/bk/mysql-5.0-engines
into xiphis.org:/home/antony/work2/engines-merge
This commit is contained in:
@ -372,7 +372,9 @@ enum ha_base_keytype {
|
|||||||
#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */
|
#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */
|
||||||
#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
|
#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
|
||||||
|
|
||||||
#define HA_ERR_LAST 165 /*Copy last error nr.*/
|
#define HA_ERR_AUTOINC_READ_FAILED 166/* Failed to get the next autoinc value */
|
||||||
|
#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set the row autoinc value */
|
||||||
|
#define HA_ERR_LAST 167 /*Copy last error nr.*/
|
||||||
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
|
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
|
||||||
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
|
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
|
||||||
|
|
||||||
|
28
mysql-test/include/strict_autoinc.inc
Normal file
28
mysql-test/include/strict_autoinc.inc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# Test for strict-mode autoincrement
|
||||||
|
#
|
||||||
|
|
||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
eval create table t1
|
||||||
|
(
|
||||||
|
`a` tinyint(4) NOT NULL auto_increment,
|
||||||
|
primary key (`a`)
|
||||||
|
) engine = $type ;
|
||||||
|
set @@sql_mode='strict_all_tables';
|
||||||
|
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||||
|
insert into t1 values(1000);
|
||||||
|
select count(*) from t1;
|
||||||
|
|
||||||
|
set auto_increment_increment=1000;
|
||||||
|
set auto_increment_offset=700;
|
||||||
|
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||||
|
insert into t1 values(null);
|
||||||
|
select count(*) from t1;
|
||||||
|
|
||||||
|
set @@sql_mode=@org_mode;
|
||||||
|
insert into t1 values(null);
|
||||||
|
select * from t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
# End of test
|
27
mysql-test/r/strict_autoinc_1myisam.result
Normal file
27
mysql-test/r/strict_autoinc_1myisam.result
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1
|
||||||
|
(
|
||||||
|
`a` tinyint(4) NOT NULL auto_increment,
|
||||||
|
primary key (`a`)
|
||||||
|
) engine = 'MYISAM' ;
|
||||||
|
set @@sql_mode='strict_all_tables';
|
||||||
|
insert into t1 values(1000);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set auto_increment_increment=1000;
|
||||||
|
set auto_increment_offset=700;
|
||||||
|
insert into t1 values(null);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set @@sql_mode=@org_mode;
|
||||||
|
insert into t1 values(null);
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
127
|
||||||
|
drop table t1;
|
27
mysql-test/r/strict_autoinc_2innodb.result
Normal file
27
mysql-test/r/strict_autoinc_2innodb.result
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1
|
||||||
|
(
|
||||||
|
`a` tinyint(4) NOT NULL auto_increment,
|
||||||
|
primary key (`a`)
|
||||||
|
) engine = 'InnoDB' ;
|
||||||
|
set @@sql_mode='strict_all_tables';
|
||||||
|
insert into t1 values(1000);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set auto_increment_increment=1000;
|
||||||
|
set auto_increment_offset=700;
|
||||||
|
insert into t1 values(null);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set @@sql_mode=@org_mode;
|
||||||
|
insert into t1 values(null);
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
127
|
||||||
|
drop table t1;
|
27
mysql-test/r/strict_autoinc_3heap.result
Normal file
27
mysql-test/r/strict_autoinc_3heap.result
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1
|
||||||
|
(
|
||||||
|
`a` tinyint(4) NOT NULL auto_increment,
|
||||||
|
primary key (`a`)
|
||||||
|
) engine = 'MEMORY' ;
|
||||||
|
set @@sql_mode='strict_all_tables';
|
||||||
|
insert into t1 values(1000);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set auto_increment_increment=1000;
|
||||||
|
set auto_increment_offset=700;
|
||||||
|
insert into t1 values(null);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set @@sql_mode=@org_mode;
|
||||||
|
insert into t1 values(null);
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
127
|
||||||
|
drop table t1;
|
27
mysql-test/r/strict_autoinc_4bdb.result
Normal file
27
mysql-test/r/strict_autoinc_4bdb.result
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1
|
||||||
|
(
|
||||||
|
`a` tinyint(4) NOT NULL auto_increment,
|
||||||
|
primary key (`a`)
|
||||||
|
) engine = 'BDB' ;
|
||||||
|
set @@sql_mode='strict_all_tables';
|
||||||
|
insert into t1 values(1000);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set auto_increment_increment=1000;
|
||||||
|
set auto_increment_offset=700;
|
||||||
|
insert into t1 values(null);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set @@sql_mode=@org_mode;
|
||||||
|
insert into t1 values(null);
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
127
|
||||||
|
drop table t1;
|
27
mysql-test/r/strict_autoinc_5ndb.result
Normal file
27
mysql-test/r/strict_autoinc_5ndb.result
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
set @org_mode=@@sql_mode;
|
||||||
|
create table t1
|
||||||
|
(
|
||||||
|
`a` tinyint(4) NOT NULL auto_increment,
|
||||||
|
primary key (`a`)
|
||||||
|
) engine = 'NDB' ;
|
||||||
|
set @@sql_mode='strict_all_tables';
|
||||||
|
insert into t1 values(1000);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set auto_increment_increment=1000;
|
||||||
|
set auto_increment_offset=700;
|
||||||
|
insert into t1 values(null);
|
||||||
|
ERROR 22003: Out of range value adjusted for column 'a' at row 1
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
set @@sql_mode=@org_mode;
|
||||||
|
insert into t1 values(null);
|
||||||
|
Warnings:
|
||||||
|
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
127
|
||||||
|
drop table t1;
|
8
mysql-test/t/strict_autoinc_1myisam.test
Normal file
8
mysql-test/t/strict_autoinc_1myisam.test
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# Bug#20573 Strict mode auto-increment
|
||||||
|
#
|
||||||
|
|
||||||
|
let $type= 'MYISAM' ;
|
||||||
|
--source include/strict_autoinc.inc
|
||||||
|
|
||||||
|
# end of test
|
10
mysql-test/t/strict_autoinc_2innodb.test
Normal file
10
mysql-test/t/strict_autoinc_2innodb.test
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-- source include/have_innodb.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#20573 Strict mode auto-increment
|
||||||
|
#
|
||||||
|
|
||||||
|
let $type= 'InnoDB' ;
|
||||||
|
--source include/strict_autoinc.inc
|
||||||
|
|
||||||
|
# end of test
|
8
mysql-test/t/strict_autoinc_3heap.test
Normal file
8
mysql-test/t/strict_autoinc_3heap.test
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
# Bug#20573 Strict mode auto-increment
|
||||||
|
#
|
||||||
|
|
||||||
|
let $type= 'MEMORY' ;
|
||||||
|
--source include/strict_autoinc.inc
|
||||||
|
|
||||||
|
# end of test
|
10
mysql-test/t/strict_autoinc_4bdb.test
Normal file
10
mysql-test/t/strict_autoinc_4bdb.test
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-- source include/have_bdb.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#20573 Strict mode auto-increment
|
||||||
|
#
|
||||||
|
|
||||||
|
let $type= 'BDB' ;
|
||||||
|
--source include/strict_autoinc.inc
|
||||||
|
|
||||||
|
# end of test
|
10
mysql-test/t/strict_autoinc_5ndb.test
Normal file
10
mysql-test/t/strict_autoinc_5ndb.test
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-- source include/have_ndb.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#20573 Strict mode auto-increment
|
||||||
|
#
|
||||||
|
|
||||||
|
let $type= 'NDB' ;
|
||||||
|
--source include/strict_autoinc.inc
|
||||||
|
|
||||||
|
# end of test
|
@ -2486,9 +2486,11 @@ int ha_ndbcluster::write_row(byte *record)
|
|||||||
if (has_auto_increment)
|
if (has_auto_increment)
|
||||||
{
|
{
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
|
int error;
|
||||||
|
|
||||||
m_skip_auto_increment= FALSE;
|
m_skip_auto_increment= FALSE;
|
||||||
update_auto_increment();
|
if ((error= update_auto_increment()))
|
||||||
|
DBUG_RETURN(error);
|
||||||
m_skip_auto_increment= (insert_id_for_cur_row == 0);
|
m_skip_auto_increment= (insert_id_for_cur_row == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,6 +332,8 @@ static int ha_init_errors(void)
|
|||||||
SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key");
|
SETMSG(HA_ERR_FOREIGN_DUPLICATE_KEY, "FK constraint would lead to duplicate key");
|
||||||
SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER(ER_TABLE_NEEDS_UPGRADE));
|
SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER(ER_TABLE_NEEDS_UPGRADE));
|
||||||
SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY));
|
SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY));
|
||||||
|
SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER(ER_AUTOINC_READ_FAILED));
|
||||||
|
SETMSG(HA_ERR_AUTOINC_ERANGE, ER(ER_WARN_DATA_OUT_OF_RANGE));
|
||||||
|
|
||||||
/* Register the error messages for use with my_error(). */
|
/* Register the error messages for use with my_error(). */
|
||||||
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
|
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
|
||||||
@ -1656,7 +1658,10 @@ prev_insert_id(ulonglong nr, struct system_variables *variables)
|
|||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
0 ok
|
0 ok
|
||||||
1 get_auto_increment() was called and returned ~(ulonglong) 0
|
HA_ERR_AUTOINC_READ_FAILED
|
||||||
|
get_auto_increment() was called and returned ~(ulonglong) 0
|
||||||
|
HA_ERR_AUTOINC_ERANGE
|
||||||
|
storing value in field caused strict mode failure.
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
@ -1725,14 +1730,13 @@ prev_insert_id(ulonglong nr, struct system_variables *variables)
|
|||||||
#define AUTO_INC_DEFAULT_NB_MAX_BITS 16
|
#define AUTO_INC_DEFAULT_NB_MAX_BITS 16
|
||||||
#define AUTO_INC_DEFAULT_NB_MAX ((1 << AUTO_INC_DEFAULT_NB_MAX_BITS) - 1)
|
#define AUTO_INC_DEFAULT_NB_MAX ((1 << AUTO_INC_DEFAULT_NB_MAX_BITS) - 1)
|
||||||
|
|
||||||
bool handler::update_auto_increment()
|
int handler::update_auto_increment()
|
||||||
{
|
{
|
||||||
ulonglong nr, nb_reserved_values;
|
ulonglong nr, nb_reserved_values;
|
||||||
bool append= FALSE;
|
bool append= FALSE;
|
||||||
THD *thd= table->in_use;
|
THD *thd= table->in_use;
|
||||||
struct system_variables *variables= &thd->variables;
|
struct system_variables *variables= &thd->variables;
|
||||||
bool auto_increment_field_not_null;
|
bool auto_increment_field_not_null;
|
||||||
bool result= 0;
|
|
||||||
DBUG_ENTER("handler::update_auto_increment");
|
DBUG_ENTER("handler::update_auto_increment");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1809,7 +1813,7 @@ bool handler::update_auto_increment()
|
|||||||
nb_desired_values, &nr,
|
nb_desired_values, &nr,
|
||||||
&nb_reserved_values);
|
&nb_reserved_values);
|
||||||
if (nr == ~(ulonglong) 0)
|
if (nr == ~(ulonglong) 0)
|
||||||
result= 1; // Mark failure
|
DBUG_RETURN(HA_ERR_AUTOINC_READ_FAILED); // Mark failure
|
||||||
|
|
||||||
/*
|
/*
|
||||||
That rounding below should not be needed when all engines actually
|
That rounding below should not be needed when all engines actually
|
||||||
@ -1843,6 +1847,12 @@ bool handler::update_auto_increment()
|
|||||||
|
|
||||||
if (unlikely(table->next_number_field->store((longlong) nr, TRUE)))
|
if (unlikely(table->next_number_field->store((longlong) nr, TRUE)))
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
first test if the query was aborted due to strict mode constraints
|
||||||
|
*/
|
||||||
|
if (thd->killed == THD::KILL_BAD_DATA)
|
||||||
|
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
field refused this value (overflow) and truncated it, use the result of
|
field refused this value (overflow) and truncated it, use the result of
|
||||||
the truncation (which is going to be inserted); however we try to
|
the truncation (which is going to be inserted); however we try to
|
||||||
@ -1865,7 +1875,6 @@ bool handler::update_auto_increment()
|
|||||||
thd->auto_inc_intervals_in_cur_stmt_for_binlog.append(auto_inc_interval_for_cur_row.minimum(),
|
thd->auto_inc_intervals_in_cur_stmt_for_binlog.append(auto_inc_interval_for_cur_row.minimum(),
|
||||||
auto_inc_interval_for_cur_row.values(),
|
auto_inc_interval_for_cur_row.values(),
|
||||||
variables->auto_increment_increment);
|
variables->auto_increment_increment);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Record this autogenerated value. If the caller then
|
Record this autogenerated value. If the caller then
|
||||||
@ -1881,7 +1890,7 @@ bool handler::update_auto_increment()
|
|||||||
*/
|
*/
|
||||||
set_next_insert_id(compute_next_insert_id(nr, variables));
|
set_next_insert_id(compute_next_insert_id(nr, variables));
|
||||||
|
|
||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result ? /* some failure occurred */ -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2176,6 +2185,12 @@ void handler::print_error(int error, myf errflag)
|
|||||||
case HA_ERR_TABLE_READONLY:
|
case HA_ERR_TABLE_READONLY:
|
||||||
textno= ER_OPEN_AS_READONLY;
|
textno= ER_OPEN_AS_READONLY;
|
||||||
break;
|
break;
|
||||||
|
case HA_ERR_AUTOINC_READ_FAILED:
|
||||||
|
textno= ER_AUTOINC_READ_FAILED;
|
||||||
|
break;
|
||||||
|
case HA_ERR_AUTOINC_ERANGE:
|
||||||
|
textno= ER_WARN_DATA_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
/* The error was "unknown" to this function.
|
/* The error was "unknown" to this function.
|
||||||
|
@ -990,7 +990,7 @@ public:
|
|||||||
ulong type, TABLE *table);
|
ulong type, TABLE *table);
|
||||||
int ha_open(TABLE *table, const char *name, int mode, int test_if_locked);
|
int ha_open(TABLE *table, const char *name, int mode, int test_if_locked);
|
||||||
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
|
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
|
||||||
bool update_auto_increment();
|
int update_auto_increment();
|
||||||
void print_keydup_error(uint key_nr, const char *msg);
|
void print_keydup_error(uint key_nr, const char *msg);
|
||||||
virtual void print_error(int error, myf errflag);
|
virtual void print_error(int error, myf errflag);
|
||||||
virtual bool get_error_message(int error, String *buf);
|
virtual bool get_error_message(int error, String *buf);
|
||||||
|
@ -5984,6 +5984,8 @@ ER_EVENTS_DB_ERROR
|
|||||||
eng "Cannot proceed because the tables used by events were found damaged at server start"
|
eng "Cannot proceed because the tables used by events were found damaged at server start"
|
||||||
ER_ONLY_INTEGERS_ALLOWED
|
ER_ONLY_INTEGERS_ALLOWED
|
||||||
eng "Only normal integers allowed as number here"
|
eng "Only normal integers allowed as number here"
|
||||||
|
ER_AUTOINC_READ_FAILED
|
||||||
|
eng "Failed to read auto-increment value from storage engine"
|
||||||
ER_USERNAME
|
ER_USERNAME
|
||||||
eng "user name"
|
eng "user name"
|
||||||
ER_HOSTNAME
|
ER_HOSTNAME
|
||||||
|
@ -176,7 +176,10 @@ int ha_heap::write_row(byte * buf)
|
|||||||
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
|
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
|
||||||
table->timestamp_field->set_time();
|
table->timestamp_field->set_time();
|
||||||
if (table->next_number_field && buf == table->record[0])
|
if (table->next_number_field && buf == table->record[0])
|
||||||
update_auto_increment();
|
{
|
||||||
|
if ((res= update_auto_increment()))
|
||||||
|
return res;
|
||||||
|
}
|
||||||
res= heap_write(file,buf);
|
res= heap_write(file,buf);
|
||||||
if (!res && (++records_changed*HEAP_STATS_UPDATE_THRESHOLD >
|
if (!res && (++records_changed*HEAP_STATS_UPDATE_THRESHOLD >
|
||||||
file->s->records))
|
file->s->records))
|
||||||
|
@ -3401,7 +3401,8 @@ no_commit:
|
|||||||
/* We must use the handler code to update the auto-increment
|
/* We must use the handler code to update the auto-increment
|
||||||
value to be sure that we increment it correctly. */
|
value to be sure that we increment it correctly. */
|
||||||
|
|
||||||
update_auto_increment();
|
if ((error= update_auto_increment()))
|
||||||
|
goto func_exit;
|
||||||
auto_inc_used = 1;
|
auto_inc_used = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,11 @@ int ha_myisam::write_row(byte * buf)
|
|||||||
or a new row, then update the auto_increment value in the record.
|
or a new row, then update the auto_increment value in the record.
|
||||||
*/
|
*/
|
||||||
if (table->next_number_field && buf == table->record[0])
|
if (table->next_number_field && buf == table->record[0])
|
||||||
update_auto_increment();
|
{
|
||||||
|
int error;
|
||||||
|
if ((error= update_auto_increment()))
|
||||||
|
return error;
|
||||||
|
}
|
||||||
return mi_write(file,buf);
|
return mi_write(file,buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
/* Functions to compressed records */
|
/* Functions to compressed records */
|
||||||
|
|
||||||
#include "myisamdef.h"
|
#include "fulltext.h"
|
||||||
|
|
||||||
#define IS_CHAR ((uint) 32768) /* Bit if char (not offset) in tree */
|
#define IS_CHAR ((uint) 32768) /* Bit if char (not offset) in tree */
|
||||||
|
|
||||||
@ -230,11 +230,19 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
|
|||||||
{
|
{
|
||||||
for (i=0 ; i < share->base.keys ; i++)
|
for (i=0 ; i < share->base.keys ; i++)
|
||||||
{
|
{
|
||||||
share->keyinfo[i].keylength+=(uint16) diff_length;
|
MI_KEYDEF *keyinfo= &share->keyinfo[i];
|
||||||
share->keyinfo[i].minlength+=(uint16) diff_length;
|
keyinfo->keylength+= (uint16) diff_length;
|
||||||
share->keyinfo[i].maxlength+=(uint16) diff_length;
|
keyinfo->minlength+= (uint16) diff_length;
|
||||||
share->keyinfo[i].seg[share->keyinfo[i].keysegs].length=
|
keyinfo->maxlength+= (uint16) diff_length;
|
||||||
(uint16) rec_reflength;
|
keyinfo->seg[keyinfo->flag & HA_FULLTEXT ?
|
||||||
|
FT_SEGS : keyinfo->keysegs].length= (uint16) rec_reflength;
|
||||||
|
}
|
||||||
|
if (share->ft2_keyinfo.seg)
|
||||||
|
{
|
||||||
|
MI_KEYDEF *ft2_keyinfo= &share->ft2_keyinfo;
|
||||||
|
ft2_keyinfo->keylength+= (uint16) diff_length;
|
||||||
|
ft2_keyinfo->minlength+= (uint16) diff_length;
|
||||||
|
ft2_keyinfo->maxlength+= (uint16) diff_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,11 @@ int ha_myisammrg::write_row(byte * buf)
|
|||||||
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
|
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
|
||||||
table->timestamp_field->set_time();
|
table->timestamp_field->set_time();
|
||||||
if (table->next_number_field && buf == table->record[0])
|
if (table->next_number_field && buf == table->record[0])
|
||||||
update_auto_increment();
|
{
|
||||||
|
int error;
|
||||||
|
if ((error= update_auto_increment()))
|
||||||
|
return error;
|
||||||
|
}
|
||||||
return myrg_write(file,buf);
|
return myrg_write(file,buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user