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
50def61b
Commit
50def61b
authored
Jun 15, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-bug3-5.0
parents
a78cc269
3ece42e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
sql/item.h
sql/item.h
+7
-1
sql/sql_select.cc
sql/sql_select.cc
+13
-1
tests/mysql_client_test.c
tests/mysql_client_test.c
+43
-0
No files found.
sql/item.h
View file @
50def61b
...
...
@@ -1352,7 +1352,13 @@ public:
{
(
*
ref
)
->
save_in_field
(
result_field
,
no_conversions
);
}
Item
*
real_item
()
{
return
*
ref
;
}
Item
*
real_item
()
{
Item
*
item
=
this
;
do
item
=
*
((
Item_ref
*
)
item
)
->
ref
;
while
(
item
->
type
()
==
Item
::
REF_ITEM
);
return
item
;
}
bool
walk
(
Item_processor
processor
,
byte
*
arg
)
{
return
(
*
ref
)
->
walk
(
processor
,
arg
);
}
void
print
(
String
*
str
);
...
...
sql/sql_select.cc
View file @
50def61b
...
...
@@ -7957,6 +7957,19 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
modify_item
?
(
Item_field
*
)
item
:
NULL
,
convert_blob_length
);
}
case
Item
:
:
REF_ITEM
:
if
(
((
Item_ref
*
)
item
)
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
{
Item_field
*
field
=
(
Item_field
*
)
*
((
Item_ref
*
)
item
)
->
ref
;
Field
*
new_field
=
create_tmp_field_from_field
(
thd
,
(
*
from_field
=
field
->
field
),
item
->
name
,
table
,
NULL
,
convert_blob_length
);
if
(
modify_item
)
item
->
set_result_field
(
new_field
);
return
new_field
;
}
case
Item
:
:
FUNC_ITEM
:
case
Item
:
:
COND_ITEM
:
case
Item
:
:
FIELD_AVG_ITEM
:
...
...
@@ -7968,7 +7981,6 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case
Item
:
:
REAL_ITEM
:
case
Item
:
:
DECIMAL_ITEM
:
case
Item
:
:
STRING_ITEM
:
case
Item
:
:
REF_ITEM
:
case
Item
:
:
NULL_ITEM
:
case
Item
:
:
VARBIN_ITEM
:
return
create_tmp_field_from_item
(
thd
,
item
,
table
,
copy_func
,
modify_item
,
...
...
tests/mysql_client_test.c
View file @
50def61b
...
...
@@ -13145,6 +13145,48 @@ static void test_bug9643()
myquery
(
rc
);
}
/*
Bug#11111: fetch from view returns wrong data
*/
static
void
test_bug11111
()
{
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
2
];
char
buf
[
2
][
20
];
long
len
[
2
];
int
i
;
const
char
*
query
=
"SELECT DISTINCT f1,ff2 FROM v1"
;
mysql_query
(
mysql
,
"drop table if exists t1, t2, v1"
);
mysql_query
(
mysql
,
"create table t1 (f1 int, f2 int)"
);
mysql_query
(
mysql
,
"create table t2 (ff1 int, ff2 int)"
);
mysql_query
(
mysql
,
"create view v1 as select * from t1, t2 where f1=ff1"
);
mysql_query
(
mysql
,
"insert into t1 values (1,1), (2,2), (3,3)"
);
mysql_query
(
mysql
,
"insert into t2 values (1,1), (2,2), (3,3)"
);
stmt
=
mysql_stmt_init
(
mysql
);
mysql_stmt_prepare
(
stmt
,
query
,
strlen
(
query
));
mysql_stmt_execute
(
stmt
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
memset
(
&
bind
[
i
],
'\0'
,
sizeof
(
MYSQL_BIND
));
bind
[
i
].
buffer_type
=
MYSQL_TYPE_STRING
;
bind
[
i
].
buffer
=
(
gptr
*
)
&
buf
[
i
];
bind
[
i
].
buffer_length
=
20
;
bind
[
i
].
length
=
&
len
[
i
];
}
if
(
mysql_stmt_bind_result
(
stmt
,
bind
))
printf
(
"Error: %s
\n
"
,
mysql_stmt_error
(
stmt
));
mysql_stmt_fetch
(
stmt
);
DIE_UNLESS
(
!
strcmp
(
buf
[
1
],
"1"
));
mysql_stmt_close
(
stmt
);
mysql_query
(
mysql
,
"drop table t1, t2, v1"
);
}
/*
Check that proper cleanups are done for prepared statement when
fetching thorugh a cursor.
...
...
@@ -13439,6 +13481,7 @@ static struct my_tests_st my_tests[]= {
{
"test_bug9478"
,
test_bug9478
},
{
"test_bug9643"
,
test_bug9643
},
{
"test_bug10729"
,
test_bug10729
},
{
"test_bug11111"
,
test_bug11111
},
{
0
,
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