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
e18cd2ea
Commit
e18cd2ea
authored
May 15, 2004
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for #3371, #3372, #3374, #3375, #3376
parent
1a2930dc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
27 deletions
+97
-27
libmysql/libmysql.c
libmysql/libmysql.c
+30
-24
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+5
-2
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+58
-0
tests/client_test.c
tests/client_test.c
+3
-0
No files found.
libmysql/libmysql.c
View file @
e18cd2ea
...
...
@@ -3729,28 +3729,6 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
mysql
=
mysql
->
last_used_con
;
if
(
stmt
->
update_max_length
&&
!
stmt
->
bind_result_done
)
{
/*
We must initalize the bind structure to be able to calculate
max_length
*/
MYSQL_BIND
*
bind
,
*
end
;
MYSQL_FIELD
*
field
;
bzero
((
char
*
)
stmt
->
bind
,
sizeof
(
*
stmt
->
bind
)
*
stmt
->
field_count
);
for
(
bind
=
stmt
->
bind
,
end
=
bind
+
stmt
->
field_count
,
field
=
stmt
->
fields
;
bind
<
end
;
bind
++
,
field
++
)
{
bind
->
buffer_type
=
field
->
type
;
bind
->
buffer_length
=
1
;
}
mysql_stmt_bind_result
(
stmt
,
stmt
->
bind
);
stmt
->
bind_result_done
=
0
;
/* No normal bind done */
}
while
((
pkt_len
=
net_safe_read
(
mysql
))
!=
packet_error
)
{
cp
=
net
->
read_pos
;
...
...
@@ -3768,8 +3746,6 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
memcpy
((
char
*
)
cur
->
data
,
(
char
*
)
cp
+
1
,
pkt_len
-
1
);
cur
->
length
=
pkt_len
;
/* To allow us to do sanity checks */
result
->
rows
++
;
if
(
stmt
->
update_max_length
)
stmt_update_metadata
(
stmt
,
cur
);
}
else
{
...
...
@@ -3814,6 +3790,29 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
result
->
rows
=
0
;
stmt
->
data_cursor
=
NULL
;
}
if
(
stmt
->
update_max_length
&&
!
stmt
->
bind_result_done
)
{
/*
We must initalize the bind structure to be able to calculate
max_length
*/
MYSQL_BIND
*
bind
,
*
end
;
MYSQL_FIELD
*
field
;
bzero
((
char
*
)
stmt
->
bind
,
sizeof
(
*
stmt
->
bind
)
*
stmt
->
field_count
);
for
(
bind
=
stmt
->
bind
,
end
=
bind
+
stmt
->
field_count
,
field
=
stmt
->
fields
;
bind
<
end
;
bind
++
,
field
++
)
{
bind
->
buffer_type
=
field
->
type
;
bind
->
buffer_length
=
1
;
}
mysql_stmt_bind_result
(
stmt
,
stmt
->
bind
);
stmt
->
bind_result_done
=
0
;
/* No normal bind done */
}
if
((
*
mysql
->
methods
->
read_binary_rows
)(
stmt
))
{
free_root
(
&
result
->
alloc
,
MYF
(
MY_KEEP_PREALLOC
));
...
...
@@ -3822,6 +3821,13 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN
(
1
);
}
if
(
stmt
->
update_max_length
)
{
MYSQL_ROWS
*
cur
=
result
->
data
;
for
(;
cur
;
cur
=
cur
->
next
)
stmt_update_metadata
(
stmt
,
cur
);
}
stmt
->
data_cursor
=
result
->
data
;
mysql
->
affected_rows
=
stmt
->
affected_rows
=
result
->
rows
;
stmt
->
read_row_func
=
stmt_read_row_buffered
;
...
...
libmysqld/lib_sql.cc
View file @
e18cd2ea
...
...
@@ -197,6 +197,8 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
set_stmt_errmsg
(
stmt
,
net
->
last_error
,
net
->
last_errno
,
net
->
sqlstate
);
DBUG_RETURN
(
1
);
}
stmt
->
affected_rows
=
stmt
->
mysql
->
affected_rows
;
stmt
->
insert_id
=
stmt
->
mysql
->
insert_id
;
DBUG_RETURN
(
0
);
}
...
...
@@ -605,13 +607,14 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
if
(
!
(
res
=
item
->
val_str
(
&
tmp
)))
{
client_field
->
def
=
strdup_root
(
field_alloc
,
""
);
client_field
->
def_length
=
0
;
client_field
->
def
=
strmake_root
(
field_alloc
,
""
,
0
);
}
else
{
client_field
->
def
=
strdup_root
(
field_alloc
,
res
->
ptr
());
client_field
->
def_length
=
res
->
length
();
client_field
->
def
=
strmake_root
(
field_alloc
,
res
->
ptr
(),
client_field
->
def_length
);
}
}
else
...
...
sql/sql_parse.cc
View file @
e18cd2ea
...
...
@@ -1493,7 +1493,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd
->
query_rest
.
length
(
length
);
}
else
thd
->
query_rest
.
copy
(
length
);
thd
->
query_rest
.
copy
(
packet
,
length
,
thd
->
query_rest
.
charset
()
);
break
;
#endif
/*EMBEDDED_LIBRARY*/
}
...
...
sql/sql_prepare.cc
View file @
e18cd2ea
...
...
@@ -309,6 +309,7 @@ void set_param_double(Item_param *param, uchar **pos, ulong len)
*
pos
+=
8
;
}
#ifndef EMBEDDED_LIBRARY
void
set_param_time
(
Item_param
*
param
,
uchar
**
pos
,
ulong
len
)
{
ulong
length
;
...
...
@@ -386,6 +387,62 @@ void set_param_date(Item_param *param, uchar **pos, ulong len)
*
pos
+=
length
;
}
#else
/*!EMBEDDED_LIBRARY*/
void
set_param_time
(
Item_param
*
param
,
uchar
**
pos
,
ulong
len
)
{
TIME
tm
;
MYSQL_TIME
*
to
=
(
MYSQL_TIME
*
)
*
pos
;
tm
.
second_part
=
to
->
second_part
;
tm
.
day
=
to
->
day
;
tm
.
hour
=
to
->
hour
;
tm
.
minute
=
to
->
minute
;
tm
.
second
=
to
->
second
;
tm
.
year
=
tm
.
month
=
0
;
tm
.
neg
=
to
->
neg
;
param
->
set_time
(
&
tm
,
TIMESTAMP_TIME
);
}
void
set_param_datetime
(
Item_param
*
param
,
uchar
**
pos
,
ulong
len
)
{
TIME
tm
;
MYSQL_TIME
*
to
=
(
MYSQL_TIME
*
)
*
pos
;
tm
.
second_part
=
to
->
second_part
;
tm
.
day
=
to
->
day
;
tm
.
hour
=
to
->
hour
;
tm
.
minute
=
to
->
minute
;
tm
.
second
=
to
->
second
;
tm
.
year
=
to
->
year
;
tm
.
month
=
to
->
month
;
tm
.
neg
=
0
;
param
->
set_time
(
&
tm
,
TIMESTAMP_DATETIME
);
}
void
set_param_date
(
Item_param
*
param
,
uchar
**
pos
,
ulong
len
)
{
TIME
tm
;
MYSQL_TIME
*
to
=
(
MYSQL_TIME
*
)
*
pos
;
tm
.
second_part
=
to
->
second_part
;
tm
.
day
=
to
->
day
;
tm
.
year
=
to
->
year
;
tm
.
month
=
to
->
month
;
tm
.
neg
=
0
;
tm
.
hour
=
tm
.
minute
=
tm
.
second
=
0
;
tm
.
second_part
=
0
;
tm
.
neg
=
0
;
param
->
set_time
(
&
tm
,
TIMESTAMP_DATE
);
}
#endif
/*!EMBEDDED_LIBRARY*/
void
set_param_str
(
Item_param
*
param
,
uchar
**
pos
,
ulong
len
)
{
ulong
length
=
get_param_length
(
pos
,
len
);
...
...
@@ -568,6 +625,7 @@ static bool emb_insert_params(Prepared_statement *stmt)
{
Item_param
*
param
=
*
it
;
setup_one_conversion_function
(
param
,
client_param
->
buffer_type
);
param
->
unsigned_flag
=
client_param
->
is_unsigned
;
if
(
!
param
->
long_data_supplied
)
{
if
(
*
client_param
->
is_null
)
...
...
tests/client_test.c
View file @
e18cd2ea
...
...
@@ -9872,7 +9872,10 @@ int main(int argc, char **argv)
test_stiny_bug
();
/* test a simple conv bug from php */
test_field_misc
();
/* check the field info for misc case, bug: #74 */
test_set_option
();
/* test the SET OPTION feature, bug #85 */
/*TODO HF: here should be NO_EMBEDDED_ACCESS_CHECKS*/
#ifndef EMBEDDED_LIBRARY
test_prepare_grant
();
/* to test the GRANT command, bug #89 */
#endif
test_frm_bug
();
/* test the crash when .frm is invalid, bug #93 */
test_explain_bug
();
/* test for the EXPLAIN, bug #115 */
test_decimal_bug
();
/* test for the decimal bug */
...
...
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