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
93d4055e
Commit
93d4055e
authored
Jan 22, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove bind_length + Fix the client-test
parent
7436e9ec
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
313 additions
and
919 deletions
+313
-919
include/mysql.h
include/mysql.h
+0
-1
libmysql/libmysql.c
libmysql/libmysql.c
+24
-21
tests/client_test.c
tests/client_test.c
+289
-897
No files found.
include/mysql.h
View file @
93d4055e
...
@@ -481,7 +481,6 @@ typedef struct st_mysql_bind
...
@@ -481,7 +481,6 @@ typedef struct st_mysql_bind
unsigned
long
buffer_length
;
/* buffer length */
unsigned
long
buffer_length
;
/* buffer length */
/* The following are for internal use. Set by mysql_bind_param */
/* The following are for internal use. Set by mysql_bind_param */
unsigned
long
bind_length
;
/* Default length of data */
unsigned
int
param_number
;
/* For null count and error messages */
unsigned
int
param_number
;
/* For null count and error messages */
my_bool
long_data_used
;
/* If used with mysql_send_long_data */
my_bool
long_data_used
;
/* If used with mysql_send_long_data */
void
(
*
store_param_func
)(
NET
*
net
,
struct
st_mysql_bind
*
param
);
void
(
*
store_param_func
)(
NET
*
net
,
struct
st_mysql_bind
*
param
);
...
...
libmysql/libmysql.c
View file @
93d4055e
...
@@ -4058,7 +4058,7 @@ static void store_param_double(NET *net, MYSQL_BIND *param)
...
@@ -4058,7 +4058,7 @@ static void store_param_double(NET *net, MYSQL_BIND *param)
static
void
store_param_str
(
NET
*
net
,
MYSQL_BIND
*
param
)
static
void
store_param_str
(
NET
*
net
,
MYSQL_BIND
*
param
)
{
{
ulong
length
=
*
param
->
length
;
ulong
length
=
min
(
*
param
->
length
,
param
->
buffer_length
)
;
char
*
to
=
(
char
*
)
net_store_length
((
char
*
)
net
->
write_pos
,
length
);
char
*
to
=
(
char
*
)
net_store_length
((
char
*
)
net
->
write_pos
,
length
);
memcpy
(
to
,
param
->
buffer
,
length
);
memcpy
(
to
,
param
->
buffer
,
length
);
net
->
write_pos
=
(
uchar
*
)
to
+
length
;
net
->
write_pos
=
(
uchar
*
)
to
+
length
;
...
@@ -4107,7 +4107,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
...
@@ -4107,7 +4107,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
{
{
/*
/*
Param->length should ALWAYS point to the correct length for the type
Param->length should ALWAYS point to the correct length for the type
Either to the length pointer given by the user or param->b
ind
_length
Either to the length pointer given by the user or param->b
uffer
_length
*/
*/
if
((
my_realloc_str
(
net
,
9
+
*
param
->
length
)))
if
((
my_realloc_str
(
net
,
9
+
*
param
->
length
)))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
@@ -4277,12 +4277,14 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
...
@@ -4277,12 +4277,14 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
param
++
)
param
++
)
{
{
param
->
param_number
=
count
++
;
param
->
param_number
=
count
++
;
param
->
long_data_used
=
0
;
/*
/*
If param->length is not given, change it to point to b
ind
_length.
If param->length is not given, change it to point to b
uffer
_length.
This way we can always use *param->length to get the length of data
This way we can always use *param->length to get the length of data
*/
*/
if
(
!
param
->
length
)
if
(
!
param
->
length
)
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
/* If param->is_null is not set, then the value can never be NULL */
/* If param->is_null is not set, then the value can never be NULL */
if
(
!
param
->
is_null
)
if
(
!
param
->
is_null
)
...
@@ -4295,33 +4297,33 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
...
@@ -4295,33 +4297,33 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
break
;
break
;
case
MYSQL_TYPE_TINY
:
case
MYSQL_TYPE_TINY
:
/* Force param->length as this is fixed for this type */
/* Force param->length as this is fixed for this type */
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
param
->
b
ind_length
=
param
->
b
uffer_length
=
1
;
param
->
buffer_length
=
1
;
param
->
store_param_func
=
store_param_tinyint
;
param
->
store_param_func
=
store_param_tinyint
;
break
;
break
;
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_SHORT
:
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
param
->
b
ind_length
=
param
->
b
uffer_length
=
2
;
param
->
buffer_length
=
2
;
param
->
store_param_func
=
store_param_short
;
param
->
store_param_func
=
store_param_short
;
break
;
break
;
case
MYSQL_TYPE_LONG
:
case
MYSQL_TYPE_LONG
:
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
param
->
b
ind_length
=
param
->
b
uffer_length
=
4
;
param
->
buffer_length
=
4
;
param
->
store_param_func
=
store_param_int32
;
param
->
store_param_func
=
store_param_int32
;
break
;
break
;
case
MYSQL_TYPE_LONGLONG
:
case
MYSQL_TYPE_LONGLONG
:
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
param
->
b
ind_length
=
param
->
b
uffer_length
=
8
;
param
->
buffer_length
=
8
;
param
->
store_param_func
=
store_param_int64
;
param
->
store_param_func
=
store_param_int64
;
break
;
break
;
case
MYSQL_TYPE_FLOAT
:
case
MYSQL_TYPE_FLOAT
:
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
param
->
b
ind_length
=
param
->
b
uffer_length
=
4
;
param
->
buffer_length
=
4
;
param
->
store_param_func
=
store_param_float
;
param
->
store_param_func
=
store_param_float
;
break
;
break
;
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_DOUBLE
:
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
param
->
b
ind_length
=
param
->
b
uffer_length
=
8
;
param
->
buffer_length
=
8
;
param
->
store_param_func
=
store_param_double
;
param
->
store_param_func
=
store_param_double
;
break
;
break
;
case
MYSQL_TYPE_TINY_BLOB
:
case
MYSQL_TYPE_TINY_BLOB
:
...
@@ -4330,7 +4332,6 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
...
@@ -4330,7 +4332,6 @@ my_bool STDCALL mysql_bind_param(MYSQL_STMT *stmt, MYSQL_BIND * bind)
case
MYSQL_TYPE_BLOB
:
case
MYSQL_TYPE_BLOB
:
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_STRING
:
param
->
bind_length
=
param
->
buffer_length
;
param
->
store_param_func
=
store_param_str
;
param
->
store_param_func
=
store_param_str
;
break
;
break
;
default:
default:
...
@@ -4586,6 +4587,7 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length)
...
@@ -4586,6 +4587,7 @@ static void send_data_str(MYSQL_BIND *param, char *value, uint length)
}
}
default:
default:
*
param
->
length
=
length
;
*
param
->
length
=
length
;
length
=
min
(
length
,
param
->
buffer_length
);
memcpy
(
buffer
,
value
,
length
);
memcpy
(
buffer
,
value
,
length
);
buffer
[
length
]
=
'\0'
;
buffer
[
length
]
=
'\0'
;
}
}
...
@@ -4804,9 +4806,10 @@ static void fetch_result_double(MYSQL_BIND *param, uchar **row)
...
@@ -4804,9 +4806,10 @@ static void fetch_result_double(MYSQL_BIND *param, uchar **row)
static
void
fetch_result_str
(
MYSQL_BIND
*
param
,
uchar
**
row
)
static
void
fetch_result_str
(
MYSQL_BIND
*
param
,
uchar
**
row
)
{
{
ulong
length
=
net_field_length
(
row
);
ulong
length
=
net_field_length
(
row
);
memcpy
(
param
->
buffer
,
(
char
*
)
*
row
,
length
);
ulong
copy_length
=
min
(
length
,
param
->
buffer_length
);
*
(
param
->
buffer
+
length
)
=
'\0'
;
memcpy
(
param
->
buffer
,
(
char
*
)
*
row
,
copy_length
);
*
param
->
length
=
length
;
*
(
param
->
buffer
+
copy_length
)
=
'\0'
;
*
param
->
length
=
length
;
// return total length
*
row
+=
length
;
*
row
+=
length
;
}
}
...
@@ -4882,7 +4885,7 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
...
@@ -4882,7 +4885,7 @@ my_bool STDCALL mysql_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
if
(
!
param
->
length
)
if
(
!
param
->
length
)
param
->
length
=
&
param
->
b
ind
_length
;
param
->
length
=
&
param
->
b
uffer
_length
;
*
param
->
length
=
(
long
)
get_binary_length
(
param
->
buffer_type
);
*
param
->
length
=
(
long
)
get_binary_length
(
param
->
buffer_type
);
}
}
stmt
->
res_buffers
=
1
;
stmt
->
res_buffers
=
1
;
...
...
tests/client_test.c
View file @
93d4055e
This diff is collapsed.
Click to expand it.
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