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
df77391f
Commit
df77391f
authored
Oct 24, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:mysql-4.1-opt
into mysql.com:/home/hf/work/w3475/my41-w3475
parents
8b447a8a
7e233692
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
89 additions
and
63 deletions
+89
-63
client/mysqltest.c
client/mysqltest.c
+88
-12
libmysql/libmysql.c
libmysql/libmysql.c
+0
-7
mysql-test/t/bdb-deadlock.test
mysql-test/t/bdb-deadlock.test
+0
-8
mysql-test/t/flush.test
mysql-test/t/flush.test
+0
-8
mysql-test/t/flush_block_commit.test
mysql-test/t/flush_block_commit.test
+0
-3
mysql-test/t/innodb-deadlock.test
mysql-test/t/innodb-deadlock.test
+0
-2
mysql-test/t/innodb-lock.test
mysql-test/t/innodb-lock.test
+0
-2
mysql-test/t/lock_multi.test
mysql-test/t/lock_multi.test
+0
-8
mysql-test/t/rename.test
mysql-test/t/rename.test
+0
-4
mysql-test/t/show_check.test
mysql-test/t/show_check.test
+1
-2
mysql-test/t/status.test
mysql-test/t/status.test
+0
-7
No files found.
client/mysqltest.c
View file @
df77391f
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
* Matt Wagner <matt@mysql.com>
* Matt Wagner <matt@mysql.com>
* Monty
* Monty
* Jani
* Jani
* Holyfoot
**/
**/
/**********************************************************************
/**********************************************************************
...
@@ -215,6 +216,12 @@ struct connection
...
@@ -215,6 +216,12 @@ struct connection
{
{
MYSQL
mysql
;
MYSQL
mysql
;
char
*
name
;
char
*
name
;
const
char
*
cur_query
;
int
cur_query_len
;
pthread_mutex_t
mutex
;
pthread_cond_t
cond
;
int
query_done
;
};
};
typedef
struct
typedef
struct
...
@@ -461,6 +468,57 @@ static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
...
@@ -461,6 +468,57 @@ static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int
len
);
int
len
);
static
int
handle_no_error
(
struct
st_query
*
q
);
static
int
handle_no_error
(
struct
st_query
*
q
);
#ifdef EMBEDDED_LIBRARY
/*
send_one_query executes query in separate thread what is
necessary in embedded library to run 'send' in proper way.
This implementation doesn't handle errors returned
by mysql_send_query. It's technically possible, though
i don't see where it is needed.
*/
pthread_handler_decl
(
send_one_query
,
arg
)
{
struct
connection
*
cn
=
(
struct
connection
*
)
arg
;
mysql_thread_init
();
VOID
(
mysql_send_query
(
&
cn
->
mysql
,
cn
->
cur_query
,
cn
->
cur_query_len
));
mysql_thread_end
();
pthread_mutex_lock
(
&
cn
->
mutex
);
cn
->
query_done
=
1
;
VOID
(
pthread_cond_signal
(
&
cn
->
cond
));
pthread_mutex_unlock
(
&
cn
->
mutex
);
pthread_exit
(
0
);
return
0
;
}
static
int
do_send_query
(
struct
connection
*
cn
,
const
char
*
q
,
int
q_len
,
int
flags
)
{
pthread_t
tid
;
if
(
flags
&
QUERY_REAP
)
return
mysql_send_query
(
&
cn
->
mysql
,
q
,
q_len
);
if
(
pthread_mutex_init
(
&
cn
->
mutex
,
NULL
)
||
pthread_cond_init
(
&
cn
->
cond
,
NULL
))
die
(
"Error in the thread library"
);
cn
->
cur_query
=
q
;
cn
->
cur_query_len
=
q_len
;
cn
->
query_done
=
0
;
if
(
pthread_create
(
&
tid
,
NULL
,
send_one_query
,
(
void
*
)
cn
))
die
(
"Cannot start new thread for query"
);
return
0
;
}
#else
/*EMBEDDED_LIBRARY*/
#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len)
#endif
/*EMBEDDED_LIBRARY*/
static
void
do_eval
(
DYNAMIC_STRING
*
query_eval
,
const
char
*
query
)
static
void
do_eval
(
DYNAMIC_STRING
*
query_eval
,
const
char
*
query
)
{
{
const
char
*
p
;
const
char
*
p
;
...
@@ -2767,15 +2825,17 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
...
@@ -2767,15 +2825,17 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
* the result will be read - for regular query, both bits must be on
* the result will be read - for regular query, both bits must be on
*/
*/
static
int
run_query_normal
(
MYSQL
*
mysql
,
struct
st_query
*
q
,
int
flags
);
static
int
run_query_normal
(
struct
connection
*
cn
,
struct
st_query
*
q
,
static
int
run_query_stmt
(
MYSQL
*
mysql
,
struct
st_query
*
q
,
int
flags
);
int
flags
);
static
int
run_query_stmt
(
struct
connection
*
cn
,
struct
st_query
*
q
,
int
flags
);
static
void
run_query_stmt_handle_warnings
(
MYSQL
*
mysql
,
DYNAMIC_STRING
*
ds
);
static
void
run_query_stmt_handle_warnings
(
MYSQL
*
mysql
,
DYNAMIC_STRING
*
ds
);
static
int
run_query_stmt_handle_error
(
char
*
query
,
struct
st_query
*
q
,
static
int
run_query_stmt_handle_error
(
char
*
query
,
struct
st_query
*
q
,
MYSQL_STMT
*
stmt
,
DYNAMIC_STRING
*
ds
);
MYSQL_STMT
*
stmt
,
DYNAMIC_STRING
*
ds
);
static
void
run_query_display_metadata
(
MYSQL_FIELD
*
field
,
uint
num_fields
,
static
void
run_query_display_metadata
(
MYSQL_FIELD
*
field
,
uint
num_fields
,
DYNAMIC_STRING
*
ds
);
DYNAMIC_STRING
*
ds
);
static
int
run_query
(
MYSQL
*
mysql
,
struct
st_query
*
q
,
int
flags
)
static
int
run_query
(
struct
connection
*
cn
,
struct
st_query
*
q
,
int
flags
)
{
{
/*
/*
...
@@ -2791,13 +2851,15 @@ static int run_query(MYSQL *mysql, struct st_query *q, int flags)
...
@@ -2791,13 +2851,15 @@ static int run_query(MYSQL *mysql, struct st_query *q, int flags)
if
(
ps_protocol_enabled
&&
disable_info
&&
if
(
ps_protocol_enabled
&&
disable_info
&&
(
flags
&
QUERY_SEND
)
&&
(
flags
&
QUERY_REAP
)
&&
ps_match_re
(
q
->
query
))
(
flags
&
QUERY_SEND
)
&&
(
flags
&
QUERY_REAP
)
&&
ps_match_re
(
q
->
query
))
return
run_query_stmt
(
mysql
,
q
,
flags
);
return
run_query_stmt
(
cn
,
q
,
flags
);
return
run_query_normal
(
mysql
,
q
,
flags
);
return
run_query_normal
(
cn
,
q
,
flags
);
}
}
static
int
run_query_normal
(
MYSQL
*
mysql
,
struct
st_query
*
q
,
int
flags
)
static
int
run_query_normal
(
struct
connection
*
cn
,
struct
st_query
*
q
,
int
flags
)
{
{
MYSQL
*
mysql
=
&
cn
->
mysql
;
MYSQL_RES
*
res
=
0
;
MYSQL_RES
*
res
=
0
;
uint
i
;
uint
i
;
int
error
=
0
,
err
=
0
,
counter
=
0
;
int
error
=
0
,
err
=
0
,
counter
=
0
;
...
@@ -2833,11 +2895,24 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
...
@@ -2833,11 +2895,24 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
if
(
flags
&
QUERY_SEND
)
if
(
flags
&
QUERY_SEND
)
{
{
got_error_on_send
=
mysql_send_query
(
mysql
,
query
,
query_len
);
got_error_on_send
=
do_send_query
(
cn
,
query
,
query_len
,
flags
);
if
(
got_error_on_send
&&
q
->
expected_errno
[
0
].
type
==
ERR_EMPTY
)
if
(
got_error_on_send
&&
q
->
expected_errno
[
0
].
type
==
ERR_EMPTY
)
die
(
"unable to send query '%s' (mysql_errno=%d , errno=%d)"
,
die
(
"unable to send query '%s' (mysql_errno=%d , errno=%d)"
,
query
,
mysql_errno
(
mysql
),
errno
);
query
,
mysql_errno
(
mysql
),
errno
);
}
}
#ifdef EMBEDDED_LIBRARY
/*
Here we handle 'reap' command, so we need to check if the
query's thread was finished and probably wait
*/
else
if
(
flags
&
QUERY_REAP
)
{
pthread_mutex_lock
(
&
cn
->
mutex
);
while
(
!
cn
->
query_done
)
pthread_cond_wait
(
&
cn
->
cond
,
&
cn
->
mutex
);
pthread_mutex_unlock
(
&
cn
->
mutex
);
}
#endif
/*EMBEDDED_LIBRARY*/
do
do
{
{
...
@@ -3038,8 +3113,9 @@ end:
...
@@ -3038,8 +3113,9 @@ end:
complete SEND+REAP
complete SEND+REAP
*/
*/
static
int
run_query_stmt
(
MYSQL
*
mysql
,
struct
st_query
*
q
,
int
flags
)
static
int
run_query_stmt
(
struct
connection
*
cn
,
struct
st_query
*
q
,
int
flags
)
{
{
MYSQL
*
mysql
=
&
cn
->
mysql
;
int
error
=
0
;
/* Function return code if "goto end;" */
int
error
=
0
;
/* Function return code if "goto end;" */
int
err
;
/* Temporary storage of return code from calls */
int
err
;
/* Temporary storage of return code from calls */
int
query_len
,
got_error_on_execute
;
int
query_len
,
got_error_on_execute
;
...
@@ -3095,7 +3171,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
...
@@ -3095,7 +3171,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
C API.
C API.
*/
*/
if
((
err
=
mysql_stmt_prepare
(
stmt
,
query
,
query_len
))
==
CR_NO_PREPARE_STMT
)
if
((
err
=
mysql_stmt_prepare
(
stmt
,
query
,
query_len
))
==
CR_NO_PREPARE_STMT
)
return
run_query_normal
(
mysql
,
q
,
flags
);
return
run_query_normal
(
cn
,
q
,
flags
);
if
(
err
!=
0
)
if
(
err
!=
0
)
{
{
...
@@ -3922,7 +3998,7 @@ int main(int argc, char **argv)
...
@@ -3922,7 +3998,7 @@ int main(int argc, char **argv)
q
->
require_file
=
require_file
;
q
->
require_file
=
require_file
;
save_file
[
0
]
=
0
;
save_file
[
0
]
=
0
;
}
}
error
|=
run_query
(
&
cur_con
->
mysql
,
q
,
QUERY_REAP
|
QUERY_SEND
);
error
|=
run_query
(
cur_con
,
q
,
QUERY_REAP
|
QUERY_SEND
);
display_result_vertically
=
old_display_result_vertically
;
display_result_vertically
=
old_display_result_vertically
;
q
->
last_argument
=
q
->
end
;
q
->
last_argument
=
q
->
end
;
query_executed
=
1
;
query_executed
=
1
;
...
@@ -3949,7 +4025,7 @@ int main(int argc, char **argv)
...
@@ -3949,7 +4025,7 @@ int main(int argc, char **argv)
q
->
require_file
=
require_file
;
q
->
require_file
=
require_file
;
save_file
[
0
]
=
0
;
save_file
[
0
]
=
0
;
}
}
error
|=
run_query
(
&
cur_con
->
mysql
,
q
,
flags
);
error
|=
run_query
(
cur_con
,
q
,
flags
);
query_executed
=
1
;
query_executed
=
1
;
q
->
last_argument
=
q
->
end
;
q
->
last_argument
=
q
->
end
;
break
;
break
;
...
@@ -3970,7 +4046,7 @@ int main(int argc, char **argv)
...
@@ -3970,7 +4046,7 @@ int main(int argc, char **argv)
query and read the result some time later when reap instruction
query and read the result some time later when reap instruction
is given on this connection.
is given on this connection.
*/
*/
error
|=
run_query
(
&
cur_con
->
mysql
,
q
,
QUERY_SEND
);
error
|=
run_query
(
cur_con
,
q
,
QUERY_SEND
);
query_executed
=
1
;
query_executed
=
1
;
q
->
last_argument
=
q
->
end
;
q
->
last_argument
=
q
->
end
;
break
;
break
;
...
...
libmysql/libmysql.c
View file @
df77391f
...
@@ -4395,13 +4395,6 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
...
@@ -4395,13 +4395,6 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
set_stmt_error
(
stmt
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
set_stmt_error
(
stmt
,
CR_COMMANDS_OUT_OF_SYNC
,
unknown_sqlstate
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
result
->
data
)
{
free_root
(
&
result
->
alloc
,
MYF
(
MY_KEEP_PREALLOC
));
result
->
data
=
NULL
;
result
->
rows
=
0
;
stmt
->
data_cursor
=
NULL
;
}
if
(
stmt
->
update_max_length
&&
!
stmt
->
bind_result_done
)
if
(
stmt
->
update_max_length
&&
!
stmt
->
bind_result_done
)
{
{
...
...
mysql-test/t/bdb-deadlock.test
View file @
df77391f
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
--
source
include
/
not_embedded
.
inc
--
source
include
/
have_bdb
.
inc
--
source
include
/
have_bdb
.
inc
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
...
...
mysql-test/t/flush.test
View file @
df77391f
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
--
source
include
/
not_embedded
.
inc
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connection
con1
;
connection
con1
;
...
...
mysql-test/t/flush_block_commit.test
View file @
df77391f
...
@@ -3,9 +3,6 @@
...
@@ -3,9 +3,6 @@
# We verify that we did not introduce a deadlock.
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
# This is intended to mimick how mysqldump and innobackup work.
# This test doesn't work with the embedded server
--
source
include
/
not_embedded
.
inc
# And it requires InnoDB
# And it requires InnoDB
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
...
...
mysql-test/t/innodb-deadlock.test
View file @
df77391f
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
# Can't test this with embedded server
--
source
include
/
not_embedded
.
inc
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
...
...
mysql-test/t/innodb-lock.test
View file @
df77391f
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
# Can't test this with embedded server
--
source
include
/
not_embedded
.
inc
#
#
# Check and select innodb lock type
# Check and select innodb lock type
...
...
mysql-test/t/lock_multi.test
View file @
df77391f
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
--
source
include
/
not_embedded
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
enable_warnings
...
...
mysql-test/t/rename.test
View file @
df77391f
...
@@ -2,10 +2,6 @@
...
@@ -2,10 +2,6 @@
# Test of rename table
# Test of rename table
#
#
# Test requires concurrent connections, which can't be tested on embedded
# server
--
source
include
/
not_embedded
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t0
,
t1
,
t2
,
t3
,
t4
;
drop
table
if
exists
t0
,
t1
,
t2
,
t3
,
t4
;
# Clear up from other tests (to ensure that SHOW TABLES below is right)
# Clear up from other tests (to ensure that SHOW TABLES below is right)
...
...
mysql-test/t/show_check.test
View file @
df77391f
# Requires use of multiple simultaneous connections, not supported with
# Uses GRANT commands that usually disabled in embedded server
# embedded server testing
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
#
#
...
...
mysql-test/t/status.test
View file @
df77391f
# This test doesn't work with the embedded version as this code
# assumes that one query is running while we are doing queries on
# a second connection.
# This would work if mysqltest run would be threaded and handle each
# connection in a separate thread.
#
--
source
include
/
not_embedded
.
inc
# PS causes different statistics
# PS causes different statistics
--
disable_ps_protocol
--
disable_ps_protocol
...
...
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