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
1d37d5cd
Commit
1d37d5cd
authored
Mar 05, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/kostja/mysql/mysql-4.1-rename
parents
dabfe4e5
7ef1b4df
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
91 deletions
+169
-91
include/mysql.h
include/mysql.h
+43
-21
libmysql/client_settings.h
libmysql/client_settings.h
+1
-1
libmysql/libmysql.c
libmysql/libmysql.c
+93
-54
sql-common/client.c
sql-common/client.c
+1
-1
tests/client_test.c
tests/client_test.c
+31
-14
No files found.
include/mysql.h
View file @
1d37d5cd
...
...
@@ -77,6 +77,8 @@ extern char *mysql_unix_port;
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
#define HAVE_DEPRECATED_411_API 1
typedef
struct
st_mysql_field
{
char
*
name
;
/* Name of column */
char
*
org_name
;
/* Original column name, if an alias */
...
...
@@ -579,40 +581,60 @@ typedef struct st_mysql_methods
#endif
}
MYSQL_METHODS
;
#ifdef HAVE_DEPRECATED_411_API
/* Deprecated calls (since MySQL 4.1.2) */
/* Use mysql_stmt_init + mysql_stmt_prepare instead */
MYSQL_STMT
*
STDCALL
mysql_prepare
(
MYSQL
*
mysql
,
const
char
*
query
,
unsigned
long
length
);
int
STDCALL
mysql_execute
(
MYSQL_STMT
*
stmt
);
unsigned
long
STDCALL
mysql_param_count
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_bind_param
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
bnd
);
my_bool
STDCALL
mysql_bind_result
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
bnd
);
#define mysql_execute mysql_stmt_execute
#define mysql_fetch mysql_stmt_fetch
#define mysql_fetch_column mysql_stmt_fetch_column
#define mysql_bind_param mysql_stmt_bind_param
#define mysql_bind_result mysql_stmt_bind_result
#define mysql_param_count mysql_stmt_param_count
#define mysql_param_result mysql_stmt_param_metadata
#define mysql_get_metadata mysql_stmt_result_metadata
#define mysql_send_long_data mysql_stmt_send_long_data
#endif
/* HAVE_DEPRECATED_411_API */
MYSQL_STMT
*
STDCALL
mysql_stmt_init
(
MYSQL
*
mysql
);
int
STDCALL
mysql_stmt_prepare
(
MYSQL_STMT
*
stmt
,
const
char
*
query
,
unsigned
long
length
);
int
STDCALL
mysql_stmt_execute
(
MYSQL_STMT
*
stmt
);
int
STDCALL
mysql_stmt_fetch
(
MYSQL_STMT
*
stmt
);
int
STDCALL
mysql_stmt_fetch_column
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
bind
,
unsigned
int
column
,
unsigned
long
offset
);
int
STDCALL
mysql_stmt_store_result
(
MYSQL_STMT
*
stmt
);
unsigned
long
STDCALL
mysql_stmt_param_count
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_stmt_bind_param
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
bnd
);
my_bool
STDCALL
mysql_stmt_bind_result
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
bnd
);
my_bool
STDCALL
mysql_stmt_close
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_stmt_reset
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_stmt_free_result
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_stmt_send_long_data
(
MYSQL_STMT
*
stmt
,
unsigned
int
param_number
,
const
char
*
data
,
unsigned
long
length
);
MYSQL_RES
*
STDCALL
mysql_stmt_result_metadata
(
MYSQL_STMT
*
stmt
);
MYSQL_RES
*
STDCALL
mysql_stmt_param_metadata
(
MYSQL_STMT
*
stmt
);
unsigned
int
STDCALL
mysql_stmt_errno
(
MYSQL_STMT
*
stmt
);
const
char
*
STDCALL
mysql_stmt_error
(
MYSQL_STMT
*
stmt
);
const
char
*
STDCALL
mysql_stmt_sqlstate
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_commit
(
MYSQL
*
mysql
);
my_bool
STDCALL
mysql_rollback
(
MYSQL
*
mysql
);
my_bool
STDCALL
mysql_autocommit
(
MYSQL
*
mysql
,
my_bool
auto_mode
);
int
STDCALL
mysql_fetch
(
MYSQL_STMT
*
stmt
);
int
STDCALL
mysql_fetch_column
(
MYSQL_STMT
*
stmt
,
MYSQL_BIND
*
bind
,
unsigned
int
column
,
unsigned
long
offset
);
my_bool
STDCALL
mysql_send_long_data
(
MYSQL_STMT
*
stmt
,
unsigned
int
param_number
,
const
char
*
data
,
unsigned
long
length
);
MYSQL_RES
*
STDCALL
mysql_get_metadata
(
MYSQL_STMT
*
stmt
);
MYSQL_RES
*
STDCALL
mysql_param_result
(
MYSQL_STMT
*
stmt
);
my_ulonglong
STDCALL
mysql_stmt_affected_rows
(
MYSQL_STMT
*
stmt
);
int
STDCALL
mysql_stmt_store_result
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_more_results
(
MYSQL
*
mysql
);
int
STDCALL
mysql_next_result
(
MYSQL
*
mysql
);
MYSQL_ROW_OFFSET
STDCALL
mysql_stmt_row_seek
(
MYSQL_STMT
*
stmt
,
MYSQL_ROW_OFFSET
offset
);
MYSQL_ROW_OFFSET
STDCALL
mysql_stmt_row_tell
(
MYSQL_STMT
*
stmt
);
void
STDCALL
mysql_stmt_data_seek
(
MYSQL_STMT
*
stmt
,
my_ulonglong
offset
);
my_ulonglong
STDCALL
mysql_stmt_num_rows
(
MYSQL_STMT
*
stmt
);
my_ulonglong
STDCALL
mysql_stmt_affected_rows
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_commit
(
MYSQL
*
mysql
);
my_bool
STDCALL
mysql_rollback
(
MYSQL
*
mysql
);
my_bool
STDCALL
mysql_autocommit
(
MYSQL
*
mysql
,
my_bool
auto_mode
);
my_bool
STDCALL
mysql_more_results
(
MYSQL
*
mysql
);
int
STDCALL
mysql_next_result
(
MYSQL
*
mysql
);
void
STDCALL
mysql_close
(
MYSQL
*
sock
);
...
...
libmysql/client_settings.h
View file @
1d37d5cd
...
...
@@ -22,7 +22,7 @@ extern my_string mysql_unix_port;
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION)
sig_handler
pipe_sig_handler
(
int
sig
__attribute__
((
unused
)));
my_bool
stmt_close
(
MYSQL_STMT
*
stmt
,
my_bool
skip_
list
,
my_bool
skip_
free
);
my_bool
stmt_close
(
MYSQL_STMT
*
stmt
,
my_bool
skip_free
);
void
read_user_name
(
char
*
name
);
my_bool
send_file_to_server
(
MYSQL
*
mysql
,
const
char
*
filename
);
...
...
libmysql/libmysql.c
View file @
1d37d5cd
This diff is collapsed.
Click to expand it.
sql-common/client.c
View file @
1d37d5cd
...
...
@@ -2199,7 +2199,7 @@ void STDCALL mysql_close(MYSQL *mysql)
for
(
element
=
mysql
->
stmts
;
element
;
element
=
next_element
)
{
next_element
=
element
->
next
;
stmt_close
((
MYSQL_STMT
*
)
element
->
data
,
0
,
1
);
stmt_close
((
MYSQL_STMT
*
)
element
->
data
,
1
);
}
mysql
->
stmts
=
0
;
}
...
...
tests/client_test.c
View file @
1d37d5cd
...
...
@@ -2963,6 +2963,8 @@ static void test_bind_result_ext()
fprintf
(
stdout
,
"
\n
data (double) : %f"
,
d_data
);
fprintf
(
stdout
,
"
\n
data (str) : %s(%lu)"
,
szData
,
szLength
);
bData
[
bLength
]
=
'\0'
;
/* bData is binary */
fprintf
(
stdout
,
"
\n
data (bin) : %s(%lu)"
,
bData
,
bLength
);
...
...
@@ -3939,6 +3941,7 @@ static void test_prepare_resultset()
result
=
mysql_get_metadata
(
stmt
);
mytest
(
result
);
my_print_result_metadata
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
}
...
...
@@ -4070,18 +4073,18 @@ static void test_stmt_close()
fprintf
(
stdout
,
"
\n
mysql_close_stmt(1) returned: %d"
,
rc
);
assert
(
rc
==
0
);
mysql_close
(
lmysql
);
/* it should free all open stmts(stmt3, 2 and 1) */
/*
Originally we were going to close all statements automatically in
mysql_close(). This proved to not work well - users weren't able to
close statements by hand once mysql_close() had been called.
Now mysql_close() doesn't free any statements, so this test doesn't
serve its original destination any more.
Here we free stmt2 and stmt3 by hande to avoid memory leaks.
*/
mysql_stmt_close
(
stmt2
);
mysql_stmt_close
(
stmt3
);
mysql_close
(
lmysql
);
#if NOT_VALID
rc
=
mysql_stmt_close
(
stmt3
);
fprintf
(
stdout
,
"
\n
mysql_close_stmt(3) returned: %d"
,
rc
);
assert
(
rc
==
1
);
rc
=
mysql_stmt_close
(
stmt2
);
fprintf
(
stdout
,
"
\n
mysql_close_stmt(2) returned: %d"
,
rc
);
assert
(
rc
==
1
);
#endif
count
=
100
;
bind
[
0
].
buffer
=
(
char
*
)
&
count
;
bind
[
0
].
buffer_type
=
MYSQL_TYPE_LONG
;
...
...
@@ -4871,7 +4874,10 @@ DROP TABLE IF EXISTS test_multi_tab";
{
fprintf
(
stdout
,
"
\n
Query %d: "
,
count
);
if
((
result
=
mysql_store_result
(
mysql_local
)))
{
my_process_result_set
(
result
);
mysql_free_result
(
result
);
}
else
fprintf
(
stdout
,
"OK, %lld row(s) affected, %d warning(s)
\n
"
,
mysql_affected_rows
(
mysql_local
),
...
...
@@ -5768,6 +5774,7 @@ static void test_open_direct()
mytest
(
result
);
assert
(
0
==
my_process_result_set
(
result
));
mysql_free_result
(
result
);
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
...
...
@@ -5781,6 +5788,7 @@ static void test_open_direct()
mytest
(
result
);
assert
(
1
==
my_process_result_set
(
result
));
mysql_free_result
(
result
);
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
...
...
@@ -5794,6 +5802,8 @@ static void test_open_direct()
mytest
(
result
);
assert
(
2
==
my_process_result_set
(
result
));
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
/* run a direct query in the middle of a fetch */
...
...
@@ -6446,6 +6456,7 @@ static void test_prepare_grant()
assert
(
4
==
my_stmt_result
(
"SELECT * FROM test_grant"
));
mysql_stmt_close
(
stmt
);
mysql_close
(
lmysql
);
mysql
=
org_mysql
;
...
...
@@ -7552,6 +7563,8 @@ static void test_mem_overun()
rc
=
mysql_fetch
(
stmt
);
assert
(
rc
==
MYSQL_NO_DATA
);
mysql_free_result
(
field_res
);
mysql_stmt_close
(
stmt
);
}
...
...
@@ -7876,6 +7889,7 @@ static void test_ts()
ts
.
hour
=
21
;
ts
.
minute
=
07
;
ts
.
second
=
46
;
ts
.
second_part
=
0
;
length
=
(
long
)(
strmov
(
strts
,
"2003-07-12 21:07:46"
)
-
strts
);
bind
[
0
].
buffer_type
=
MYSQL_TYPE_TIMESTAMP
;
...
...
@@ -7984,6 +7998,8 @@ static void test_bug1500()
bind
[
0
].
buffer
=
(
char
*
)
int_data
;
bind
[
0
].
buffer_type
=
FIELD_TYPE_LONG
;
bind
[
0
].
is_null
=
0
;
bind
[
0
].
length
=
NULL
;
bind
[
0
].
buffer_length
=
0
;
bind
[
2
]
=
bind
[
1
]
=
bind
[
0
];
bind
[
1
].
buffer
=
(
char
*
)(
int_data
+
1
);
bind
[
2
].
buffer
=
(
char
*
)(
int_data
+
2
);
...
...
@@ -8422,9 +8438,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
static
void
get_options
(
int
argc
,
char
**
argv
)
{
int
ho_error
;
load_defaults
(
"my"
,
client_test_load_default_groups
,
&
argc
,
&
argv
);
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
client_test_long_options
,
if
((
ho_error
=
handle_options
(
&
argc
,
&
argv
,
client_test_long_options
,
get_one_option
)))
exit
(
ho_error
);
...
...
@@ -8454,6 +8469,7 @@ static void print_test_output()
*********************************************************/
int
main
(
int
argc
,
char
**
argv
)
{
DEBUGGER_OFF
;
MY_INIT
(
argv
[
0
]);
load_defaults
(
"my"
,
client_test_load_default_groups
,
&
argc
,
&
argv
);
...
...
@@ -8597,6 +8613,7 @@ int main(int argc, char **argv)
client_disconnect
();
/* disconnect from server */
free_defaults
(
defaults_argv
);
print_test_output
();
my_end
(
0
);
return
(
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