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
fdc48a05
Commit
fdc48a05
authored
Jan 31, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for subsequent error calls in multi-query
parent
87206f10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
20 deletions
+33
-20
sql/sql_parse.cc
sql/sql_parse.cc
+1
-0
tests/client_test.c
tests/client_test.c
+32
-20
No files found.
sql/sql_parse.cc
View file @
fdc48a05
...
@@ -1225,6 +1225,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1225,6 +1225,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
}
thd
->
query_length
=
length
;
thd
->
query_length
=
length
;
thd
->
query
=
packet
;
thd
->
query
=
packet
;
thd
->
net
.
last_error
[
0
]
=
'\0'
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
thd
->
query_id
=
query_id
++
;
thd
->
query_id
=
query_id
++
;
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_thread_count
));
...
...
tests/client_test.c
View file @
fdc48a05
...
@@ -80,10 +80,10 @@ static void print_error(const char *msg)
...
@@ -80,10 +80,10 @@ static void print_error(const char *msg)
if
(
mysql
)
if
(
mysql
)
{
{
if
(
mysql
->
server_version
)
if
(
mysql
->
server_version
)
fprintf
(
std
err
,
"
\n
[MySQL-%s]"
,
mysql
->
server_version
);
fprintf
(
std
out
,
"
\n
[MySQL-%s]"
,
mysql
->
server_version
);
else
else
fprintf
(
std
err
,
"
\n
[MySQL]"
);
fprintf
(
std
out
,
"
\n
[MySQL]"
);
fprintf
(
std
err
,
"[%d] %s
\n
"
,
mysql_errno
(
mysql
),
mysql_error
(
mysql
));
fprintf
(
std
out
,
"[%d] %s
\n
"
,
mysql_errno
(
mysql
),
mysql_error
(
mysql
));
}
}
else
if
(
msg
)
fprintf
(
stderr
,
" [MySQL] %s
\n
"
,
msg
);
else
if
(
msg
)
fprintf
(
stderr
,
" [MySQL] %s
\n
"
,
msg
);
}
}
...
@@ -93,11 +93,11 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
...
@@ -93,11 +93,11 @@ static void print_st_error(MYSQL_STMT *stmt, const char *msg)
if
(
stmt
)
if
(
stmt
)
{
{
if
(
stmt
->
mysql
&&
stmt
->
mysql
->
server_version
)
if
(
stmt
->
mysql
&&
stmt
->
mysql
->
server_version
)
fprintf
(
std
err
,
"
\n
[MySQL-%s]"
,
stmt
->
mysql
->
server_version
);
fprintf
(
std
out
,
"
\n
[MySQL-%s]"
,
stmt
->
mysql
->
server_version
);
else
else
fprintf
(
std
err
,
"
\n
[MySQL]"
);
fprintf
(
std
out
,
"
\n
[MySQL]"
);
fprintf
(
std
err
,
"[%d] %s
\n
"
,
mysql_stmt_errno
(
stmt
),
fprintf
(
std
out
,
"[%d] %s
\n
"
,
mysql_stmt_errno
(
stmt
),
mysql_stmt_error
(
stmt
));
mysql_stmt_error
(
stmt
));
}
}
else
if
(
msg
)
fprintf
(
stderr
,
" [MySQL] %s
\n
"
,
msg
);
else
if
(
msg
)
fprintf
(
stderr
,
" [MySQL] %s
\n
"
,
msg
);
...
@@ -4425,6 +4425,9 @@ static void test_multi_query()
...
@@ -4425,6 +4425,9 @@ static void test_multi_query()
int
rc
;
int
rc
;
const
char
*
query
=
"DROP TABLE IF EXISTS test_multi_tab;\
const
char
*
query
=
"DROP TABLE IF EXISTS test_multi_tab;\
CREATE TABLE test_multi_tab(id int,name char(20));\
INSERT INTO test_multi_tab(xxxx) VALUES(10);\
UPDATE test_multi_tab SET id=10 WHERE unkown_col=10;\
CREATE TABLE test_multi_tab(id int,name char(20));\
CREATE TABLE test_multi_tab(id int,name char(20));\
INSERT INTO test_multi_tab(id) VALUES(10),(20);\
INSERT INTO test_multi_tab(id) VALUES(10),(20);\
INSERT INTO test_multi_tab VALUES(20,'insert;comma');\
INSERT INTO test_multi_tab VALUES(20,'insert;comma');\
...
@@ -4434,9 +4437,12 @@ static void test_multi_query()
...
@@ -4434,9 +4437,12 @@ static void test_multi_query()
DELETE FROM test_multi_tab WHERE name='new;name';\
DELETE FROM test_multi_tab WHERE name='new;name';\
SELECT * FROM test_multi_tab;\
SELECT * FROM test_multi_tab;\
DELETE FROM test_multi_tab WHERE id=10;\
DELETE FROM test_multi_tab WHERE id=10;\
SELECT * FROM test_multi_tab"
;
SELECT * FROM test_multi_tab;\
uint
count
,
rows
[
10
]
=
{
0
,
2
,
1
,
3
,
0
,
2
,
2
,
1
,
1
,
0
};
DROP TABLE test_multi_tab;\
DROP TABLE test_multi_tab;\
DROP TABLE IF EXISTS test_multi_tab"
;
uint
count
,
rows
[
16
]
=
{
0
,
1054
,
1054
,
1050
,
2
,
1
,
3
,
1054
,
2
,
2
,
1
,
1
,
0
,
0
,
1051
,
0
},
exp_value
;
myheader
(
"test_multi_query"
);
myheader
(
"test_multi_query"
);
rc
=
mysql_query
(
mysql
,
query
);
/* syntax error */
rc
=
mysql_query
(
mysql
,
query
);
/* syntax error */
...
@@ -4463,19 +4469,25 @@ static void test_multi_query()
...
@@ -4463,19 +4469,25 @@ static void test_multi_query()
rc
=
mysql_query
(
mysql
,
query
);
rc
=
mysql_query
(
mysql
,
query
);
myquery
(
rc
);
myquery
(
rc
);
count
=
0
;
count
=
exp_value
=
0
;
while
(
mysql_more_results
(
mysql
)
&&
count
<
sizeof
(
rows
)
/
sizeof
(
uint
))
while
(
mysql_more_results
(
mysql
)
&&
count
<
array_elements
(
rows
))
{
{
fprintf
(
stdout
,
"
\n
query %d
"
,
count
);
fprintf
(
stdout
,
"
\n
Query %d:
"
,
count
);
if
((
rc
=
mysql_next_result
(
mysql
)))
if
((
rc
=
mysql_next_result
(
mysql
)))
fprintf
(
stdout
,
"
\n\t
failed(%s)"
,
mysql_error
(
mysql
));
{
exp_value
=
mysql_errno
(
mysql
);
fprintf
(
stdout
,
"ERROR %d: %s"
,
exp_value
,
mysql_error
(
mysql
));
}
else
else
fprintf
(
stdout
,
"
\n\t
affected rows: %lld"
,
mysql_affected_rows
(
mysql
));
{
if
((
result
=
mysql_store_result
(
mysql
)))
if
((
result
=
mysql_store_result
(
mysql
)))
my_process_result_set
(
result
);
my_process_result_set
(
result
);
if
(
!
rc
)
else
myassert
(
rows
[
count
]
==
(
uint
)
mysql_affected_rows
(
mysql
));
fprintf
(
stdout
,
"OK, %d row(s) affected, %d warning(s)"
,
exp_value
,
count
++
;
mysql_warning_count
(
mysql
));
exp_value
=
(
uint
)
mysql_affected_rows
(
mysql
);
}
myassert
(
rows
[
count
++
]
==
exp_value
);
}
}
mysql
=
org_mysql
;
mysql
=
org_mysql
;
}
}
...
@@ -4932,7 +4944,7 @@ static void test_bind_date_conv(uint row_count)
...
@@ -4932,7 +4944,7 @@ static void test_bind_date_conv(uint row_count)
for
(
i
=
0
;
i
<
array_elements
(
bind
);
i
++
)
for
(
i
=
0
;
i
<
array_elements
(
bind
);
i
++
)
{
{
fprintf
(
stdout
,
"
\n
"
);
fprintf
(
stdout
,
"
\n
"
);
fprintf
(
stdout
,
"time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu"
,
fprintf
(
stdout
,
"
time[%d]: %02d-%02d-%02d %02d:%02d:%02d.%02lu"
,
i
,
tm
[
i
].
year
,
tm
[
i
].
month
,
tm
[
i
].
day
,
i
,
tm
[
i
].
year
,
tm
[
i
].
month
,
tm
[
i
].
day
,
tm
[
i
].
hour
,
tm
[
i
].
minute
,
tm
[
i
].
second
,
tm
[
i
].
hour
,
tm
[
i
].
minute
,
tm
[
i
].
second
,
tm
[
i
].
second_part
);
tm
[
i
].
second_part
);
...
...
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