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
a58c324a
Commit
a58c324a
authored
Jun 09, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge kishkin.ru:/home/wax/mysql-4.1 into kishkin.ru:/home/wax/mysql-4g
parents
631558f3
0bb5b9ea
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
204 additions
and
52 deletions
+204
-52
VC++Files/sql/mysqld.dsp
VC++Files/sql/mysqld.dsp
+4
-0
include/mysql_com.h
include/mysql_com.h
+1
-1
include/thr_alarm.h
include/thr_alarm.h
+1
-1
libmysql/libmysql.c
libmysql/libmysql.c
+7
-3
tests/client_test.c
tests/client_test.c
+191
-47
No files found.
VC++Files/sql/mysqld.dsp
View file @
a58c324a
...
@@ -1137,6 +1137,10 @@ SOURCE=.\sql_show.cpp
...
@@ -1137,6 +1137,10 @@ SOURCE=.\sql_show.cpp
# End Source File
# End Source File
# Begin Source File
# Begin Source File
SOURCE=.\sql_state.c
# End Source File
# Begin Source File
SOURCE=.\sql_string.cpp
SOURCE=.\sql_string.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
!IF "$(CFG)" == "mysqld - Win32 Release"
...
...
include/mysql_com.h
View file @
a58c324a
...
@@ -324,7 +324,7 @@ my_bool check_scramble(const char *, const char *message,
...
@@ -324,7 +324,7 @@ my_bool check_scramble(const char *, const char *message,
unsigned
long
*
salt
,
my_bool
old_ver
);
unsigned
long
*
salt
,
my_bool
old_ver
);
char
*
get_tty_password
(
char
*
opt_message
);
char
*
get_tty_password
(
char
*
opt_message
);
void
hash_password
(
unsigned
long
*
result
,
const
char
*
password
);
void
hash_password
(
unsigned
long
*
result
,
const
char
*
password
);
const
char
*
mysql_errno_to_sqlstate
(
uint
mysql_errno
);
const
char
*
mysql_errno_to_sqlstate
(
u
nsigned
int
mysql_errno
);
/* Some other useful functions */
/* Some other useful functions */
...
...
include/thr_alarm.h
View file @
a58c324a
...
@@ -100,7 +100,7 @@ typedef struct st_alarm {
...
@@ -100,7 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
#define thr_alarm_in_use(A) (*(A)!= 0)
void
init_thr_alarm
(
uint
max_alarm
);
void
init_thr_alarm
(
uint
max_alarm
);
my_
bool
thr_alarm
(
thr_alarm_t
*
alarmed
,
uint
sec
,
ALARM
*
buff
);
bool
thr_alarm
(
thr_alarm_t
*
alarmed
,
uint
sec
,
ALARM
*
buff
);
void
thr_alarm_kill
(
pthread_t
thread_id
);
void
thr_alarm_kill
(
pthread_t
thread_id
);
void
thr_end_alarm
(
thr_alarm_t
*
alarmed
);
void
thr_end_alarm
(
thr_alarm_t
*
alarmed
);
void
end_thr_alarm
(
my_bool
free_structures
);
void
end_thr_alarm
(
my_bool
free_structures
);
...
...
libmysql/libmysql.c
View file @
a58c324a
...
@@ -990,7 +990,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
...
@@ -990,7 +990,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
end
=
strmake
(
strmake
(
buff
,
table
,
128
)
+
1
,
wild
?
wild
:
""
,
128
);
end
=
strmake
(
strmake
(
buff
,
table
,
128
)
+
1
,
wild
?
wild
:
""
,
128
);
if
(
simple_command
(
mysql
,
COM_FIELD_LIST
,
buff
,(
ulong
)
(
end
-
buff
),
1
)
||
if
(
simple_command
(
mysql
,
COM_FIELD_LIST
,
buff
,(
ulong
)
(
end
-
buff
),
1
)
||
!
(
query
=
read_rows
(
mysql
,(
MYSQL_FIELD
*
)
0
,
!
(
query
=
read_rows
(
mysql
,(
MYSQL_FIELD
*
)
0
,
protocol_41
(
mysql
)
?
7
:
6
)))
protocol_41
(
mysql
)
?
8
:
6
)))
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
free_old_query
(
mysql
);
free_old_query
(
mysql
);
...
@@ -1027,7 +1027,7 @@ mysql_list_processes(MYSQL *mysql)
...
@@ -1027,7 +1027,7 @@ mysql_list_processes(MYSQL *mysql)
pos
=
(
uchar
*
)
mysql
->
net
.
read_pos
;
pos
=
(
uchar
*
)
mysql
->
net
.
read_pos
;
field_count
=
(
uint
)
net_field_length
(
&
pos
);
field_count
=
(
uint
)
net_field_length
(
&
pos
);
if
(
!
(
fields
=
read_rows
(
mysql
,(
MYSQL_FIELD
*
)
0
,
if
(
!
(
fields
=
read_rows
(
mysql
,(
MYSQL_FIELD
*
)
0
,
protocol_41
(
mysql
)
?
6
:
5
)))
protocol_41
(
mysql
)
?
7
:
5
)))
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
if
(
!
(
mysql
->
fields
=
unpack_fields
(
fields
,
&
mysql
->
field_alloc
,
field_count
,
0
,
if
(
!
(
mysql
->
fields
=
unpack_fields
(
fields
,
&
mysql
->
field_alloc
,
field_count
,
0
,
mysql
->
server_capabilities
)))
mysql
->
server_capabilities
)))
...
@@ -3055,7 +3055,8 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
...
@@ -3055,7 +3055,8 @@ int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
#ifdef CHECK_EXTRA_ARGUMENTS
#ifdef CHECK_EXTRA_ARGUMENTS
if
(
!
bind
||
icol
>=
stmt
->
field_count
)
if
(
!
bind
||
icol
>=
stmt
->
field_count
)
{
{
DBUG_PRINT
(
"error"
,(
"Invalid column position"
));
set_stmt_errmsg
(
stmt
,
"Invalid column descriptor or offset"
,
1
,
unknown_sqlstate
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
#endif
#endif
...
@@ -3377,6 +3378,9 @@ my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt)
...
@@ -3377,6 +3378,9 @@ my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt)
mysql
->
status
=
MYSQL_STATUS_READY
;
mysql
->
status
=
MYSQL_STATUS_READY
;
}
}
mysql_free_result
(
stmt
->
result
);
mysql_free_result
(
stmt
->
result
);
stmt
->
result
=
0
;
stmt
->
result_buffered
=
0
;
stmt
->
current_row
=
0
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
tests/client_test.c
View file @
a58c324a
...
@@ -535,7 +535,7 @@ static void verify_prepare_field(MYSQL_RES *result,
...
@@ -535,7 +535,7 @@ static void verify_prepare_field(MYSQL_RES *result,
unsigned
int
no
,
const
char
*
name
,
const
char
*
org_name
,
unsigned
int
no
,
const
char
*
name
,
const
char
*
org_name
,
enum
enum_field_types
type
,
const
char
*
table
,
enum
enum_field_types
type
,
const
char
*
table
,
const
char
*
org_table
,
const
char
*
db
,
const
char
*
org_table
,
const
char
*
db
,
unsigned
long
length
)
unsigned
long
length
,
const
char
*
def
)
{
{
MYSQL_FIELD
*
field
;
MYSQL_FIELD
*
field
;
...
@@ -554,6 +554,7 @@ static void verify_prepare_field(MYSQL_RES *result,
...
@@ -554,6 +554,7 @@ static void verify_prepare_field(MYSQL_RES *result,
fprintf
(
stdout
,
"
\n
length :`%ld`
\t
(expected: `%ld`)"
,
field
->
length
,
length
);
fprintf
(
stdout
,
"
\n
length :`%ld`
\t
(expected: `%ld`)"
,
field
->
length
,
length
);
fprintf
(
stdout
,
"
\n
maxlength:`%ld`"
,
field
->
max_length
);
fprintf
(
stdout
,
"
\n
maxlength:`%ld`"
,
field
->
max_length
);
fprintf
(
stdout
,
"
\n
charsetnr:`%d`"
,
field
->
charsetnr
);
fprintf
(
stdout
,
"
\n
charsetnr:`%d`"
,
field
->
charsetnr
);
fprintf
(
stdout
,
"
\n
default :`%s`
\t
(expected: `%s`)"
,
field
->
def
?
field
->
def
:
"(null)"
,
def
?
def
:
"(null)"
);
fprintf
(
stdout
,
"
\n
"
);
fprintf
(
stdout
,
"
\n
"
);
myassert
(
strcmp
(
field
->
name
,
name
)
==
0
);
myassert
(
strcmp
(
field
->
name
,
name
)
==
0
);
myassert
(
strcmp
(
field
->
org_name
,
org_name
)
==
0
);
myassert
(
strcmp
(
field
->
org_name
,
org_name
)
==
0
);
...
@@ -562,6 +563,8 @@ static void verify_prepare_field(MYSQL_RES *result,
...
@@ -562,6 +563,8 @@ static void verify_prepare_field(MYSQL_RES *result,
myassert
(
strcmp
(
field
->
org_table
,
org_table
)
==
0
);
myassert
(
strcmp
(
field
->
org_table
,
org_table
)
==
0
);
myassert
(
strcmp
(
field
->
db
,
db
)
==
0
);
myassert
(
strcmp
(
field
->
db
,
db
)
==
0
);
myassert
(
field
->
length
==
length
);
myassert
(
field
->
length
==
length
);
if
(
def
)
myassert
(
strcmp
(
field
->
def
,
def
)
==
0
);
}
}
/*
/*
...
@@ -1021,15 +1024,15 @@ static void test_prepare_field_result()
...
@@ -1021,15 +1024,15 @@ static void test_prepare_field_result()
fprintf
(
stdout
,
"
\n\n
field attributes:
\n
"
);
fprintf
(
stdout
,
"
\n\n
field attributes:
\n
"
);
verify_prepare_field
(
result
,
0
,
"int_c"
,
"int_c"
,
MYSQL_TYPE_LONG
,
verify_prepare_field
(
result
,
0
,
"int_c"
,
"int_c"
,
MYSQL_TYPE_LONG
,
"t1"
,
"test_prepare_field_result"
,
current_db
,
11
);
"t1"
,
"test_prepare_field_result"
,
current_db
,
11
,
0
);
verify_prepare_field
(
result
,
1
,
"var_c"
,
"var_c"
,
MYSQL_TYPE_VAR_STRING
,
verify_prepare_field
(
result
,
1
,
"var_c"
,
"var_c"
,
MYSQL_TYPE_VAR_STRING
,
"t1"
,
"test_prepare_field_result"
,
current_db
,
50
);
"t1"
,
"test_prepare_field_result"
,
current_db
,
50
,
0
);
verify_prepare_field
(
result
,
2
,
"date"
,
"date_c"
,
MYSQL_TYPE_DATE
,
verify_prepare_field
(
result
,
2
,
"date"
,
"date_c"
,
MYSQL_TYPE_DATE
,
"t1"
,
"test_prepare_field_result"
,
current_db
,
10
);
"t1"
,
"test_prepare_field_result"
,
current_db
,
10
,
0
);
verify_prepare_field
(
result
,
3
,
"ts_c"
,
"ts_c"
,
MYSQL_TYPE_TIMESTAMP
,
verify_prepare_field
(
result
,
3
,
"ts_c"
,
"ts_c"
,
MYSQL_TYPE_TIMESTAMP
,
"t1"
,
"test_prepare_field_result"
,
current_db
,
19
);
"t1"
,
"test_prepare_field_result"
,
current_db
,
19
,
0
);
verify_prepare_field
(
result
,
4
,
"char_c"
,
"char_c"
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
4
,
"char_c"
,
"char_c"
,
MYSQL_TYPE_STRING
,
"t1"
,
"test_prepare_field_result"
,
current_db
,
3
);
"t1"
,
"test_prepare_field_result"
,
current_db
,
3
,
0
);
verify_field_count
(
result
,
5
);
verify_field_count
(
result
,
5
);
mysql_free_result
(
result
);
mysql_free_result
(
result
);
...
@@ -5830,7 +5833,7 @@ static void test_field_misc()
...
@@ -5830,7 +5833,7 @@ static void test_field_misc()
"@@autocommit"
,
""
,
/* field and its org name */
"@@autocommit"
,
""
,
/* field and its org name */
MYSQL_TYPE_LONGLONG
,
/* field type */
MYSQL_TYPE_LONGLONG
,
/* field type */
""
,
""
,
/* table and its org name */
""
,
""
,
/* table and its org name */
""
,
1
);
/* db name, length(its bool flag)*/
""
,
1
,
0
);
/* db name, length(its bool flag)*/
mysql_free_result
(
result
);
mysql_free_result
(
result
);
...
@@ -5849,7 +5852,7 @@ static void test_field_misc()
...
@@ -5849,7 +5852,7 @@ static void test_field_misc()
"@@autocommit"
,
""
,
/* field and its org name */
"@@autocommit"
,
""
,
/* field and its org name */
MYSQL_TYPE_LONGLONG
,
/* field type */
MYSQL_TYPE_LONGLONG
,
/* field type */
""
,
""
,
/* table and its org name */
""
,
""
,
/* table and its org name */
""
,
1
);
/* db name, length(its bool flag)*/
""
,
1
,
0
);
/* db name, length(its bool flag)*/
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -5893,7 +5896,7 @@ static void test_field_misc()
...
@@ -5893,7 +5896,7 @@ static void test_field_misc()
"@@table_type"
,
""
,
/* field and its org name */
"@@table_type"
,
""
,
/* field and its org name */
MYSQL_TYPE_STRING
,
/* field type */
MYSQL_TYPE_STRING
,
/* field type */
""
,
""
,
/* table and its org name */
""
,
""
,
/* table and its org name */
""
,
type_length
);
/* db name, length */
""
,
type_length
,
0
);
/* db name, length */
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -5913,7 +5916,7 @@ static void test_field_misc()
...
@@ -5913,7 +5916,7 @@ static void test_field_misc()
"@@max_error_count"
,
""
,
/* field and its org name */
"@@max_error_count"
,
""
,
/* field and its org name */
MYSQL_TYPE_LONGLONG
,
/* field type */
MYSQL_TYPE_LONGLONG
,
/* field type */
""
,
""
,
/* table and its org name */
""
,
""
,
/* table and its org name */
""
,
10
);
/* db name, length */
""
,
10
,
0
);
/* db name, length */
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -5933,7 +5936,7 @@ static void test_field_misc()
...
@@ -5933,7 +5936,7 @@ static void test_field_misc()
"@@max_allowed_packet"
,
""
,
/* field and its org name */
"@@max_allowed_packet"
,
""
,
/* field and its org name */
MYSQL_TYPE_LONGLONG
,
/* field type */
MYSQL_TYPE_LONGLONG
,
/* field type */
""
,
""
,
/* table and its org name */
""
,
""
,
/* table and its org name */
""
,
10
);
/* db name, length */
""
,
10
,
0
);
/* db name, length */
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -5953,7 +5956,7 @@ static void test_field_misc()
...
@@ -5953,7 +5956,7 @@ static void test_field_misc()
"@@sql_warnings"
,
""
,
/* field and its org name */
"@@sql_warnings"
,
""
,
/* field and its org name */
MYSQL_TYPE_LONGLONG
,
/* field type */
MYSQL_TYPE_LONGLONG
,
/* field type */
""
,
""
,
/* table and its org name */
""
,
""
,
/* table and its org name */
""
,
1
);
/* db name, length */
""
,
1
,
0
);
/* db name, length */
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -6340,39 +6343,22 @@ static void test_explain_bug()
...
@@ -6340,39 +6343,22 @@ static void test_explain_bug()
myassert
(
6
==
mysql_num_fields
(
result
));
myassert
(
6
==
mysql_num_fields
(
result
));
verify_prepare_field
(
result
,
0
,
"Field"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
0
,
"Field"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
NAME_LEN
);
""
,
""
,
""
,
NAME_LEN
,
0
);
verify_prepare_field
(
result
,
1
,
"Type"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
1
,
"Type"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
40
);
""
,
""
,
""
,
40
,
0
);
#if 0
verify_prepare_field(result,2,"Collation","",MYSQL_TYPE_STRING,
"","","",40);
verify_prepare_field(result,3,"Null","",MYSQL_TYPE_STRING,
"","","",1);
verify_prepare_field(result,4,"Key","",MYSQL_TYPE_STRING,
"","","",3);
verify_prepare_field(result,5,"Default","",MYSQL_TYPE_STRING,
"","","",NAME_LEN);
verify_prepare_field(result,6,"Extra","",MYSQL_TYPE_STRING,
"","","",20);
#else
verify_prepare_field
(
result
,
2
,
"Null"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
2
,
"Null"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
1
);
""
,
""
,
""
,
1
,
0
);
verify_prepare_field
(
result
,
3
,
"Key"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
3
,
"Key"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
3
);
""
,
""
,
""
,
3
,
0
);
verify_prepare_field
(
result
,
4
,
"Default"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
4
,
"Default"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
NAME_LEN
);
""
,
""
,
""
,
NAME_LEN
,
0
);
verify_prepare_field
(
result
,
5
,
"Extra"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
5
,
"Extra"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
20
);
""
,
""
,
""
,
20
,
0
);
#endif
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -6393,34 +6379,34 @@ static void test_explain_bug()
...
@@ -6393,34 +6379,34 @@ static void test_explain_bug()
myassert
(
10
==
mysql_num_fields
(
result
));
myassert
(
10
==
mysql_num_fields
(
result
));
verify_prepare_field
(
result
,
0
,
"id"
,
""
,
MYSQL_TYPE_LONGLONG
,
verify_prepare_field
(
result
,
0
,
"id"
,
""
,
MYSQL_TYPE_LONGLONG
,
""
,
""
,
""
,
3
);
""
,
""
,
""
,
3
,
0
);
verify_prepare_field
(
result
,
1
,
"select_type"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
1
,
"select_type"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
19
);
""
,
""
,
""
,
19
,
0
);
verify_prepare_field
(
result
,
2
,
"table"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
2
,
"table"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
NAME_LEN
);
""
,
""
,
""
,
NAME_LEN
,
0
);
verify_prepare_field
(
result
,
3
,
"type"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
3
,
"type"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
10
);
""
,
""
,
""
,
10
,
0
);
verify_prepare_field
(
result
,
4
,
"possible_keys"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
4
,
"possible_keys"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
NAME_LEN
*
32
);
""
,
""
,
""
,
NAME_LEN
*
32
,
0
);
verify_prepare_field
(
result
,
5
,
"key"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
5
,
"key"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
NAME_LEN
);
""
,
""
,
""
,
NAME_LEN
,
0
);
verify_prepare_field
(
result
,
6
,
"key_len"
,
""
,
MYSQL_TYPE_LONGLONG
,
verify_prepare_field
(
result
,
6
,
"key_len"
,
""
,
MYSQL_TYPE_LONGLONG
,
""
,
""
,
""
,
3
);
""
,
""
,
""
,
3
,
0
);
verify_prepare_field
(
result
,
7
,
"ref"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
7
,
"ref"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
NAME_LEN
*
16
);
""
,
""
,
""
,
NAME_LEN
*
16
,
0
);
verify_prepare_field
(
result
,
8
,
"rows"
,
""
,
MYSQL_TYPE_LONGLONG
,
verify_prepare_field
(
result
,
8
,
"rows"
,
""
,
MYSQL_TYPE_LONGLONG
,
""
,
""
,
""
,
10
);
""
,
""
,
""
,
10
,
0
);
verify_prepare_field
(
result
,
9
,
"Extra"
,
""
,
MYSQL_TYPE_STRING
,
verify_prepare_field
(
result
,
9
,
"Extra"
,
""
,
MYSQL_TYPE_STRING
,
""
,
""
,
""
,
255
);
""
,
""
,
""
,
255
,
0
);
mysql_free_result
(
result
);
mysql_free_result
(
result
);
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
...
@@ -7053,6 +7039,9 @@ static void test_fetch_column()
...
@@ -7053,6 +7039,9 @@ static void test_fetch_column()
fprintf
(
stdout
,
"
\n
col 0: %d(%ld)"
,
c1
,
l1
);
fprintf
(
stdout
,
"
\n
col 0: %d(%ld)"
,
c1
,
l1
);
myassert
(
c1
==
1
&&
l1
==
4
);
myassert
(
c1
==
1
&&
l1
==
4
);
rc
=
mysql_fetch_column
(
stmt
,
bind
,
10
,
0
);
mystmt_r
(
stmt
,
rc
);
rc
=
mysql_fetch
(
stmt
);
rc
=
mysql_fetch
(
stmt
);
mystmt
(
stmt
,
rc
);
mystmt
(
stmt
,
rc
);
...
@@ -7110,13 +7099,20 @@ static void test_list_fields()
...
@@ -7110,13 +7099,20 @@ static void test_list_fields()
rc
=
mysql_query
(
mysql
,
"drop table if exists test_list_fields"
);
rc
=
mysql_query
(
mysql
,
"drop table if exists test_list_fields"
);
myquery
(
rc
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create table test_list_fields(c1 int primary key auto_increment, c2 char(10))"
);
rc
=
mysql_query
(
mysql
,
"create table test_list_fields(c1 int primary key auto_increment, c2 char(10)
default 'mysql'
)"
);
myquery
(
rc
);
myquery
(
rc
);
result
=
mysql_list_fields
(
mysql
,
"test_list_fields"
,
NULL
);
result
=
mysql_list_fields
(
mysql
,
"test_list_fields"
,
NULL
);
mytest
(
result
);
mytest
(
result
);
myassert
(
0
==
my_process_result_set
(
result
));
myassert
(
0
==
my_process_result_set
(
result
));
verify_prepare_field
(
result
,
0
,
"c1"
,
"c1"
,
MYSQL_TYPE_LONG
,
"test_list_fields"
,
"test_list_fields"
,
current_db
,
11
,
"0"
);
verify_prepare_field
(
result
,
1
,
"c2"
,
"c2"
,
MYSQL_TYPE_STRING
,
"test_list_fields"
,
"test_list_fields"
,
current_db
,
10
,
"mysql"
);
mysql_free_result
(
result
);
mysql_free_result
(
result
);
}
}
...
@@ -7188,6 +7184,149 @@ static void test_mem_overun()
...
@@ -7188,6 +7184,149 @@ static void test_mem_overun()
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
}
}
/*
To test mysql_stmt_free_result()
*/
static
void
test_free_result
()
{
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
1
];
char
c2
[
5
];
ulong
length
;
int
rc
,
c1
;
myheader
(
"test_free_result"
);
rc
=
mysql_query
(
mysql
,
"drop table if exists test_free_result"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create table test_free_result(c1 int primary key auto_increment)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into test_free_result values(),(),()"
);
myquery
(
rc
);
stmt
=
mysql_prepare
(
mysql
,
"select * from test_free_result"
,
50
);
mystmt_init
(
stmt
);
bind
[
0
].
buffer_type
=
MYSQL_TYPE_STRING
;
bind
[
0
].
buffer
=
(
char
*
)
c2
;
bind
[
0
].
buffer_length
=
7
;
bind
[
0
].
is_null
=
0
;
bind
[
0
].
length
=
&
length
;
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_fetch
(
stmt
);
mystmt
(
stmt
,
rc
);
c2
[
0
]
=
'\0'
;
length
=
0
;
rc
=
mysql_fetch_column
(
stmt
,
bind
,
0
,
0
);
mystmt
(
stmt
,
rc
);
fprintf
(
stdout
,
"
\n
col 1: %s(%ld)"
,
c2
,
length
);
myassert
(
strncmp
(
c2
,
"1"
,
1
)
==
0
&&
length
==
1
);
rc
=
mysql_fetch
(
stmt
);
mystmt
(
stmt
,
rc
);
c1
=
0
,
length
=
0
;
bind
[
0
].
buffer_type
=
MYSQL_TYPE_LONG
;
bind
[
0
].
buffer
=
(
char
*
)
&
c1
;
bind
[
0
].
buffer_length
=
0
;
bind
[
0
].
is_null
=
0
;
bind
[
0
].
length
=
&
length
;
rc
=
mysql_fetch_column
(
stmt
,
bind
,
0
,
0
);
mystmt
(
stmt
,
rc
);
fprintf
(
stdout
,
"
\n
col 0: %d(%ld)"
,
c1
,
length
);
myassert
(
c1
==
2
&&
length
==
4
);
rc
=
mysql_query
(
mysql
,
"drop table test_free_result"
);
myquery_r
(
rc
);
/* error should be, COMMANDS OUT OF SYNC */
rc
=
mysql_stmt_free_result
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_query
(
mysql
,
"drop table test_free_result"
);
myquery
(
rc
);
/* should be successful */
mysql_stmt_close
(
stmt
);
}
/*
To test mysql_stmt_free_result()
*/
static
void
test_free_store_result
()
{
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
1
];
char
c2
[
5
];
ulong
length
;
int
rc
,
c1
;
myheader
(
"test_free_store_result"
);
rc
=
mysql_query
(
mysql
,
"drop table if exists test_free_result"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create table test_free_result(c1 int primary key auto_increment)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into test_free_result values(),(),()"
);
myquery
(
rc
);
stmt
=
mysql_prepare
(
mysql
,
"select * from test_free_result"
,
50
);
mystmt_init
(
stmt
);
bind
[
0
].
buffer_type
=
MYSQL_TYPE_STRING
;
bind
[
0
].
buffer
=
(
char
*
)
c2
;
bind
[
0
].
buffer_length
=
7
;
bind
[
0
].
is_null
=
0
;
bind
[
0
].
length
=
&
length
;
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_stmt_store_result
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_fetch
(
stmt
);
mystmt
(
stmt
,
rc
);
c2
[
0
]
=
'\0'
;
length
=
0
;
rc
=
mysql_fetch_column
(
stmt
,
bind
,
0
,
0
);
mystmt
(
stmt
,
rc
);
fprintf
(
stdout
,
"
\n
col 1: %s(%ld)"
,
c2
,
length
);
myassert
(
strncmp
(
c2
,
"1"
,
1
)
==
0
&&
length
==
1
);
rc
=
mysql_fetch
(
stmt
);
mystmt
(
stmt
,
rc
);
c1
=
0
,
length
=
0
;
bind
[
0
].
buffer_type
=
MYSQL_TYPE_LONG
;
bind
[
0
].
buffer
=
(
char
*
)
&
c1
;
bind
[
0
].
buffer_length
=
0
;
bind
[
0
].
is_null
=
0
;
bind
[
0
].
length
=
&
length
;
rc
=
mysql_fetch_column
(
stmt
,
bind
,
0
,
0
);
mystmt
(
stmt
,
rc
);
fprintf
(
stdout
,
"
\n
col 0: %d(%ld)"
,
c1
,
length
);
myassert
(
c1
==
2
&&
length
==
4
);
rc
=
mysql_stmt_free_result
(
stmt
);
mystmt
(
stmt
,
rc
);
rc
=
mysql_query
(
mysql
,
"drop table test_free_result"
);
myquery
(
rc
);
mysql_stmt_close
(
stmt
);
}
/*
/*
Read and parse arguments and MySQL options from my.cnf
Read and parse arguments and MySQL options from my.cnf
*/
*/
...
@@ -7428,6 +7567,11 @@ int main(int argc, char **argv)
...
@@ -7428,6 +7567,11 @@ int main(int argc, char **argv)
test_open_direct
();
/* direct execution in the middle of open stmts */
test_open_direct
();
/* direct execution in the middle of open stmts */
test_fetch_offset
();
/* to test mysql_fetch_column with offset */
test_fetch_offset
();
/* to test mysql_fetch_column with offset */
test_fetch_column
();
/* to test mysql_fetch_column */
test_fetch_column
();
/* to test mysql_fetch_column */
test_mem_overun
();
/* test DBD ovverun bug */
test_list_fields
();
/* test COM_LIST_FIELDS for DEFAULT */
test_free_result
();
/* test mysql_stmt_free_result() */
test_free_store_result
();
/* test to make sure stmt results are cleared
during stmt_free_result() */
end_time
=
time
((
time_t
*
)
0
);
end_time
=
time
((
time_t
*
)
0
);
total_time
+=
difftime
(
end_time
,
start_time
);
total_time
+=
difftime
(
end_time
,
start_time
);
...
...
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