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
22389b99
Commit
22389b99
authored
May 04, 2006
by
kroki@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0
into mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug6951
parents
c40f8557
4bd62e58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
0 deletions
+90
-0
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+36
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+48
-0
sql/sp_head.cc
sql/sp_head.cc
+6
-0
No files found.
mysql-test/r/trigger.result
View file @
22389b99
...
@@ -998,3 +998,39 @@ SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
...
@@ -998,3 +998,39 @@ SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
conn_id trigger_conn_id
conn_id trigger_conn_id
DROP TRIGGER t1_bi;
DROP TRIGGER t1_bi;
DROP TABLE t1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i1 INT);
SET @save_sql_mode=@@sql_mode;
SET SQL_MODE='';
CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
SET @x = 5/0;
SET SQL_MODE='traditional';
CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
SET @x = 5/0;
SET @x=1;
INSERT INTO t1 VALUES (@x);
SELECT @x;
@x
NULL
SET @x=2;
UPDATE t1 SET i1 = @x;
ERROR 22012: Division by 0
SELECT @x;
@x
2
SET SQL_MODE='';
SET @x=3;
INSERT INTO t1 VALUES (@x);
SELECT @x;
@x
NULL
SET @x=4;
UPDATE t1 SET i1 = @x;
ERROR 22012: Division by 0
SELECT @x;
@x
4
SET @@sql_mode=@save_sql_mode;
DROP TRIGGER t1_ai;
DROP TRIGGER t1_au;
DROP TABLE t1;
mysql-test/t/trigger.test
View file @
22389b99
...
@@ -1165,4 +1165,52 @@ SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
...
@@ -1165,4 +1165,52 @@ SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
DROP
TRIGGER
t1_bi
;
DROP
TRIGGER
t1_bi
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug#6951: Triggers/Traditional: SET @ result wrong
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
CREATE
TABLE
t1
(
i1
INT
);
SET
@
save_sql_mode
=@@
sql_mode
;
SET
SQL_MODE
=
''
;
CREATE
TRIGGER
t1_ai
AFTER
INSERT
ON
t1
FOR
EACH
ROW
SET
@
x
=
5
/
0
;
SET
SQL_MODE
=
'traditional'
;
CREATE
TRIGGER
t1_au
AFTER
UPDATE
ON
t1
FOR
EACH
ROW
SET
@
x
=
5
/
0
;
SET
@
x
=
1
;
INSERT
INTO
t1
VALUES
(
@
x
);
SELECT
@
x
;
SET
@
x
=
2
;
--
error
1365
UPDATE
t1
SET
i1
=
@
x
;
SELECT
@
x
;
SET
SQL_MODE
=
''
;
SET
@
x
=
3
;
INSERT
INTO
t1
VALUES
(
@
x
);
SELECT
@
x
;
SET
@
x
=
4
;
--
error
1365
UPDATE
t1
SET
i1
=
@
x
;
SELECT
@
x
;
SET
@@
sql_mode
=@
save_sql_mode
;
DROP
TRIGGER
t1_ai
;
DROP
TRIGGER
t1_au
;
DROP
TABLE
t1
;
# End of 5.0 tests
# End of 5.0 tests
sql/sp_head.cc
View file @
22389b99
...
@@ -935,6 +935,7 @@ sp_head::execute(THD *thd)
...
@@ -935,6 +935,7 @@ sp_head::execute(THD *thd)
bool
err_status
=
FALSE
;
bool
err_status
=
FALSE
;
uint
ip
=
0
;
uint
ip
=
0
;
ulong
save_sql_mode
;
ulong
save_sql_mode
;
bool
save_abort_on_warning
;
Query_arena
*
old_arena
;
Query_arena
*
old_arena
;
/* per-instruction arena */
/* per-instruction arena */
MEM_ROOT
execute_mem_root
;
MEM_ROOT
execute_mem_root
;
...
@@ -995,6 +996,10 @@ sp_head::execute(THD *thd)
...
@@ -995,6 +996,10 @@ sp_head::execute(THD *thd)
thd
->
derived_tables
=
0
;
thd
->
derived_tables
=
0
;
save_sql_mode
=
thd
->
variables
.
sql_mode
;
save_sql_mode
=
thd
->
variables
.
sql_mode
;
thd
->
variables
.
sql_mode
=
m_sql_mode
;
thd
->
variables
.
sql_mode
=
m_sql_mode
;
save_abort_on_warning
=
thd
->
abort_on_warning
;
thd
->
abort_on_warning
=
(
m_sql_mode
&
(
MODE_STRICT_TRANS_TABLES
|
MODE_STRICT_ALL_TABLES
));
/*
/*
It is also more efficient to save/restore current thd->lex once when
It is also more efficient to save/restore current thd->lex once when
do it in each instruction
do it in each instruction
...
@@ -1127,6 +1132,7 @@ sp_head::execute(THD *thd)
...
@@ -1127,6 +1132,7 @@ sp_head::execute(THD *thd)
DBUG_ASSERT
(
!
thd
->
derived_tables
);
DBUG_ASSERT
(
!
thd
->
derived_tables
);
thd
->
derived_tables
=
old_derived_tables
;
thd
->
derived_tables
=
old_derived_tables
;
thd
->
variables
.
sql_mode
=
save_sql_mode
;
thd
->
variables
.
sql_mode
=
save_sql_mode
;
thd
->
abort_on_warning
=
save_abort_on_warning
;
thd
->
stmt_arena
=
old_arena
;
thd
->
stmt_arena
=
old_arena
;
state
=
EXECUTED
;
state
=
EXECUTED
;
...
...
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