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
095ae499
Commit
095ae499
authored
Jul 31, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
bk resolve
parents
dbc266ee
aa7231af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
14 deletions
+74
-14
Docs/manual.texi
Docs/manual.texi
+5
-1
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+30
-0
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+25
-0
sql/sql_delete.cc
sql/sql_delete.cc
+14
-13
No files found.
Docs/manual.texi
View file @
095ae499
...
@@ -50067,7 +50067,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -50067,7 +50067,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@appendixsubsec Changes in release 4.0.3
@appendixsubsec Changes in release 4.0.3
@itemize @bullet
@itemize @bullet
@item Fixed two bugs in @code{SELECT DISTINCT} with large tables.
@item
Fixed bug in multi-table delete when tables are re-ordered in table
initialization method and ref_length's are of different sizes
@item
Fixed two bugs in @code{SELECT DISTINCT} with large tables.
@item
@item
Fixed bug in query cache initialisation with very small query cache size.
Fixed bug in query cache initialisation with very small query cache size.
@item
@item
mysql-test/r/multi_update.result
View file @
095ae499
...
@@ -70,3 +70,33 @@ create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
...
@@ -70,3 +70,33 @@ create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500;
delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500;
drop table t1,t2;
drop table t1,t2;
DROP TABLE IF EXISTS a,b,c;
CREATE TABLE a (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO a VALUES (1,'aaa'),(2,'aaa'),(3,'aaa');
CREATE TABLE b (
id int(11) NOT NULL default '0',
name varchar(10) default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO b VALUES (2,'bbb'),(3,'bbb'),(4,'bbb');
CREATE TABLE c (
id int(11) NOT NULL default '0',
mydate datetime default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
INSERT INTO c VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22
00:00:00'),(7,'2002-07-22 00:00:00');
delete a,b,c from a,b,c
where to_days(now())-to_days(c.mydate)>=30
and c.id=a.id and c.id=b.id;
select * from c;
id mydate
1 2002-02-04 00:00:00
5 2002-05-12 00:00:00
6 2002-06-22 00:00:00
7 2002-07-22 00:00:00
DROP TABLE IF EXISTS a,b,c;
mysql-test/t/multi_update.test
View file @
095ae499
...
@@ -80,3 +80,28 @@ while ($1)
...
@@ -80,3 +80,28 @@ while ($1)
enable_query_log
;
enable_query_log
;
delete
t1
from
t1
,
t2
where
t1
.
id1
=
t2
.
id2
and
t1
.
id1
>
500
;
delete
t1
from
t1
,
t2
where
t1
.
id1
=
t2
.
id2
and
t1
.
id1
>
500
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
DROP
TABLE
IF
EXISTS
a
,
b
,
c
;
CREATE
TABLE
a
(
id
int
(
11
)
NOT
NULL
default
'0'
,
name
varchar
(
10
)
default
NULL
,
PRIMARY
KEY
(
id
)
)
TYPE
=
MyISAM
;
INSERT
INTO
a
VALUES
(
1
,
'aaa'
),(
2
,
'aaa'
),(
3
,
'aaa'
);
CREATE
TABLE
b
(
id
int
(
11
)
NOT
NULL
default
'0'
,
name
varchar
(
10
)
default
NULL
,
PRIMARY
KEY
(
id
)
)
TYPE
=
MyISAM
;
INSERT
INTO
b
VALUES
(
2
,
'bbb'
),(
3
,
'bbb'
),(
4
,
'bbb'
);
CREATE
TABLE
c
(
id
int
(
11
)
NOT
NULL
default
'0'
,
mydate
datetime
default
NULL
,
PRIMARY
KEY
(
id
)
)
TYPE
=
MyISAM
;
INSERT
INTO
c
VALUES
(
1
,
'2002-02-04 00:00:00'
),(
3
,
'2002-05-12 00:00:00'
),(
5
,
'2002-05-12 00:00:00'
),(
6
,
'2002-06-22
00:00:00'
),(
7
,
'2002-07-22 00:00:00'
);
delete
a
,
b
,
c
from
a
,
b
,
c
where
to_days
(
now
())
-
to_days
(
c
.
mydate
)
>=
30
and
c
.
id
=
a
.
id
and
c
.
id
=
b
.
id
;
select
*
from
c
;
DROP
TABLE
IF
EXISTS
a
,
b
,
c
;
sql/sql_delete.cc
View file @
095ae499
...
@@ -215,21 +215,8 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt,
...
@@ -215,21 +215,8 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt,
num_of_tables
(
num_of_tables_arg
),
error
(
0
),
lock_option
(
lock_option_arg
),
num_of_tables
(
num_of_tables_arg
),
error
(
0
),
lock_option
(
lock_option_arg
),
do_delete
(
false
)
do_delete
(
false
)
{
{
uint
counter
=
0
;
not_trans_safe
=
false
;
not_trans_safe
=
false
;
tempfiles
=
(
Unique
**
)
sql_calloc
(
sizeof
(
Unique
*
)
*
(
num_of_tables
-
1
));
tempfiles
=
(
Unique
**
)
sql_calloc
(
sizeof
(
Unique
*
)
*
(
num_of_tables
-
1
));
/* Don't use key read with MULTI-TABLE-DELETE */
dt
->
table
->
used_keys
=
0
;
for
(
dt
=
dt
->
next
;
dt
;
dt
=
dt
->
next
,
counter
++
)
{
TABLE
*
table
=
dt
->
table
;
table
->
used_keys
=
0
;
tempfiles
[
counter
]
=
new
Unique
(
refposcmp2
,
(
void
*
)
&
table
->
file
->
ref_length
,
table
->
file
->
ref_length
,
MEM_STRIP_BUF_SIZE
);
}
}
}
...
@@ -260,6 +247,7 @@ multi_delete::prepare(List<Item> &values)
...
@@ -260,6 +247,7 @@ multi_delete::prepare(List<Item> &values)
void
void
multi_delete
::
initialize_tables
(
JOIN
*
join
)
multi_delete
::
initialize_tables
(
JOIN
*
join
)
{
{
int
counter
=
0
;
TABLE_LIST
*
walk
;
TABLE_LIST
*
walk
;
table_map
tables_to_delete_from
=
0
;
table_map
tables_to_delete_from
=
0
;
for
(
walk
=
delete_tables
;
walk
;
walk
=
walk
->
next
)
for
(
walk
=
delete_tables
;
walk
;
walk
=
walk
->
next
)
...
@@ -281,6 +269,19 @@ multi_delete::initialize_tables(JOIN *join)
...
@@ -281,6 +269,19 @@ multi_delete::initialize_tables(JOIN *join)
not_trans_safe
=
true
;
not_trans_safe
=
true
;
}
}
}
}
walk
=
delete_tables
;
walk
->
table
->
used_keys
=
0
;
for
(
walk
=
walk
->
next
;
walk
;
walk
=
walk
->
next
,
counter
++
)
{
tables_to_delete_from
|=
walk
->
table
->
map
;
TABLE
*
table
=
walk
->
table
;
/* Don't use key read with MULTI-TABLE-DELETE */
table
->
used_keys
=
0
;
tempfiles
[
counter
]
=
new
Unique
(
refposcmp2
,
(
void
*
)
&
table
->
file
->
ref_length
,
table
->
file
->
ref_length
,
MEM_STRIP_BUF_SIZE
);
}
init_ftfuncs
(
thd
,
1
);
init_ftfuncs
(
thd
,
1
);
}
}
...
...
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