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
2cdb483b
Commit
2cdb483b
authored
Jun 14, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15352 AUTO_INCREMENT breaks after updating a column value to a negative number
parent
23ced2f8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
624 additions
and
46 deletions
+624
-46
mysql-test/include/autoinc_mdev15353.inc
mysql-test/include/autoinc_mdev15353.inc
+29
-0
mysql-test/r/auto_increment.result
mysql-test/r/auto_increment.result
+120
-0
mysql-test/suite/heap/heap_auto_increment.result
mysql-test/suite/heap/heap_auto_increment.result
+120
-0
mysql-test/suite/heap/heap_auto_increment.test
mysql-test/suite/heap/heap_auto_increment.test
+7
-0
mysql-test/suite/innodb/r/innodb-autoinc.result
mysql-test/suite/innodb/r/innodb-autoinc.result
+121
-0
mysql-test/suite/innodb/t/innodb-autoinc.test
mysql-test/suite/innodb/t/innodb-autoinc.test
+10
-0
mysql-test/suite/maria/maria-autoinc.result
mysql-test/suite/maria/maria-autoinc.result
+120
-0
mysql-test/suite/maria/maria-autoinc.test
mysql-test/suite/maria/maria-autoinc.test
+8
-0
mysql-test/t/auto_increment.test
mysql-test/t/auto_increment.test
+8
-0
sql/field.cc
sql/field.cc
+10
-0
sql/field.h
sql/field.h
+71
-46
No files found.
mysql-test/include/autoinc_mdev15353.inc
0 → 100644
View file @
2cdb483b
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
;
mysql-test/r/auto_increment.result
View file @
2cdb483b
...
...
@@ -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;
mysql-test/suite/heap/heap_auto_increment.result
View file @
2cdb483b
...
...
@@ -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;
mysql-test/suite/heap/heap_auto_increment.test
View file @
2cdb483b
...
...
@@ -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
mysql-test/suite/innodb/r/innodb-autoinc.result
View file @
2cdb483b
...
...
@@ -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;
mysql-test/suite/innodb/t/innodb-autoinc.test
View file @
2cdb483b
...
...
@@ -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
mysql-test/suite/maria/maria-autoinc.result
0 → 100644
View file @
2cdb483b
#
# 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;
mysql-test/suite/maria/maria-autoinc.test
0 → 100644
View file @
2cdb483b
--
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
mysql-test/t/auto_increment.test
View file @
2cdb483b
...
...
@@ -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
sql/field.cc
View file @
2cdb483b
...
...
@@ -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
;
...
...
sql/field.h
View file @
2cdb483b
...
...
@@ -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
...
...
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