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
97caae51
Commit
97caae51
authored
Jun 23, 2004
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/pem/work/mysql-4.1
parents
ac688684
34ddd9c5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
2 deletions
+59
-2
mysql-test/r/ps.result
mysql-test/r/ps.result
+18
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+16
-0
sql/item_create.cc
sql/item_create.cc
+1
-1
sql/item_func.cc
sql/item_func.cc
+9
-0
sql/item_func.h
sql/item_func.h
+10
-0
sql/sql_select.cc
sql/sql_select.cc
+5
-1
No files found.
mysql-test/r/ps.result
View file @
97caae51
...
...
@@ -119,3 +119,21 @@ EXECUTE stmt1 USING @var;
_utf8 'A' collate utf8_bin = ?
1
DEALLOCATE PREPARE stmt1;
create table t1 (id int);
prepare stmt1 from "select FOUND_ROWS()";
select SQL_CALC_FOUND_ROWS * from t1;
id
execute stmt1;
FOUND_ROWS()
0
insert into t1 values (1);
select SQL_CALC_FOUND_ROWS * from t1;
id
1
execute stmt1;
FOUND_ROWS()
1
execute stmt1;
FOUND_ROWS()
0
deallocate prepare stmt1;
mysql-test/t/ps.test
View file @
97caae51
...
...
@@ -124,3 +124,19 @@ PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set
@
var
=
'A'
;
EXECUTE
stmt1
USING
@
var
;
DEALLOCATE
PREPARE
stmt1
;
#
# BUG#3486: FOUND_ROWS() fails inside stored procedure [and prepared statement]
#
create
table
t1
(
id
int
);
prepare
stmt1
from
"select FOUND_ROWS()"
;
select
SQL_CALC_FOUND_ROWS
*
from
t1
;
# Expect 0
execute
stmt1
;
insert
into
t1
values
(
1
);
select
SQL_CALC_FOUND_ROWS
*
from
t1
;
# Expect 1
execute
stmt1
;
# Expect 0
execute
stmt1
;
deallocate
prepare
stmt1
;
sql/item_create.cc
View file @
97caae51
...
...
@@ -154,7 +154,7 @@ Item *create_func_found_rows(void)
{
THD
*
thd
=
current_thd
;
thd
->
lex
->
safe_to_cache_query
=
0
;
return
new
Item_
int
(
NullS
,(
longlong
)
thd
->
found_rows
(),
21
);
return
new
Item_
func_found_rows
(
);
}
Item
*
create_func_from_days
(
Item
*
a
)
...
...
sql/item_func.cc
View file @
97caae51
...
...
@@ -3234,3 +3234,12 @@ longlong Item_func_is_used_lock::val_int()
null_value
=
0
;
return
ull
->
thread_id
;
}
longlong
Item_func_found_rows
::
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
THD
*
thd
=
current_thd
;
return
thd
->
found_rows
();
}
sql/item_func.h
View file @
97caae51
...
...
@@ -1071,3 +1071,13 @@ enum Cast_target
ITEM_CAST_BINARY
,
ITEM_CAST_SIGNED_INT
,
ITEM_CAST_UNSIGNED_INT
,
ITEM_CAST_DATE
,
ITEM_CAST_TIME
,
ITEM_CAST_DATETIME
,
ITEM_CAST_CHAR
};
class
Item_func_found_rows
:
public
Item_int_func
{
public:
Item_func_found_rows
()
:
Item_int_func
()
{}
longlong
val_int
();
const
char
*
func_name
()
const
{
return
"found_rows"
;
}
void
fix_length_and_dec
()
{
decimals
=
0
;
maybe_null
=
0
;
}
};
sql/sql_select.cc
View file @
97caae51
...
...
@@ -1088,12 +1088,14 @@ JOIN::exec()
DBUG_ENTER
(
"JOIN::exec"
);
error
=
0
;
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
if
(
procedure
)
{
if
(
procedure
->
change_columns
(
fields_list
)
||
result
->
prepare
(
fields_list
,
unit
))
{
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
DBUG_VOID_RETURN
;
}
}
if
(
!
tables_list
)
...
...
@@ -1119,8 +1121,10 @@ JOIN::exec()
else
error
=
(
int
)
result
->
send_eof
();
}
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
DBUG_VOID_RETURN
;
}
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
if
(
zero_result_cause
)
{
...
...
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