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
6f5c7070
Commit
6f5c7070
authored
Jun 16, 2001
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes for multi-table delete and UNION's
parent
a1844441
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
13 deletions
+34
-13
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+20
-9
sql/sql_class.h
sql/sql_class.h
+2
-1
sql/sql_delete.cc
sql/sql_delete.cc
+6
-3
sql/sql_parse.cc
sql/sql_parse.cc
+6
-0
No files found.
mysql-test/t/multi_update.test
View file @
6f5c7070
...
...
@@ -2,24 +2,35 @@ drop table if exists t1,t2,t3;
create
table
t1
(
id1
int
not
null
auto_increment
primary
key
,
t
char
(
12
));
create
table
t2
(
id2
int
not
null
,
t
char
(
12
),
index
(
id2
));
create
table
t3
(
id3
int
not
null
,
t
char
(
12
),
index
(
id3
));
let
$
1
=
3
;
let
$
1
=
10000
;
while
(
$
1
)
{
let
$
2
=
3
;
let
$
2
=
5
;
eval
insert
into
t1
(
t
)
values
(
'$1'
);
while
(
$
2
)
{
eval
insert
into
t2
(
id2
,
t
)
values
(
$
1
,
'$2'
);
eval
insert
into
t3
(
id3
,
t
)
values
(
$
1
,
'$2'
);
let
$
3
=
10
;
while
(
$
3
)
{
eval
insert
into
t3
(
id3
,
t
)
values
(
$
1
,
'$2'
);
dec
$
3
;
}
dec
$
2
;
}
dec
$
1
;
}
select
*
from
t1
;
select
*
from
t2
;
select
*
from
t3
;
delete
from
t1
,
t2
where
t1
.
id
=
t2
.
id
and
t1
.
id
=
3
;
select
*
from
t1
;
select
*
from
t2
;
delete
t1
.*
,
t2
.*
,
t3
.*
from
t1
,
t2
,
t3
where
t1
.
id1
=
t2
.
id2
and
t2
.
id2
=
t3
.
id3
and
t1
.
id1
>
9500
;
check
table
t1
,
t2
,
t3
;
select
*
from
t1
where
id1
>
9500
;
select
*
from
t2
where
id2
>
9500
;
select
*
from
t3
where
id3
>
9500
;
delete
t1
,
t2
,
t3
from
t1
,
t2
,
t3
where
t1
.
id1
=
t2
.
id2
and
t2
.
id2
=
t3
.
id3
and
t1
.
id1
>
500
;
select
*
from
t1
where
id1
>
500
;
select
*
from
t2
where
id2
>
500
;
select
*
from
t3
where
id3
>
500
;
sql/sql_class.h
View file @
6f5c7070
...
...
@@ -603,7 +603,8 @@ class Unique :public Sql_alloc
byte
*
dup_checking
;
THD
*
thd
;
ha_rows
deleted
;
int
num_of_tables
,
error
;
uint
num_of_tables
;
int
error
;
thr_lock_type
lock_option
;
bool
do_delete
;
public:
...
...
sql/sql_delete.cc
View file @
6f5c7070
...
...
@@ -347,7 +347,7 @@ multi_delete::~multi_delete()
for
(
uint
counter
=
0
;
counter
<
num_of_tables
;
counter
++
)
if
(
tempfiles
[
counter
])
#ifdef SINISAS_STRIP
//
end_io_cache(tempfiles[counter]);
end_io_cache
(
tempfiles
[
counter
]);
#else
delete
tempfiles
[
counter
];
#endif
...
...
@@ -549,12 +549,15 @@ static IO_CACHE *strip_duplicates_from_temp (byte *memory_lane, IO_CACHE *ptr, u
int
read_error
,
write_error
,
how_many_to_read
,
total_to_read
=
*
written
,
pieces_in_memory
=
0
,
mem_count
,
written_rows
;
int
offset
=
written_rows
=*
written
=
0
;
int
mem_pool_size
=
MEM_STRIP_BUF_SIZE
*
MAX_REFLENGTH
/
ref_length
;
IO_CACHE
*
tempptr
=
(
IO_CACHE
*
)
sql_alloc
(
sizeof
(
IO_CACHE
));
byte
dup_record
[
MAX_REFLENGTH
];
memset
(
dup_record
,
'\xFF'
,
MAX_REFLENGTH
);
if
(
reinit_io_cache
(
ptr
,
READ_CACHE
,
0L
,
0
,
0
))
return
ptr
;
IO_CACHE
*
tempptr
=
(
IO_CACHE
*
)
my_malloc
(
sizeof
(
IO_CACHE
),
MYF
(
MY_FAE
|
MY_ZEROFILL
));
if
(
open_cached_file
(
tempptr
,
mysql_tmpdir
,
TEMP_PREFIX
,
DISK_BUFFER_SIZE
,
MYF
(
MY_WME
)))
{
my_free
((
gptr
)
tempptr
,
MYF
(
0
));
return
ptr
;
}
DYNAMIC_ARRAY
written_blocks
;
VOID
(
init_dynamic_array
(
&
written_blocks
,
sizeof
(
struct
written_block
),
20
,
50
));
for
(;
pieces_in_memory
<
total_to_read
;)
...
...
@@ -809,7 +812,7 @@ int multi_delete::do_deletes (bool from_send_error)
#ifdef SINISAS_STRIP
delete
select
;
#endif
if
(
error
=
-
1
)
error
=
0
;
if
(
error
=
=
-
1
)
error
=
0
;
#if 0
}
#endif
...
...
sql/sql_parse.cc
View file @
6f5c7070
...
...
@@ -2437,6 +2437,12 @@ mysql_new_select(LEX *lex)
SELECT_LEX
*
select_lex
=
(
SELECT_LEX
*
)
sql_calloc
(
sizeof
(
SELECT_LEX
));
lex
->
select
->
next
=
select_lex
;
lex
->
select
=
select_lex
;
lex
->
select
->
select_number
=
++
select_no
;
lex
->
select
->
item_list
=
lex
->
select_lex
.
item_list
;
lex
->
select
->
item_list
.
empty
();
lex
->
select
->
table_list
=
lex
->
select_lex
.
table_list
;
lex
->
select
->
table_list
.
elements
=
0
;
lex
->
select
->
table_list
.
first
=
0
;
lex
->
select
->
table_list
.
next
=
(
byte
**
)
&
lex
->
select
->
table_list
.
first
;
}
void
...
...
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