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
02278726
Commit
02278726
authored
Jul 11, 2001
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
parents
f2b26ffb
147de1e5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
32 deletions
+100
-32
sql/sql_class.h
sql/sql_class.h
+1
-2
sql/sql_delete.cc
sql/sql_delete.cc
+2
-0
sql/sql_parse.cc
sql/sql_parse.cc
+7
-7
sql/sql_unions.cc
sql/sql_unions.cc
+90
-23
No files found.
sql/sql_class.h
View file @
02278726
...
...
@@ -475,14 +475,13 @@ public:
bool
send_eof
();
};
class
select_insert
:
public
select_result
{
p
rotected
:
p
ublic
:
TABLE
*
table
;
List
<
Item
>
*
fields
;
uint
save_time_stamp
;
ulonglong
last_insert_id
;
COPY_INFO
info
;
public:
select_insert
(
TABLE
*
table_par
,
List
<
Item
>
*
fields_par
,
enum_duplicates
duplic
)
:
table
(
table_par
),
fields
(
fields_par
),
save_time_stamp
(
0
),
last_insert_id
(
0
)
{
...
...
sql/sql_delete.cc
View file @
02278726
...
...
@@ -17,6 +17,8 @@
/* Delete of records */
/* Multi-table deletes were introduced by Monty and Sinisa */
#include "mysql_priv.h"
#include "ha_innobase.h"
#include "sql_select.h"
...
...
sql/sql_parse.cc
View file @
02278726
...
...
@@ -2452,13 +2452,13 @@ mysql_new_select(LEX *lex)
uint
select_no
=
lex
->
select
->
select_number
;
SELECT_LEX
*
select_lex
=
(
SELECT_LEX
*
)
lex
->
thd
->
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
;
lex
->
select
=
select_lex
;
select_lex
->
select_number
=
++
select_no
;
select_lex
->
table_list
.
elements
=
0
;
select_lex
->
table_list
.
first
=
0
;
select_lex
->
table_list
.
next
=
(
byte
**
)
&
select_lex
->
table_list
.
first
;
select_lex
->
item_list
.
empty
();
select_lex
->
when_list
.
empty
();
select_lex
->
expr_list
.
empty
();
select_lex
->
interval_list
.
empty
();
select_lex
->
use_index
.
empty
();
select_lex
->
ftfunc_list
.
empty
()
;
}
void
...
...
sql/sql_unions.cc
View file @
02278726
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & Monty & Sinisa
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
/* Union of selects */
#include "mysql_priv.h"
/*
Do a union of selects
*/
int
mysql_union
(
THD
*
thd
,
LEX
*
lex
,
uint
no_of_selects
)
{
SELECT_LEX
*
sl
;
for
(
sl
=&
lex
->
select_lex
;
sl
;
sl
=
sl
->
next
)
SELECT_LEX
*
sl
,
*
for_order
=&
lex
->
select_lex
;
uint
no
=
0
;
int
res
;
List
<
Item
>
fields
;
TABLE
*
table
;
for
(;
for_order
->
next
;
for_order
=
for_order
->
next
);
ORDER
*
some_order
=
(
ORDER
*
)
for_order
->
order_list
.
first
;
for
(
sl
=&
lex
->
select_lex
;
sl
;
sl
=
sl
->
next
,
no
++
)
{
TABLE_LIST
*
tables
=
(
TABLE_LIST
*
)
sl
->
table_list
.
first
;
if
(
!
no
)
// First we do CREATE from SELECT
{
select_create
*
result
;
lex
->
create_info
.
options
=
HA_LEX_CREATE_TMP_TABLE
;
if
((
result
=
new
select_create
(
tables
->
db
?
tables
->
db
:
thd
->
db
,
NULL
,
&
lex
->
create_info
,
lex
->
create_list
,
lex
->
key_list
,
sl
->
item_list
,
DUP_IGNORE
)))
{
res
=
mysql_select
(
thd
,
tables
,
sl
->
item_list
,
sl
->
where
,
sl
->
ftfunc_list
,
(
ORDER
*
)
NULL
,
(
ORDER
*
)
sl
->
group_list
.
first
,
sl
->
having
,
(
ORDER
*
)
some_order
,
sl
->
options
|
thd
->
options
,
result
);
if
(
res
)
{
result
->
abort
();
delete
result
;
return
res
;
}
else
{
table
=
result
->
table
;
List_iterator
<
Item
>
it
(
*
(
result
->
fields
));
Item
*
item
;
while
((
item
=
it
++
))
fields
.
push_back
(
item
);
}
delete
result
;
if
(
reopen_table
(
table
))
return
1
;
}
else
return
-
1
;
}
else
// Then we do INSERT from SELECT
{
select_result
*
result
;
if
((
result
=
new
select_insert
(
table
,
&
fields
,
DUP_IGNORE
)))
{
res
=
mysql_select
(
thd
,
tables
,
sl
->
item_list
,
sl
->
where
,
sl
->
ftfunc_list
,
(
ORDER
*
)
some_order
,
(
ORDER
*
)
sl
->
group_list
.
first
,
sl
->
having
,
(
ORDER
*
)
NULL
,
sl
->
options
|
thd
->
options
,
result
);
delete
result
;
if
(
res
)
return
1
;
}
else
return
-
1
;
}
}
if
(
1
)
// Meaning if not SELECT ... INTO .... which will be done later
{
READ_RECORD
info
;
int
error
=
0
;
if
(
send_fields
(
thd
,
fields
,
1
))
return
1
;
SQL_SELECT
*
select
=
new
SQL_SELECT
;
select
->
head
=
table
;
select
->
file
=*
(
table
->
io_cache
);
init_read_record
(
&
info
,
thd
,
table
,
select
,
1
,
1
);
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
{
if
(
error
)
{
table
->
file
->
print_error
(
error
,
MYF
(
0
));
break
;
}
}
end_read_record
(
&
info
);
delete
select
;
}
else
{
}
return
0
;
...
...
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