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
ac96a2bb
Commit
ac96a2bb
authored
Dec 07, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
14cf21c4
5c7949af
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
0 deletions
+70
-0
.bzrignore
.bzrignore
+2
-0
libmysql/libmysql.c
libmysql/libmysql.c
+6
-0
tests/client_test.c
tests/client_test.c
+62
-0
No files found.
.bzrignore
View file @
ac96a2bb
...
...
@@ -943,3 +943,5 @@ ac_available_languages_fragment
libmysqld/ha_archive.cc
libmysqld/ha_example.cc
libmysqld/ha_tina.cc
analyse.test
client/mysqladmin.c
libmysql/libmysql.c
View file @
ac96a2bb
...
...
@@ -4413,6 +4413,12 @@ mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong row)
for
(;
tmp
&&
row
;
--
row
,
tmp
=
tmp
->
next
)
;
stmt
->
data_cursor
=
tmp
;
if
(
!
row
&&
tmp
)
{
/* Rewind the counter */
stmt
->
read_row_func
=
stmt_read_row_buffered
;
stmt
->
state
=
MYSQL_STMT_EXECUTE_DONE
;
}
DBUG_VOID_RETURN
;
}
...
...
tests/client_test.c
View file @
ac96a2bb
...
...
@@ -11389,6 +11389,67 @@ static void test_conversion()
myquery
(
rc
);
}
static
void
test_rewind
(
void
)
{
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
;
int
rc
=
0
;
const
char
*
stmt_text
;
long
unsigned
int
length
=
4
,
Data
=
0
;
my_bool
isnull
=
0
;
myheader
(
"test_rewind"
);
stmt_text
=
"CREATE TABLE t1 (a int)"
;
rc
=
mysql_real_query
(
mysql
,
stmt_text
,
strlen
(
stmt_text
));
myquery
(
rc
);
stmt_text
=
"INSERT INTO t1 VALUES(2),(3),(4)"
;
rc
=
mysql_real_query
(
mysql
,
stmt_text
,
strlen
(
stmt_text
));
myquery
(
rc
);
stmt
=
mysql_stmt_init
(
mysql
);
stmt_text
=
"SELECT * FROM t1"
;
rc
=
mysql_stmt_prepare
(
stmt
,
stmt_text
,
strlen
(
stmt_text
));
check_execute
(
stmt
,
rc
);
bzero
(
&
bind
,
sizeof
(
MYSQL_BIND
));
bind
.
buffer_type
=
MYSQL_TYPE_LONG
;
bind
.
buffer
=
(
void
*
)
&
Data
;
/* this buffer won't be altered */
bind
.
length
=
&
length
;
bind
.
is_null
=
&
isnull
;
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_store_result
(
stmt
);
DIE_UNLESS
(
rc
==
0
);
rc
=
mysql_stmt_bind_result
(
stmt
,
&
bind
);
DIE_UNLESS
(
rc
==
0
);
/* retreive all result sets till we are at the end */
while
(
!
mysql_stmt_fetch
(
stmt
))
printf
(
"fetched result:%ld
\n
"
,
Data
);
DIE_UNLESS
(
rc
!=
MYSQL_NO_DATA
);
/* seek to the first row */
mysql_stmt_data_seek
(
stmt
,
0
);
/* now we should be able to fetch the results again */
/* but mysql_stmt_fetch returns MYSQL_NO_DATA */
while
(
!
(
rc
=
mysql_stmt_fetch
(
stmt
)))
printf
(
"fetched result after seek:%ld
\n
"
,
Data
);
DIE_UNLESS
(
rc
==
MYSQL_NO_DATA
);
stmt_text
=
"DROP TABLE t1"
;
rc
=
mysql_real_query
(
mysql
,
stmt_text
,
strlen
(
stmt_text
));
myquery
(
rc
);
rc
=
mysql_stmt_free_result
(
stmt
);
rc
=
mysql_stmt_close
(
stmt
);
}
/*
Read and parse arguments and MySQL options from my.cnf
...
...
@@ -11594,6 +11655,7 @@ static struct my_tests_st my_tests[]= {
{
"test_datetime_ranges"
,
test_datetime_ranges
},
{
"test_bug4172"
,
test_bug4172
},
{
"test_conversion"
,
test_conversion
},
{
"test_rewind"
,
test_rewind
},
{
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