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
c56f8288
Commit
c56f8288
authored
Jan 30, 2006
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge neptunus.(none):/home/msvensson/mysql/bug15719/my51-bug15719
into neptunus.(none):/home/msvensson/mysql/mysql-5.1
parents
0f9efc30
163f5da2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
19 deletions
+96
-19
sql-common/client.c
sql-common/client.c
+18
-17
tests/mysql_client_test.c
tests/mysql_client_test.c
+78
-2
No files found.
sql-common/client.c
View file @
c56f8288
...
...
@@ -1456,6 +1456,24 @@ mysql_init(MYSQL *mysql)
mysql
->
options
.
methods_to_use
=
MYSQL_OPT_GUESS_CONNECTION
;
mysql
->
options
.
report_data_truncation
=
TRUE
;
/* default */
/*
By default we don't reconnect because it could silently corrupt data (after
reconnection you potentially lose table locks, user variables, session
variables (transactions but they are specifically dealt with in
mysql_reconnect()).
This is a change: < 5.0.3 mysql->reconnect was set to 1 by default.
How this change impacts existing apps:
- existing apps which relyed on the default will see a behaviour change;
they will have to set reconnect=1 after mysql_real_connect().
- existing apps which explicitely asked for reconnection (the only way they
could do it was by setting mysql.reconnect to 1 after mysql_real_connect())
will not see a behaviour change.
- existing apps which explicitely asked for no reconnection
(mysql.reconnect=0) will not see a behaviour change.
*/
mysql
->
reconnect
=
0
;
return
mysql
;
}
...
...
@@ -1626,23 +1644,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if
(
!
unix_socket
)
unix_socket
=
mysql
->
options
.
unix_socket
;
/*
By default we don't reconnect because it could silently corrupt data (after
reconnection you potentially lose table locks, user variables, session
variables (transactions but they are specifically dealt with in
mysql_reconnect()).
This is a change: < 5.0.3 mysql->reconnect was set to 1 by default.
How this change impacts existing apps:
- existing apps which relyed on the default will see a behaviour change;
they will have to set reconnect=1 after mysql_real_connect().
- existing apps which explicitely asked for reconnection (the only way they
could do it was by setting mysql.reconnect to 1 after mysql_real_connect())
will not see a behaviour change.
- existing apps which explicitely asked for no reconnection
(mysql.reconnect=0) will not see a behaviour change.
*/
mysql
->
reconnect
=
0
;
mysql
->
server_status
=
SERVER_STATUS_AUTOCOMMIT
;
/*
...
...
tests/mysql_client_test.c
View file @
c56f8288
...
...
@@ -14598,7 +14598,6 @@ static void test_bug14845()
static
void
test_bug15510
()
{
MYSQL_STMT
*
stmt
;
MYSQL_RES
*
res
;
int
rc
;
const
char
*
query
=
"select 1 from dual where 1/0"
;
...
...
@@ -14624,6 +14623,81 @@ static void test_bug15510()
myquery
(
rc
);
}
/* Test MYSQL_OPT_RECONNECT, Bug#15719 */
static
void
test_opt_reconnect
()
{
MYSQL
*
lmysql
;
my_bool
my_true
=
TRUE
;
myheader
(
"test_opt_reconnect"
);
if
(
!
(
lmysql
=
mysql_init
(
NULL
)))
{
myerror
(
"mysql_init() failed"
);
exit
(
1
);
}
if
(
!
opt_silent
)
fprintf
(
stdout
,
"reconnect before mysql_options: %d
\n
"
,
lmysql
->
reconnect
);
DIE_UNLESS
(
lmysql
->
reconnect
==
0
);
if
(
mysql_options
(
lmysql
,
MYSQL_OPT_RECONNECT
,
&
my_true
))
{
myerror
(
"mysql_options failed: unknown option MYSQL_OPT_RECONNECT
\n
"
);
exit
(
1
);
}
/* reconnect should be 1 */
if
(
!
opt_silent
)
fprintf
(
stdout
,
"reconnect after mysql_options: %d
\n
"
,
lmysql
->
reconnect
);
DIE_UNLESS
(
lmysql
->
reconnect
==
1
);
if
(
!
(
mysql_real_connect
(
lmysql
,
opt_host
,
opt_user
,
opt_password
,
current_db
,
opt_port
,
opt_unix_socket
,
0
)))
{
myerror
(
"connection failed"
);
exit
(
1
);
}
/* reconnect should still be 1 */
if
(
!
opt_silent
)
fprintf
(
stdout
,
"reconnect after mysql_real_connect: %d
\n
"
,
lmysql
->
reconnect
);
DIE_UNLESS
(
lmysql
->
reconnect
==
1
);
mysql_close
(
lmysql
);
if
(
!
(
lmysql
=
mysql_init
(
NULL
)))
{
myerror
(
"mysql_init() failed"
);
exit
(
1
);
}
if
(
!
opt_silent
)
fprintf
(
stdout
,
"reconnect before mysql_real_connect: %d
\n
"
,
lmysql
->
reconnect
);
DIE_UNLESS
(
lmysql
->
reconnect
==
0
);
if
(
!
(
mysql_real_connect
(
lmysql
,
opt_host
,
opt_user
,
opt_password
,
current_db
,
opt_port
,
opt_unix_socket
,
0
)))
{
myerror
(
"connection failed"
);
exit
(
1
);
}
/* reconnect should still be 0 */
if
(
!
opt_silent
)
fprintf
(
stdout
,
"reconnect after mysql_real_connect: %d
\n
"
,
lmysql
->
reconnect
);
DIE_UNLESS
(
lmysql
->
reconnect
==
0
);
mysql_close
(
lmysql
);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
...
...
@@ -14883,7 +14957,9 @@ static struct my_tests_st my_tests[]= {
{
"test_bug13488"
,
test_bug13488
},
{
"test_bug13524"
,
test_bug13524
},
{
"test_bug14845"
,
test_bug14845
},
{
"test_bug15510"
,
test_bug15510
},
{
"test_bug15510"
,
test_bug15510
},
{
"test_opt_reconnect"
,
test_opt_reconnect
},
{
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