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
582ee397
Commit
582ee397
authored
Jun 09, 2016
by
Alexander Barkov
Committed by
Sergei Golubchik
Jun 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tests for MDEV-10134 Add full support for DEFAULT
Numeric functions with string input
parent
f9fb646b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
mysql-test/r/default.result
mysql-test/r/default.result
+38
-0
mysql-test/t/default.test
mysql-test/t/default.test
+24
-0
No files found.
mysql-test/r/default.result
View file @
582ee397
...
...
@@ -1898,3 +1898,41 @@ aaa 0
bbb 0
ccc 1
DROP TABLE t1;
#
# Numeric result functions with string input
#
CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT STRCMP(a,'b'));
INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c');
SELECT * FROM t1;
a b
A -1
a -1
B 0
b 0
C 1
c 1
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LENGTH(a), c INT DEFAULT CHAR_LENGTH(a), d INT DEFAULT BIT_LENGTH(a));
INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa');
SELECT * FROM t1;
a b c d
a 1 1 8
aa 2 2 16
aaa 3 3 24
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LOCATE('a',a));
INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
SELECT * FROM t1;
a b
xa 2
xxa 3
xxxa 4
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT REGEXP_INSTR(a, 'a'));
INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
SELECT * FROM t1;
a b
xa 2
xxa 3
xxxa 4
DROP TABLE t1;
mysql-test/t/default.test
View file @
582ee397
...
...
@@ -1489,3 +1489,27 @@ CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT a NOT BETWEEN 'aaa' AND 'bbb');
INSERT
INTO
t1
(
a
)
VALUES
(
'AAA'
),(
'aaa'
),(
'bbb'
),(
'ccc'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Numeric result functions with string input
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
10
),
b
INT
DEFAULT
STRCMP
(
a
,
'b'
));
INSERT
INTO
t1
(
a
)
VALUES
(
'A'
),(
'a'
),(
'B'
),(
'b'
),(
'C'
),(
'c'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
),
b
INT
DEFAULT
LENGTH
(
a
),
c
INT
DEFAULT
CHAR_LENGTH
(
a
),
d
INT
DEFAULT
BIT_LENGTH
(
a
));
INSERT
INTO
t1
(
a
)
VALUES
(
'a'
),(
'aa'
),(
'aaa'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
),
b
INT
DEFAULT
LOCATE
(
'a'
,
a
));
INSERT
INTO
t1
(
a
)
VALUES
(
'xa'
),(
'xxa'
),(
'xxxa'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
VARCHAR
(
10
),
b
INT
DEFAULT
REGEXP_INSTR
(
a
,
'a'
));
INSERT
INTO
t1
(
a
)
VALUES
(
'xa'
),(
'xxa'
),(
'xxxa'
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
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