Commit 2cdb483b authored by Alexander Barkov's avatar Alexander Barkov

MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number

parent 23ced2f8
DELIMITER $$;
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
BEGIN
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
' id TTT NOT NULL AUTO_INCREMENT,'
' name CHAR(30) NOT NULL,'
' PRIMARY KEY (id)) ENGINE=EEE';
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
SELECT * FROM t1;
UPDATE t1 SET id=-1 WHERE id=1;
SELECT * FROM t1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
END;
$$
DELIMITER ;$$
CALL autoinc_mdev15353_one(@engine, 'tinyint');
CALL autoinc_mdev15353_one(@engine, 'smallint');
CALL autoinc_mdev15353_one(@engine, 'mediumint');
CALL autoinc_mdev15353_one(@engine, 'int');
CALL autoinc_mdev15353_one(@engine, 'bigint');
CALL autoinc_mdev15353_one(@engine, 'float');
CALL autoinc_mdev15353_one(@engine, 'double');
DROP PROCEDURE autoinc_mdev15353_one;
......@@ -537,3 +537,123 @@ pk
-5
1
drop table t1;
#
# MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
#
SET @engine='MyISAM';
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
BEGIN
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
' id TTT NOT NULL AUTO_INCREMENT,'
' name CHAR(30) NOT NULL,'
' PRIMARY KEY (id)) ENGINE=EEE';
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
SELECT * FROM t1;
UPDATE t1 SET id=-1 WHERE id=1;
SELECT * FROM t1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
END;
$$
CALL autoinc_mdev15353_one(@engine, 'tinyint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'smallint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'mediumint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'int');
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'bigint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'float');
Table Create Table
t1 CREATE TABLE `t1` (
`id` float NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'double');
Table Create Table
t1 CREATE TABLE `t1` (
`id` double NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
DROP PROCEDURE autoinc_mdev15353_one;
......@@ -39,3 +39,123 @@ _rowid _rowid skey sval
1 1 1 hello
2 2 2 hey
drop table t1;
#
# MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
#
SET @engine='MEMORY';
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
BEGIN
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
' id TTT NOT NULL AUTO_INCREMENT,'
' name CHAR(30) NOT NULL,'
' PRIMARY KEY (id)) ENGINE=EEE';
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
SELECT * FROM t1;
UPDATE t1 SET id=-1 WHERE id=1;
SELECT * FROM t1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
END;
$$
CALL autoinc_mdev15353_one(@engine, 'tinyint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'smallint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'mediumint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'int');
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'bigint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'float');
Table Create Table
t1 CREATE TABLE `t1` (
`id` float NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'double');
Table Create Table
t1 CREATE TABLE `t1` (
`id` double NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
DROP PROCEDURE autoinc_mdev15353_one;
......@@ -33,3 +33,10 @@ select _rowid,t1._rowid,skey,sval from t1;
drop table t1;
# End of 4.1 tests
--echo #
--echo # MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
--echo #
SET @engine='MEMORY';
--source include/autoinc_mdev15353.inc
......@@ -1351,6 +1351,7 @@ t CREATE TABLE `t` (
KEY `i` (`i`)
) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1
DROP TABLE t;
SET auto_increment_increment = DEFAULT;
#
# MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
#
......@@ -1369,3 +1370,123 @@ SELECT * FROM t1;
a
-1
DROP TABLE t1;
#
# MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
#
SET @engine='INNODB';
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
BEGIN
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
' id TTT NOT NULL AUTO_INCREMENT,'
' name CHAR(30) NOT NULL,'
' PRIMARY KEY (id)) ENGINE=EEE';
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
SELECT * FROM t1;
UPDATE t1 SET id=-1 WHERE id=1;
SELECT * FROM t1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
END;
$$
CALL autoinc_mdev15353_one(@engine, 'tinyint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'smallint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'mediumint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'int');
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'bigint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'float');
Table Create Table
t1 CREATE TABLE `t1` (
`id` float NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'double');
Table Create Table
t1 CREATE TABLE `t1` (
`id` double NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
DROP PROCEDURE autoinc_mdev15353_one;
......@@ -683,6 +683,8 @@ INSERT INTO t VALUES (NULL);
SELECT * FROM t;
SHOW CREATE TABLE t;
DROP TABLE t;
SET auto_increment_increment = DEFAULT;
--echo #
--echo # MDEV-14008 Assertion failing: `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())
......@@ -700,3 +702,11 @@ CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1);
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
--echo #
SET @engine='INNODB';
--source include/autoinc_mdev15353.inc
#
# MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
#
SET @engine='ARIA';
CREATE PROCEDURE autoinc_mdev15353_one(engine VARCHAR(64), t VARCHAR(64))
BEGIN
DECLARE query TEXT DEFAULT 'CREATE TABLE t1 ('
' id TTT NOT NULL AUTO_INCREMENT,'
' name CHAR(30) NOT NULL,'
' PRIMARY KEY (id)) ENGINE=EEE';
EXECUTE IMMEDIATE REPLACE(REPLACE(query,'TTT', t), 'EEE', engine);
SHOW CREATE TABLE t1;
INSERT INTO t1 (name) VALUES ('dog');
SELECT * FROM t1;
UPDATE t1 SET id=-1 WHERE id=1;
SELECT * FROM t1;
INSERT INTO t1 (name) VALUES ('cat');
SELECT * FROM t1;
DROP TABLE t1;
END;
$$
CALL autoinc_mdev15353_one(@engine, 'tinyint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'smallint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` smallint(6) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'mediumint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` mediumint(9) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'int');
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'bigint');
Table Create Table
t1 CREATE TABLE `t1` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'float');
Table Create Table
t1 CREATE TABLE `t1` (
`id` float NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
CALL autoinc_mdev15353_one(@engine, 'double');
Table Create Table
t1 CREATE TABLE `t1` (
`id` double NOT NULL AUTO_INCREMENT,
`name` char(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
id name
1 dog
id name
-1 dog
id name
-1 dog
2 cat
DROP PROCEDURE autoinc_mdev15353_one;
-- source include/have_maria.inc
--echo #
--echo # MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
--echo #
SET @engine='ARIA';
--source include/autoinc_mdev15353.inc
......@@ -397,3 +397,11 @@ insert into t1 values(null);
select last_insert_id();
select * from t1;
drop table t1;
--echo #
--echo # MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
--echo #
SET @engine='MyISAM';
--source include/autoinc_mdev15353.inc
......@@ -3328,6 +3328,16 @@ longlong Field_new_decimal::val_int(void)
}
ulonglong Field_new_decimal::val_uint(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
longlong i;
my_decimal decimal_value;
my_decimal2int(E_DEC_FATAL_ERROR, val_decimal(&decimal_value), true, &i);
return i;
}
my_decimal* Field_new_decimal::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
......
......@@ -851,9 +851,14 @@ class Field: public Value_source
{ return store(ls->str, (uint32) ls->length, cs); }
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
/*
Get ulonglong representation.
Negative values are truncated to 0.
*/
virtual ulonglong val_uint(void)
{
return (ulonglong) val_int();
longlong nr= val_int();
return nr < 0 ? 0 : (ulonglong) nr;
}
virtual bool val_bool(void)= 0;
virtual my_decimal *val_decimal(my_decimal *);
......@@ -1898,6 +1903,7 @@ class Field_new_decimal :public Field_num {
int store_decimal(const my_decimal *);
double val_real(void);
longlong val_int(void);
ulonglong val_uint(void);
my_decimal *val_decimal(my_decimal *);
String *val_str(String*, String *);
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
......@@ -1925,15 +1931,34 @@ class Field_new_decimal :public Field_num {
};
class Field_tiny :public Field_num {
class Field_integer: public Field_num
{
public:
Field_integer(uchar *ptr_arg, uint32 len_arg,
uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, 0,
zero_arg, unsigned_arg)
{ }
ulonglong val_uint()
{
longlong nr= val_int();
return nr < 0 && !unsigned_flag ? 0 : (ulonglong) nr;
}
};
class Field_tiny :public Field_integer {
public:
Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
0, zero_arg,unsigned_arg)
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_integer(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
zero_arg, unsigned_arg)
{}
enum_field_types type() const { return MYSQL_TYPE_TINY;}
enum ha_base_keytype key_type() const
......@@ -1969,20 +1994,20 @@ class Field_tiny :public Field_num {
};
class Field_short :public Field_num {
class Field_short :public Field_integer {
public:
Field_short(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
0, zero_arg,unsigned_arg)
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_integer(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
zero_arg, unsigned_arg)
{}
Field_short(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
bool unsigned_arg)
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, 0, 0, unsigned_arg)
bool unsigned_arg)
:Field_integer((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, 0,
NONE, field_name_arg, 0, unsigned_arg)
{}
enum_field_types type() const { return MYSQL_TYPE_SHORT;}
enum ha_base_keytype key_type() const
......@@ -2009,15 +2034,15 @@ class Field_short :public Field_num {
{ return unpack_int16(to, from, from_end); }
};
class Field_medium :public Field_num {
class Field_medium :public Field_integer {
public:
Field_medium(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
0, zero_arg,unsigned_arg)
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_integer(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
zero_arg, unsigned_arg)
{}
enum_field_types type() const { return MYSQL_TYPE_INT24;}
enum ha_base_keytype key_type() const
......@@ -2043,20 +2068,20 @@ class Field_medium :public Field_num {
};
class Field_long :public Field_num {
class Field_long :public Field_integer {
public:
Field_long(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
0, zero_arg,unsigned_arg)
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_integer(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
zero_arg, unsigned_arg)
{}
Field_long(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
bool unsigned_arg)
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg,0,0,unsigned_arg)
bool unsigned_arg)
:Field_integer((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, 0,
NONE, field_name_arg, 0, unsigned_arg)
{}
enum_field_types type() const { return MYSQL_TYPE_LONG;}
enum ha_base_keytype key_type() const
......@@ -2088,21 +2113,21 @@ class Field_long :public Field_num {
};
class Field_longlong :public Field_num {
class Field_longlong :public Field_integer {
public:
Field_longlong(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
0, zero_arg,unsigned_arg)
uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
bool zero_arg, bool unsigned_arg)
:Field_integer(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg,
zero_arg, unsigned_arg)
{}
Field_longlong(uint32 len_arg,bool maybe_null_arg,
const char *field_name_arg,
bool unsigned_arg)
:Field_num((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg,0,0,unsigned_arg)
const char *field_name_arg,
bool unsigned_arg)
:Field_integer((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "" : 0, 0,
NONE, field_name_arg,0, unsigned_arg)
{}
enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
enum ha_base_keytype key_type() const
......
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