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
113c0dc0
Commit
113c0dc0
authored
Dec 17, 2004
by
heikki@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge heikki@bk-internal.mysql.com:/home/bk/mysql-5.0
into hundin.mysql.fi:/home/heikki/mysql-5.0
parents
dda8c10f
7055fc51
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
5 deletions
+67
-5
include/mysql.h
include/mysql.h
+4
-1
libmysql/libmysql.c
libmysql/libmysql.c
+4
-4
sql-common/client.c
sql-common/client.c
+8
-0
tests/client_test.c
tests/client_test.c
+51
-0
No files found.
include/mysql.h
View file @
113c0dc0
...
...
@@ -145,7 +145,8 @@ enum mysql_option
MYSQL_OPT_PROTOCOL
,
MYSQL_SHARED_MEMORY_BASE_NAME
,
MYSQL_OPT_READ_TIMEOUT
,
MYSQL_OPT_WRITE_TIMEOUT
,
MYSQL_OPT_USE_RESULT
,
MYSQL_OPT_USE_REMOTE_CONNECTION
,
MYSQL_OPT_USE_EMBEDDED_CONNECTION
,
MYSQL_OPT_GUESS_CONNECTION
,
MYSQL_SET_CLIENT_IP
,
MYSQL_SECURE_AUTH
MYSQL_OPT_GUESS_CONNECTION
,
MYSQL_SET_CLIENT_IP
,
MYSQL_SECURE_AUTH
,
MYSQL_REPORT_DATA_TRUNCATION
};
struct
st_mysql_options
{
...
...
@@ -186,6 +187,8 @@ struct st_mysql_options {
char
*
client_ip
;
/* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */
my_bool
secure_auth
;
/* 0 - never report, 1 - always report (default) */
my_bool
report_data_truncation
;
/* function pointers for local infile support */
int
(
*
local_infile_init
)(
void
**
,
const
char
*
,
void
*
);
...
...
libmysql/libmysql.c
View file @
113c0dc0
...
...
@@ -4342,7 +4342,6 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
MYSQL_FIELD
*
field
;
ulong
bind_count
=
stmt
->
field_count
;
uint
param_count
=
0
;
uchar
report_data_truncation
=
0
;
DBUG_ENTER
(
"mysql_stmt_bind_result"
);
DBUG_PRINT
(
"enter"
,(
"field_count: %d"
,
bind_count
));
...
...
@@ -4380,8 +4379,6 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
if
(
!
param
->
error
)
param
->
error
=
&
param
->
error_value
;
else
report_data_truncation
=
REPORT_DATA_TRUNCATION
;
param
->
param_number
=
param_count
++
;
param
->
offset
=
0
;
...
...
@@ -4395,7 +4392,10 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
DBUG_RETURN
(
1
);
}
}
stmt
->
bind_result_done
=
BIND_RESULT_DONE
|
report_data_truncation
;
stmt
->
bind_result_done
=
BIND_RESULT_DONE
;
if
(
stmt
->
mysql
->
options
.
report_data_truncation
)
stmt
->
bind_result_done
|=
REPORT_DATA_TRUNCATION
;
DBUG_RETURN
(
0
);
}
...
...
sql-common/client.c
View file @
113c0dc0
...
...
@@ -874,6 +874,7 @@ static const char *default_options[]=
"replication-probe"
,
"enable-reads-from-master"
,
"repl-parse-query"
,
"ssl-cipher"
,
"max-allowed-packet"
,
"protocol"
,
"shared-memory-base-name"
,
"multi-results"
,
"multi-queries"
,
"secure-auth"
,
"report-data-truncation"
,
NullS
};
...
...
@@ -1084,6 +1085,9 @@ void mysql_read_default_options(struct st_mysql_options *options,
case
32
:
/* secure-auth */
options
->
secure_auth
=
TRUE
;
break
;
case
33
:
/* report-data-truncation */
options
->
report_data_truncation
=
opt_arg
?
test
(
atoi
(
opt_arg
))
:
1
;
break
;
default:
DBUG_PRINT
(
"warning"
,(
"unknown option: %s"
,
option
[
0
]));
}
...
...
@@ -1427,6 +1431,7 @@ mysql_init(MYSQL *mysql)
#endif
mysql
->
options
.
methods_to_use
=
MYSQL_OPT_GUESS_CONNECTION
;
mysql
->
options
.
report_data_truncation
=
TRUE
;
/* default */
return
mysql
;
}
...
...
@@ -2666,6 +2671,9 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
case
MYSQL_SECURE_AUTH
:
mysql
->
options
.
secure_auth
=
*
(
my_bool
*
)
arg
;
break
;
case
MYSQL_REPORT_DATA_TRUNCATION
:
mysql
->
options
.
report_data_truncation
=
test
(
*
(
my_bool
*
)
arg
);
break
;
default:
DBUG_RETURN
(
1
);
}
...
...
tests/client_test.c
View file @
113c0dc0
...
...
@@ -12302,6 +12302,56 @@ static void test_truncation()
myquery
(
rc
);
}
static
void
test_truncation_option
()
{
MYSQL_STMT
*
stmt
;
const
char
*
stmt_text
;
int
rc
;
uint8
buf
;
my_bool
option
=
0
;
my_bool
error
;
MYSQL_BIND
bind
;
myheader
(
"test_truncation_option"
);
/* Prepare the test table */
stmt_text
=
"select -1"
;
stmt
=
mysql_stmt_init
(
mysql
);
rc
=
mysql_stmt_prepare
(
stmt
,
stmt_text
,
strlen
(
stmt_text
));
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
bzero
(
&
bind
,
sizeof
(
MYSQL_BIND
));
bind
.
buffer
=
(
void
*
)
&
buf
;
bind
.
buffer_type
=
MYSQL_TYPE_TINY
;
bind
.
is_unsigned
=
TRUE
;
bind
.
error
=
&
error
;
rc
=
mysql_stmt_bind_result
(
stmt
,
&
bind
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_fetch
(
stmt
);
DIE_UNLESS
(
rc
==
MYSQL_DATA_TRUNCATED
);
DIE_UNLESS
(
error
);
rc
=
mysql_options
(
mysql
,
MYSQL_REPORT_DATA_TRUNCATION
,
(
char
*
)
&
option
);
myquery
(
rc
);
/* need to rebind for the new setting to take effect */
rc
=
mysql_stmt_bind_result
(
stmt
,
&
bind
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_fetch
(
stmt
);
check_execute
(
stmt
,
rc
);
/* The only change is rc - error pointers are still filled in */
DIE_UNLESS
(
error
==
1
);
/* restore back the defaults */
option
=
1
;
mysql_options
(
mysql
,
MYSQL_REPORT_DATA_TRUNCATION
,
(
char
*
)
&
option
);
mysql_stmt_close
(
stmt
);
}
/*
Read and parse arguments and MySQL options from my.cnf
...
...
@@ -12517,6 +12567,7 @@ static struct my_tests_st my_tests[]= {
{
"test_basic_cursors"
,
test_basic_cursors
},
{
"test_cursors_with_union"
,
test_cursors_with_union
},
{
"test_truncation"
,
test_truncation
},
{
"test_truncation_option"
,
test_truncation_option
},
{
0
,
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