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
db6c9129
Commit
db6c9129
authored
Feb 13, 2006
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
parents
ce04588c
e486d81a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
22 deletions
+73
-22
client/mysqltest.c
client/mysqltest.c
+23
-17
libmysql/libmysql.c
libmysql/libmysql.c
+33
-2
tests/mysql_client_test.c
tests/mysql_client_test.c
+17
-3
No files found.
client/mysqltest.c
View file @
db6c9129
...
...
@@ -3157,7 +3157,7 @@ static void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
if
(
mysql_stmt_fetch
(
stmt
)
!=
MYSQL_NO_DATA
)
die
(
"fetch didn't end with MYSQL_NO_DATA from statement: %d %s"
,
mysql_stmt_err
or
(
stmt
),
mysql_stmt_errno
(
stmt
));
mysql_stmt_err
no
(
stmt
),
mysql_stmt_error
(
stmt
));
free_replace_column
();
...
...
@@ -3638,18 +3638,16 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command,
parameter markers.
*/
#ifdef BUG14013_FIXED
if
(
cursor_protocol_enabled
)
{
/*
Use cursor when retrieving result
*/
if
(
cursor_protocol_enabled
)
{
ulong
type
=
CURSOR_TYPE_READ_ONLY
;
if
(
mysql_stmt_attr_set
(
stmt
,
STMT_ATTR_CURSOR_TYPE
,
(
void
*
)
&
type
))
die
(
"mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s"
,
mysql_stmt_errno
(
stmt
),
mysql_stmt_error
(
stmt
));
}
#endif
/*
Execute the query
...
...
@@ -3661,6 +3659,13 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command,
goto
end
;
}
/*
When running in cursor_protocol get the warnings from execute here
and keep them in a separate string for later.
*/
if
(
cursor_protocol_enabled
&&
!
disable_warnings
)
append_warnings
(
&
ds_execute_warnings
,
mysql
);
/*
We instruct that we want to update the "max_length" field in
mysql_stmt_store_result(), this is our only way to know how much
...
...
@@ -3726,6 +3731,7 @@ static void run_query_stmt(MYSQL *mysql, struct st_query *command,
/* Append warnings to ds - if there are any */
if
(
append_warnings
(
&
ds_execute_warnings
,
mysql
)
||
ds_execute_warnings
.
length
||
ds_prepare_warnings
.
length
||
ds_warnings
->
length
)
{
...
...
libmysql/libmysql.c
View file @
db6c9129
...
...
@@ -4757,12 +4757,39 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
if
(
!
stmt
->
field_count
)
DBUG_RETURN
(
0
);
if
((
int
)
stmt
->
state
<
(
int
)
MYSQL_STMT_EXECUTE_DONE
||
mysql
->
status
!=
MYSQL_STATUS_GET_RESULT
)
if
((
int
)
stmt
->
state
<
(
int
)
MYSQL_STMT_EXECUTE_DONE
)
{
set_stmt_error
(
stmt
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
DBUG_RETURN
(
1
);
}
if
(
mysql
->
status
==
MYSQL_STATUS_READY
&&
stmt
->
server_status
&
SERVER_STATUS_CURSOR_EXISTS
)
{
/*
Server side cursor exist, tell server to start sending the rows
*/
NET
*
net
=
&
mysql
->
net
;
char
buff
[
4
/* statement id */
+
4
/* number of rows to fetch */
];
/* Send row request to the server */
int4store
(
buff
,
stmt
->
stmt_id
);
int4store
(
buff
+
4
,
(
int
)
~
0
);
/* number of rows to fetch */
if
(
cli_advanced_command
(
mysql
,
COM_STMT_FETCH
,
buff
,
sizeof
(
buff
),
NullS
,
0
,
1
))
{
set_stmt_errmsg
(
stmt
,
net
->
last_error
,
net
->
last_errno
,
net
->
sqlstate
);
DBUG_RETURN
(
1
);
}
}
else
if
(
mysql
->
status
!=
MYSQL_STATUS_GET_RESULT
)
{
set_stmt_error
(
stmt
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
DBUG_RETURN
(
1
);
}
if
(
result
->
data
)
{
free_root
(
&
result
->
alloc
,
MYF
(
MY_KEEP_PREALLOC
));
...
...
@@ -4803,6 +4830,10 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN
(
1
);
}
/* Assert that if there was a cursor, all rows have been fetched */
DBUG_ASSERT
(
mysql
->
status
!=
MYSQL_STATUS_READY
||
(
mysql
->
server_status
&
SERVER_STATUS_LAST_ROW_SENT
));
if
(
stmt
->
update_max_length
)
{
MYSQL_ROWS
*
cur
=
result
->
data
;
...
...
tests/mysql_client_test.c
View file @
db6c9129
...
...
@@ -1049,7 +1049,10 @@ void stmt_fetch_close(Stmt_fetch *fetch)
reading from the rest.
*/
my_bool
fetch_n
(
const
char
**
query_list
,
unsigned
query_count
)
enum
fetch_type
{
USE_ROW_BY_ROW_FETCH
=
0
,
USE_STORE_RESULT
=
1
};
my_bool
fetch_n
(
const
char
**
query_list
,
unsigned
query_count
,
enum
fetch_type
fetch_type
)
{
unsigned
open_statements
=
query_count
;
int
rc
,
error_count
=
0
;
...
...
@@ -1065,6 +1068,15 @@ my_bool fetch_n(const char **query_list, unsigned query_count)
query_list
[
fetch
-
fetch_array
]);
}
if
(
fetch_type
==
USE_STORE_RESULT
)
{
for
(
fetch
=
fetch_array
;
fetch
<
fetch_array
+
query_count
;
++
fetch
)
{
rc
=
mysql_stmt_store_result
(
fetch
->
handle
);
check_execute
(
fetch
->
handle
,
rc
);
}
}
while
(
open_statements
)
{
for
(
fetch
=
fetch_array
;
fetch
<
fetch_array
+
query_count
;
++
fetch
)
...
...
@@ -11867,7 +11879,8 @@ static void test_basic_cursors()
fill_tables
(
basic_tables
,
sizeof
(
basic_tables
)
/
sizeof
(
*
basic_tables
));
fetch_n
(
queries
,
sizeof
(
queries
)
/
sizeof
(
*
queries
));
fetch_n
(
queries
,
sizeof
(
queries
)
/
sizeof
(
*
queries
),
USE_ROW_BY_ROW_FETCH
);
fetch_n
(
queries
,
sizeof
(
queries
)
/
sizeof
(
*
queries
),
USE_STORE_RESULT
);
DBUG_VOID_RETURN
;
}
...
...
@@ -11880,7 +11893,8 @@ static void test_cursors_with_union()
"SELECT t1.id FROM t1 WHERE t1.id < 5"
};
myheader
(
"test_cursors_with_union"
);
fetch_n
(
queries
,
sizeof
(
queries
)
/
sizeof
(
*
queries
));
fetch_n
(
queries
,
sizeof
(
queries
)
/
sizeof
(
*
queries
),
USE_ROW_BY_ROW_FETCH
);
fetch_n
(
queries
,
sizeof
(
queries
)
/
sizeof
(
*
queries
),
USE_STORE_RESULT
);
}
/*
...
...
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