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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
aadfa648
Commit
aadfa648
authored
Apr 13, 2006
by
unknown
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-bug15933
parents
1dc282ae
886a35bd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
36 deletions
+80
-36
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+13
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+28
-0
sql/item.cc
sql/item.cc
+0
-16
sql/item.h
sql/item.h
+0
-12
sql/item_create.cc
sql/item_create.cc
+2
-8
sql/item_func.cc
sql/item_func.cc
+25
-0
sql/item_func.h
sql/item_func.h
+12
-0
No files found.
mysql-test/r/trigger.result
View file @
aadfa648
...
...
@@ -952,3 +952,16 @@ load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop table t1;
drop function f1;
drop function f2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
conn_id INT,
trigger_conn_id INT
);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.trigger_conn_id = CONNECTION_ID();
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
conn_id trigger_conn_id
DROP TRIGGER t1_bi;
DROP TABLE t1;
mysql-test/t/trigger.test
View file @
aadfa648
...
...
@@ -1114,3 +1114,31 @@ load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop
table
t1
;
drop
function
f1
;
drop
function
f2
;
#
# Test for Bug #16461 connection_id() does not work properly inside trigger
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
CREATE
TABLE
t1
(
conn_id
INT
,
trigger_conn_id
INT
);
CREATE
TRIGGER
t1_bi
BEFORE
INSERT
ON
t1
FOR
EACH
ROW
SET
NEW
.
trigger_conn_id
=
CONNECTION_ID
();
INSERT
INTO
t1
(
conn_id
,
trigger_conn_id
)
VALUES
(
CONNECTION_ID
(),
-
1
);
connect
(
con1
,
localhost
,
root
,,);
INSERT
INTO
t1
(
conn_id
,
trigger_conn_id
)
VALUES
(
CONNECTION_ID
(),
-
1
);
connection
default
;
disconnect
con1
;
SELECT
*
FROM
t1
WHERE
conn_id
!=
trigger_conn_id
;
DROP
TRIGGER
t1_bi
;
DROP
TABLE
t1
;
# End of 5.0 tests
sql/item.cc
View file @
aadfa648
...
...
@@ -644,22 +644,6 @@ Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
}
Item
*
Item_static_int_func
::
safe_charset_converter
(
CHARSET_INFO
*
tocs
)
{
Item_string
*
conv
;
char
buf
[
64
];
String
*
s
,
tmp
(
buf
,
sizeof
(
buf
),
&
my_charset_bin
);
s
=
val_str
(
&
tmp
);
if
((
conv
=
new
Item_static_string_func
(
func_name
,
s
->
ptr
(),
s
->
length
(),
s
->
charset
())))
{
conv
->
str_value
.
copy
();
conv
->
str_value
.
mark_as_const
();
}
return
conv
;
}
Item
*
Item_static_float_func
::
safe_charset_converter
(
CHARSET_INFO
*
tocs
)
{
Item_string
*
conv
;
...
...
sql/item.h
View file @
aadfa648
...
...
@@ -1387,18 +1387,6 @@ public:
};
class
Item_static_int_func
:
public
Item_int
{
const
char
*
func_name
;
public:
Item_static_int_func
(
const
char
*
str_arg
,
longlong
i
,
uint
length
)
:
Item_int
(
NullS
,
i
,
length
),
func_name
(
str_arg
)
{}
Item
*
safe_charset_converter
(
CHARSET_INFO
*
tocs
);
void
print
(
String
*
str
)
{
str
->
append
(
func_name
);
}
};
class
Item_uint
:
public
Item_int
{
public:
...
...
sql/item_create.cc
View file @
aadfa648
...
...
@@ -71,14 +71,8 @@ Item *create_func_ceiling(Item* a)
Item
*
create_func_connection_id
(
void
)
{
THD
*
thd
=
current_thd
;
thd
->
lex
->
safe_to_cache_query
=
0
;
return
new
Item_static_int_func
(
"connection_id()"
,
(
longlong
)
((
thd
->
slave_thread
)
?
thd
->
variables
.
pseudo_thread_id
:
thd
->
thread_id
),
10
);
current_thd
->
lex
->
safe_to_cache_query
=
0
;
return
new
Item_func_connection_id
();
}
Item
*
create_func_conv
(
Item
*
a
,
Item
*
b
,
Item
*
c
)
...
...
sql/item_func.cc
View file @
aadfa648
...
...
@@ -559,6 +559,31 @@ String *Item_int_func::val_str(String *str)
}
void
Item_func_connection_id
::
fix_length_and_dec
()
{
Item_int_func
::
fix_length_and_dec
();
max_length
=
10
;
}
bool
Item_func_connection_id
::
fix_fields
(
THD
*
thd
,
Item
**
ref
)
{
if
(
Item_int_func
::
fix_fields
(
thd
,
ref
))
return
TRUE
;
/*
To replicate CONNECTION_ID() properly we should use
pseudo_thread_id on slave, which contains the value of thread_id
on master.
*/
value
=
((
thd
->
slave_thread
)
?
thd
->
variables
.
pseudo_thread_id
:
thd
->
thread_id
);
return
FALSE
;
}
/*
Check arguments here to determine result's type for a numeric
function of two arguments.
...
...
sql/item_func.h
View file @
aadfa648
...
...
@@ -279,6 +279,18 @@ public:
};
class
Item_func_connection_id
:
public
Item_int_func
{
longlong
value
;
public:
const
char
*
func_name
()
const
{
return
"connection_id"
;
}
void
fix_length_and_dec
();
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
value
;
}
};
class
Item_func_signed
:
public
Item_int_func
{
public:
...
...
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