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
5cdcbb57
Commit
5cdcbb57
authored
Apr 16, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the support of statement result navigation APIs
parent
24d5cd37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
15 deletions
+87
-15
include/mysql.h
include/mysql.h
+5
-6
libmysql/libmysql.c
libmysql/libmysql.c
+82
-9
No files found.
include/mysql.h
View file @
5cdcbb57
...
...
@@ -566,14 +566,13 @@ my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
int
STDCALL
mysql_stmt_store_result
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_more_results
(
MYSQL
*
mysql
);
my_bool
STDCALL
mysql_next_result
(
MYSQL
*
mysql
);
MYSQL_ROW_OFFSET
STDCALL
mysql_stmt_row_seek
(
MYSQL_STMT
*
stmt
,
MYSQL_ROW_OFFSET
offset
);
MYSQL_ROW_OFFSET
STDCALL
mysql_stmt_row_tell
(
MYSQL_STMT
*
stmt
);
void
STDCALL
mysql_stmt_data_seek
(
MYSQL_STMT
*
stmt
,
my_ulonglong
offset
);
/* new status messages */
#define MYSQL_SUCCESS 0
#define MYSQL_STATUS_ERROR 1
/* status return codes */
#define MYSQL_NO_DATA 100
#define MYSQL_NEED_DATA 99
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
...
...
libmysql/libmysql.c
View file @
5cdcbb57
...
...
@@ -5418,9 +5418,71 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN
(
0
);
/* Data buffered, must be fetched with mysql_fetch() */
}
/*
Seek to desired row in the statement result set
*/
MYSQL_ROW_OFFSET
STDCALL
mysql_stmt_row_seek
(
MYSQL_STMT
*
stmt
,
MYSQL_ROW_OFFSET
row
)
{
MYSQL_RES
*
result
;
DBUG_ENTER
(
"mysql_stmt_row_seek"
);
if
((
result
=
stmt
->
result
))
{
MYSQL_ROW_OFFSET
return_value
=
result
->
data_cursor
;
result
->
current_row
=
0
;
result
->
data_cursor
=
row
;
DBUG_RETURN
(
return_value
);
}
DBUG_PRINT
(
"exit"
,
(
"stmt doesn't contain any resultset"
));
DBUG_RETURN
(
0
);
}
/*
Return the current statement row cursor position
*/
MYSQL_ROW_OFFSET
STDCALL
mysql_stmt_row_tell
(
MYSQL_STMT
*
stmt
)
{
DBUG_ENTER
(
"mysql_stmt_row_tell"
);
if
(
stmt
->
result
)
DBUG_RETURN
(
stmt
->
result
->
data_cursor
);
DBUG_PRINT
(
"exit"
,
(
"stmt doesn't contain any resultset"
));
DBUG_RETURN
(
0
);
}
/*
Move the stmt result set data cursor to specified row
*/
void
STDCALL
mysql_stmt_data_seek
(
MYSQL_STMT
*
stmt
,
my_ulonglong
row
)
{
MYSQL_RES
*
result
;
DBUG_ENTER
(
"mysql_stmt_data_seek"
);
DBUG_PRINT
(
"enter"
,(
"row id to seek: %ld"
,(
long
)
row
));
if
(
!
(
result
=
stmt
->
result
))
{
DBUG_PRINT
(
"exit"
,
(
"stmt doesn't contain any resultset"
));
}
else
{
MYSQL_ROWS
*
tmp
=
0
;
if
(
result
->
data
)
for
(
tmp
=
result
->
data
->
data
;
row
--
&&
tmp
;
tmp
=
tmp
->
next
)
;
result
->
current_row
=
0
;
result
->
data_cursor
=
tmp
;
}
}
/********************************************************************
Misc function implementations
statement error handling and close
*********************************************************************/
/*
...
...
@@ -5505,6 +5567,10 @@ const char *STDCALL mysql_stmt_error(MYSQL_STMT * stmt)
DBUG_RETURN
(
stmt
->
last_error
);
}
/********************************************************************
Transactional APIs
*********************************************************************/
/*
Commit the current transaction
*/
...
...
@@ -5542,7 +5608,7 @@ my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode)
/********************************************************************
Multi query execution
related implementation
s
Multi query execution
+ SPs API
s
*********************************************************************/
/*
...
...
@@ -5552,9 +5618,14 @@ my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode)
my_bool
STDCALL
mysql_more_results
(
MYSQL
*
mysql
)
{
if
(
mysql
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
return
1
;
return
0
;
my_bool
result
;
DBUG_ENTER
(
"mysql_more_results"
);
result
=
(
mysql
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
?
1
:
0
;
DBUG_PRINT
(
"exit"
,(
"More results exists ? %d"
,
result
));
DBUG_RETURN
(
result
);
}
/*
...
...
@@ -5563,12 +5634,14 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql)
my_bool
STDCALL
mysql_next_result
(
MYSQL
*
mysql
)
{
DBUG_ENTER
(
"mysql_next_result"
);
mysql
->
net
.
last_error
[
0
]
=
0
;
mysql
->
net
.
last_errno
=
0
;
mysql
->
net
.
last_error
[
0
]
=
0
;
mysql
->
net
.
last_errno
=
0
;
mysql
->
affected_rows
=
~
(
my_ulonglong
)
0
;
if
(
mysql
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
return
mysql_read_query_result
(
mysql
);
return
0
;
DBUG_RETURN
(
mysql_read_query_result
(
mysql
));
DBUG_RETURN
(
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