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
97a5fe8e
Commit
97a5fe8e
authored
Nov 05, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the client_test failure (due to failing cursors tests after the merge).
parent
fe5889de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
53 deletions
+33
-53
sql/sql_prepare.cc
sql/sql_prepare.cc
+6
-10
sql/sql_select.cc
sql/sql_select.cc
+27
-43
No files found.
sql/sql_prepare.cc
View file @
97a5fe8e
...
@@ -1898,7 +1898,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
...
@@ -1898,7 +1898,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
{
{
if
(
stmt
->
cursor
->
is_open
())
if
(
stmt
->
cursor
->
is_open
())
stmt
->
cursor
->
init_from_thd
(
thd
);
stmt
->
cursor
->
init_from_thd
(
thd
);
thd
->
set_item_arena
(
&
thd
->
stmt_backup
)
;
stmt
->
cursor
->
state
=
stmt
->
state
;
}
}
else
else
{
{
...
@@ -2044,6 +2044,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2044,6 +2044,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
DBUG_ENTER
(
"mysql_stmt_fetch"
);
DBUG_ENTER
(
"mysql_stmt_fetch"
);
thd
->
current_arena
=
stmt
;
if
(
!
(
stmt
=
thd
->
stmt_map
.
find
(
stmt_id
))
||
if
(
!
(
stmt
=
thd
->
stmt_map
.
find
(
stmt_id
))
||
!
stmt
->
cursor
||
!
stmt
->
cursor
||
!
stmt
->
cursor
->
is_open
())
!
stmt
->
cursor
->
is_open
())
...
@@ -2053,9 +2054,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2053,9 +2054,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
thd
->
stmt_backup
.
set_statement
(
thd
);
thd
->
set_n_backup_statement
(
stmt
,
&
thd
->
stmt_backup
);
thd
->
stmt_backup
.
set_item_arena
(
thd
);
thd
->
set_statement
(
stmt
);
stmt
->
cursor
->
init_thd
(
thd
);
stmt
->
cursor
->
init_thd
(
thd
);
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
...
@@ -2070,11 +2069,8 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2070,11 +2069,8 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
/* Restore THD state */
/* Restore THD state */
stmt
->
cursor
->
reset_thd
(
thd
);
stmt
->
cursor
->
reset_thd
(
thd
);
thd
->
set_statement
(
&
thd
->
stmt_backup
);
thd
->
restore_backup_statement
(
stmt
,
&
thd
->
stmt_backup
);
thd
->
set_item_arena
(
&
thd
->
stmt_backup
);
thd
->
current_arena
=
thd
;
if
(
error
&&
error
!=
-
4
)
send_error
(
thd
,
ER_OUT_OF_RESOURCES
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2085,7 +2081,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2085,7 +2081,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
SYNOPSIS
SYNOPSIS
mysql_stmt_reset()
mysql_stmt_reset()
thd Thread handle
thd Thread handle
packet Packet with stmt id
packet Packet with stmt id
DESCRIPTION
DESCRIPTION
This function resets statement to the state it was right after prepare.
This function resets statement to the state it was right after prepare.
...
...
sql/sql_select.cc
View file @
97a5fe8e
...
@@ -1683,8 +1683,6 @@ Cursor::init_from_thd(THD *thd)
...
@@ -1683,8 +1683,6 @@ Cursor::init_from_thd(THD *thd)
void
void
Cursor
::
init_thd
(
THD
*
thd
)
Cursor
::
init_thd
(
THD
*
thd
)
{
{
thd
->
mem_root
=
mem_root
;
DBUG_ASSERT
(
thd
->
derived_tables
==
0
);
DBUG_ASSERT
(
thd
->
derived_tables
==
0
);
thd
->
derived_tables
=
derived_tables
;
thd
->
derived_tables
=
derived_tables
;
...
@@ -1694,7 +1692,6 @@ Cursor::init_thd(THD *thd)
...
@@ -1694,7 +1692,6 @@ Cursor::init_thd(THD *thd)
DBUG_ASSERT
(
thd
->
lock
==
0
);
DBUG_ASSERT
(
thd
->
lock
==
0
);
thd
->
lock
=
lock
;
thd
->
lock
=
lock
;
thd
->
query_id
=
query_id
;
thd
->
query_id
=
query_id
;
thd
->
free_list
=
free_list
;
}
}
...
@@ -1779,6 +1776,8 @@ Cursor::fetch(ulong num_rows)
...
@@ -1779,6 +1776,8 @@ Cursor::fetch(ulong num_rows)
int
error
=
0
;
int
error
=
0
;
/* save references to memory, allocated during fetch */
thd
->
set_n_backup_item_arena
(
this
,
&
thd
->
stmt_backup
);
join
->
fetch_limit
+=
num_rows
;
join
->
fetch_limit
+=
num_rows
;
/*
/*
...
@@ -1842,54 +1841,37 @@ Cursor::fetch(ulong num_rows)
...
@@ -1842,54 +1841,37 @@ Cursor::fetch(ulong num_rows)
if
(
thd
->
net
.
report_error
)
if
(
thd
->
net
.
report_error
)
error
=
-
1
;
error
=
-
1
;
if
(
error
==
-
3
)
/* LIMIT clause worked */
error
=
0
;
switch
(
error
)
{
#ifdef USING_TRANSACTIONS
/* Fetch limit worked, possibly more rows are there */
case
-
4
:
if
(
thd
->
transaction
.
all
.
innobase_tid
)
if
(
thd
->
transaction
.
all
.
innobase_tid
)
ha_release_temporary_latches
(
thd
);
ha_release_temporary_latches
(
thd
);
#endif
thd
->
restore_backup_item_arena
(
this
,
&
thd
->
stmt_backup
);
if
(
error
==
-
4
)
{
/* Fetch limit worked, possibly more rows are there */
thd
->
server_status
|=
SERVER_STATUS_CURSOR_EXISTS
;
thd
->
server_status
|=
SERVER_STATUS_CURSOR_EXISTS
;
::
send_eof
(
thd
);
::
send_eof
(
thd
);
thd
->
server_status
&=
~
SERVER_STATUS_CURSOR_EXISTS
;
thd
->
server_status
&=
~
SERVER_STATUS_CURSOR_EXISTS
;
/* save references to memory, allocated during fetch */
}
mem_root
=
thd
->
mem_root
;
else
free_list
=
thd
->
free_list
;
{
break
;
/* Limit clause worked: this is the same as 'no more rows' */
case
-
3
:
/* LIMIT clause worked */
error
=
0
;
/* fallthrough */
case
0
:
/* No more rows */
if
(
thd
->
transaction
.
all
.
innobase_tid
)
ha_release_temporary_latches
(
thd
);
close
();
thd
->
server_status
|=
SERVER_STATUS_LAST_ROW_SENT
;
::
send_eof
(
thd
);
thd
->
server_status
&=
~
SERVER_STATUS_LAST_ROW_SENT
;
join
=
0
;
unit
=
0
;
free_items
(
thd
->
free_list
);
thd
->
free_list
=
free_list
=
0
;
/*
Must be last, as some memory might be allocated for free purposes,
like in free_tmp_table() (TODO: fix this issue)
*/
mem_root
=
thd
->
mem_root
;
free_root
(
&
mem_root
,
MYF
(
0
));
break
;
default:
close
();
close
();
join
=
0
;
if
(
error
==
0
)
unit
=
0
;
{
free_items
(
thd
->
free_list
);
thd
->
server_status
|=
SERVER_STATUS_LAST_ROW_SENT
;
thd
->
free_list
=
free_list
=
0
;
::
send_eof
(
thd
);
/*
thd
->
server_status
&=
~
SERVER_STATUS_LAST_ROW_SENT
;
Must be last, as some memory might be allocated for free purposes,
}
like in free_tmp_table() (TODO: fix this issue)
else
*/
send_error
(
thd
,
ER_OUT_OF_RESOURCES
);
mem_root
=
thd
->
mem_root
;
/* free cursor memory */
free_items
(
free_list
);
free_list
=
0
;
free_root
(
&
mem_root
,
MYF
(
0
));
free_root
(
&
mem_root
,
MYF
(
0
));
break
;
}
}
return
error
;
return
error
;
}
}
...
@@ -1927,6 +1909,8 @@ Cursor::close()
...
@@ -1927,6 +1909,8 @@ Cursor::close()
thd
->
derived_tables
=
tmp_derived_tables
;
thd
->
derived_tables
=
tmp_derived_tables
;
thd
->
lock
=
tmp_lock
;
thd
->
lock
=
tmp_lock
;
}
}
join
=
0
;
unit
=
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