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
3bf55c9a
Commit
3bf55c9a
authored
Mar 25, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-alias-4.1
parents
ed33257c
aa3f2872
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
17 deletions
+87
-17
sql/sql_base.cc
sql/sql_base.cc
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+4
-2
sql/sql_table.cc
sql/sql_table.cc
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+23
-10
tests/client_test.c
tests/client_test.c
+57
-3
No files found.
sql/sql_base.cc
View file @
3bf55c9a
...
@@ -564,7 +564,7 @@ TABLE_LIST * find_table_in_list(TABLE_LIST *table,
...
@@ -564,7 +564,7 @@ TABLE_LIST * find_table_in_list(TABLE_LIST *table,
Find real table in given list.
Find real table in given list.
SYNOPSIS
SYNOPSIS
find_table_in_list()
find_
real_
table_in_list()
table - pointer to table list
table - pointer to table list
db_name - data base name
db_name - data base name
table_name - table name
table_name - table name
...
...
sql/sql_lex.cc
View file @
3bf55c9a
...
@@ -1004,6 +1004,7 @@ void st_select_lex_unit::init_query()
...
@@ -1004,6 +1004,7 @@ void st_select_lex_unit::init_query()
table
=
0
;
table
=
0
;
fake_select_lex
=
0
;
fake_select_lex
=
0
;
cleaned
=
0
;
cleaned
=
0
;
item_list
.
empty
();
}
}
void
st_select_lex
::
init_query
()
void
st_select_lex
::
init_query
()
...
...
sql/sql_parse.cc
View file @
3bf55c9a
...
@@ -2378,8 +2378,10 @@ mysql_execute_command(THD *thd)
...
@@ -2378,8 +2378,10 @@ mysql_execute_command(THD *thd)
if
(
grant_option
)
if
(
grant_option
)
{
{
TABLE_LIST
old_list
,
new_list
;
TABLE_LIST
old_list
,
new_list
;
bzero
((
char
*
)
&
old_list
,
sizeof
(
old_list
));
/*
bzero
((
char
*
)
&
new_list
,
sizeof
(
new_list
));
// Safety
we do not need initialize old_list and new_list because we will
come table[0] and table->next[0] there
*/
old_list
=
table
[
0
];
old_list
=
table
[
0
];
new_list
=
table
->
next
[
0
];
new_list
=
table
->
next
[
0
];
old_list
.
next
=
new_list
.
next
=
0
;
old_list
.
next
=
new_list
.
next
=
0
;
...
...
sql/sql_table.cc
View file @
3bf55c9a
...
@@ -2936,7 +2936,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
...
@@ -2936,7 +2936,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
List
<
Item
>
field_list
;
List
<
Item
>
field_list
;
Item
*
item
;
Item
*
item
;
Protocol
*
protocol
=
thd
->
protocol
;
Protocol
*
protocol
=
thd
->
protocol
;
DBUG_ENTER
(
"mysql_
admin
_table"
);
DBUG_ENTER
(
"mysql_
checksum
_table"
);
field_list
.
push_back
(
item
=
new
Item_empty_string
(
"Table"
,
NAME_LEN
*
2
));
field_list
.
push_back
(
item
=
new
Item_empty_string
(
"Table"
,
NAME_LEN
*
2
));
item
->
maybe_null
=
1
;
item
->
maybe_null
=
1
;
...
...
sql/sql_union.cc
View file @
3bf55c9a
...
@@ -226,13 +226,23 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
...
@@ -226,13 +226,23 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg
->
lex
->
current_select
=
lex_select_save
;
thd_arg
->
lex
->
current_select
=
lex_select_save
;
{
{
Statement
*
stmt
=
thd
->
current_statement
;
Statement
backup
;
if
(
stmt
)
thd
->
set_n_backup_item_arena
(
stmt
,
&
backup
);
Field
**
field
;
Field
**
field
;
for
(
field
=
table
->
field
;
*
field
;
field
++
)
for
(
field
=
table
->
field
;
*
field
;
field
++
)
{
{
Item_field
*
item
=
new
Item_field
(
*
field
);
Item_field
*
item
=
new
Item_field
(
*
field
);
if
(
!
item
||
item_list
.
push_back
(
item
))
if
(
!
item
||
item_list
.
push_back
(
item
))
{
if
(
stmt
)
thd
->
restore_backup_item_arena
(
stmt
,
&
backup
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
}
if
(
stmt
)
thd
->
restore_backup_item_arena
(
stmt
,
&
backup
);
}
}
}
}
else
else
...
@@ -431,7 +441,7 @@ int st_select_lex_unit::cleanup()
...
@@ -431,7 +441,7 @@ int st_select_lex_unit::cleanup()
{
{
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
cleaned
=
0
;
cleaned
=
1
;
if
(
union_result
)
if
(
union_result
)
{
{
...
@@ -465,16 +475,19 @@ void st_select_lex_unit::reinit_exec_mechanism()
...
@@ -465,16 +475,19 @@ void st_select_lex_unit::reinit_exec_mechanism()
{
{
prepared
=
optimized
=
executed
=
0
;
prepared
=
optimized
=
executed
=
0
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
List_iterator_fast
<
Item
>
it
(
item_list
);
if
(
first_select
()
->
next_select
())
Item_field
*
field
;
while
((
field
=
(
Item_field
*
)
it
++
))
{
{
/*
List_iterator_fast
<
Item
>
it
(
item_list
);
we can't cleanup here, because it broke link to temporary table field,
Item
*
field
;
but have to drop fixed flag to allow next fix_field of this field
while
((
field
=
it
++
))
during re-executing
{
*/
/*
field
->
fixed
=
0
;
we can't cleanup here, because it broke link to temporary table field,
but have to drop fixed flag to allow next fix_field of this field
during re-executing
*/
field
->
fixed
=
0
;
}
}
}
#endif
#endif
}
}
tests/client_test.c
View file @
3bf55c9a
...
@@ -160,7 +160,10 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
...
@@ -160,7 +160,10 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
MYSQL_STMT
*
STDCALL
MYSQL_STMT
*
STDCALL
mysql_simple_prepare
(
MYSQL
*
mysql
,
const
char
*
query
)
mysql_simple_prepare
(
MYSQL
*
mysql
,
const
char
*
query
)
{
{
return
mysql_prepare
(
mysql
,
query
,
strlen
(
query
));
MYSQL_STMT
*
stmt
=
mysql_stmt_init
(
mysql
);
if
(
mysql_stmt_prepare
(
stmt
,
query
,
strlen
(
query
)))
return
0
;
return
stmt
;
}
}
...
@@ -8377,6 +8380,58 @@ static void test_subqueries_ref()
...
@@ -8377,6 +8380,58 @@ static void test_subqueries_ref()
myquery
(
rc
);
myquery
(
rc
);
}
}
static
void
test_union
()
{
MYSQL_STMT
*
stmt
;
int
rc
;
myheader
(
"test_union"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1, t2"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t1 "
"(id INTEGER NOT NULL PRIMARY KEY, "
" name VARCHAR(20) NOT NULL)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"INSERT INTO t1 (id, name) VALUES "
"(2, 'Ja'), (3, 'Ede'), "
"(4, 'Haag'), (5, 'Kabul'), "
"(6, 'Almere'), (7, 'Utrecht'), "
"(8, 'Qandahar'), (9, 'Amsterdam'), "
"(10, 'Amersfoort'), (11, 'Constantine')"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t2 "
"(id INTEGER NOT NULL PRIMARY KEY, "
" name VARCHAR(20) NOT NULL)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"INSERT INTO t2 (id, name) VALUES "
"(4, 'Guam'), (5, 'Aruba'), "
"(6, 'Angola'), (7, 'Albania'), "
"(8, 'Anguilla'), (9, 'Argentina'), "
"(10, 'Azerbaijan'), (11, 'Afghanistan'), "
"(12, 'Burkina Faso'), (13, 'Faroe Islands')"
);
myquery
(
rc
);
stmt
=
mysql_simple_prepare
(
mysql
,
"SELECT t1.name FROM t1 UNION "
"SELECT t2.name FROM t2"
);
mystmt_init
(
stmt
);
rc
=
mysql_stmt_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
assert
(
20
==
my_process_stmt_result
(
stmt
));
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE t1, t2"
);
myquery
(
rc
);
}
/*
/*
Read and parse arguments and MySQL options from my.cnf
Read and parse arguments and MySQL options from my.cnf
*/
*/
...
@@ -8634,8 +8689,7 @@ int main(int argc, char **argv)
...
@@ -8634,8 +8689,7 @@ int main(int argc, char **argv)
test_distinct
();
/* distinct aggregate functions */
test_distinct
();
/* distinct aggregate functions */
test_subqueries_ref
();
/* outer reference in subqueries converted
test_subqueries_ref
();
/* outer reference in subqueries converted
Item_field -> Item_ref */
Item_field -> Item_ref */
test_union
();
/* test union with prepared statements */
end_time
=
time
((
time_t
*
)
0
);
end_time
=
time
((
time_t
*
)
0
);
total_time
+=
difftime
(
end_time
,
start_time
);
total_time
+=
difftime
(
end_time
,
start_time
);
...
...
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