Commit 1cbc904c authored by guilhem@mysql.com's avatar guilhem@mysql.com

Changing the default of libmysqlclient : it's now NO reconnection.

All our programs which use mysql_real_connect() and mysql_connect() are updated accordingly, though I have deliberately
made mysqlimport not reconnect anymore (already true for mysqldump >= 4.1.8).
All Connector devs have been warned about the change I'm doing here - which was agreed with Monty,
and fixes BUG#2555.
parent 2bf9291b
...@@ -91,6 +91,7 @@ main( int argc, char * argv[] ) ...@@ -91,6 +91,7 @@ main( int argc, char * argv[] )
mysql_real_connect( myData, NULL, NULL, NULL, NULL, MYSQL_PORT, mysql_real_connect( myData, NULL, NULL, NULL, NULL, MYSQL_PORT,
NULL, 0 ) ) NULL, 0 ) )
{ {
myData->reconnect= 1;
if ( mysql_select_db( myData, szDB ) < 0 ) { if ( mysql_select_db( myData, szDB ) < 0 ) {
printf( "Can't select the %s database !\n", szDB ) ; printf( "Can't select the %s database !\n", szDB ) ;
mysql_close( myData ) ; mysql_close( myData ) ;
......
...@@ -551,6 +551,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) ...@@ -551,6 +551,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES); PostMessage(WM_COMMAND,IDM_TOOLS_SERVER_PROPERTIES);
return; return;
} }
mysql.reconnect= 1;
if (!(result=mysql_list_processes(&mysql))) if (!(result=mysql_list_processes(&mysql)))
{ {
return; return;
...@@ -576,6 +577,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) ...@@ -576,6 +577,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
); );
return; return;
} }
mysql.reconnect= 1;
if (!(result=mysql_list_dbs(&mysql,0))) if (!(result=mysql_list_dbs(&mysql,0)))
{ {
} }
...@@ -603,6 +605,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) ...@@ -603,6 +605,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
); );
return; return;
} }
mysql.reconnect= 1;
CResourceDatabase* pRes = (CResourceDatabase*) pResource; CResourceDatabase* pRes = (CResourceDatabase*) pResource;
CString strDB = pResource->GetDisplayName(); CString strDB = pResource->GetDisplayName();
strDB.TrimRight(); strDB.TrimRight();
...@@ -641,6 +644,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) ...@@ -641,6 +644,7 @@ void CMySqlManagerView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
); );
return; return;
} }
mysql.reconnect= 1;
HTREEITEM hParent = m_pTree->GetParentItem(hItem); HTREEITEM hParent = m_pTree->GetParentItem(hItem);
memset( &item, 0, sizeof(TV_ITEM) ); memset( &item, 0, sizeof(TV_ITEM) );
item.hItem = hParent; item.hItem = hParent;
...@@ -714,6 +718,7 @@ void CMySqlManagerView::OnRefresh() ...@@ -714,6 +718,7 @@ void CMySqlManagerView::OnRefresh()
{ {
return; return;
} }
mysql.reconnect= 1;
memset( &item, 0, sizeof(TV_ITEM) ); memset( &item, 0, sizeof(TV_ITEM) );
item.hItem = hParent; item.hItem = hParent;
item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ; item.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM ;
......
...@@ -167,6 +167,7 @@ pthread_handler_decl(test_thread,arg) ...@@ -167,6 +167,7 @@ pthread_handler_decl(test_thread,arg)
perror(""); perror("");
goto end; goto end;
} }
mysql.reconnect= 1;
if (mysql_query(&mysql,"select 1") < 0) if (mysql_query(&mysql,"select 1") < 0)
{ {
fprintf(stderr,"Query failed (%s)\n",mysql_error(&mysql)); fprintf(stderr,"Query failed (%s)\n",mysql_error(&mysql));
......
...@@ -1337,6 +1337,7 @@ void __fastcall TForm1::IsMySQLInit(void) ...@@ -1337,6 +1337,7 @@ void __fastcall TForm1::IsMySQLInit(void)
} }
} }
MySQL->reconnect= 1;
} }
...@@ -1348,6 +1349,7 @@ void __fastcall TForm1::IsMySQLInit(void) ...@@ -1348,6 +1349,7 @@ void __fastcall TForm1::IsMySQLInit(void)
MySQL = mysql_init(MySQL); MySQL = mysql_init(MySQL);
if(mysql_real_connect(MySQL,host,user,password , 0, 0, NULL, 0)) if(mysql_real_connect(MySQL,host,user,password , 0, 0, NULL, 0))
IsConnect = true; IsConnect = true;
MySQL->reconnect= 1;
} }
} }
} }
......
...@@ -2792,6 +2792,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, ...@@ -2792,6 +2792,8 @@ sql_real_connect(char *host,char *database,char *user,char *password,
connected=1; connected=1;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens
#else
mysql.reconnect= 1;
#endif #endif
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
build_completion_hash(rehash, 1); build_completion_hash(rehash, 1);
......
...@@ -425,6 +425,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) ...@@ -425,6 +425,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port, if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port,
unix_port, 0)) unix_port, 0))
{ {
mysql->reconnect= 1;
if (info) if (info)
{ {
fputs("\n",stderr); fputs("\n",stderr);
......
...@@ -753,6 +753,7 @@ static MYSQL* safe_connect() ...@@ -753,6 +753,7 @@ static MYSQL* safe_connect()
mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0)) if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
die("failed on connect: %s", mysql_error(local_mysql)); die("failed on connect: %s", mysql_error(local_mysql));
local_mysql->reconnect= 1;
return local_mysql; return local_mysql;
} }
......
...@@ -628,6 +628,7 @@ static int dbConnect(char *host, char *user, char *passwd) ...@@ -628,6 +628,7 @@ static int dbConnect(char *host, char *user, char *passwd)
DBerror(&mysql_connection, "when trying to connect"); DBerror(&mysql_connection, "when trying to connect");
return 1; return 1;
} }
mysql_connection.reconnect= 1;
return 0; return 0;
} /* dbConnect */ } /* dbConnect */
......
...@@ -388,6 +388,7 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd) ...@@ -388,6 +388,7 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd)
ignore_errors=0; /* NO RETURN FROM db_error */ ignore_errors=0; /* NO RETURN FROM db_error */
db_error(&mysql_connection); db_error(&mysql_connection);
} }
mysql_connection.reconnect= 0;
if (verbose) if (verbose)
fprintf(stdout, "Selecting database %s\n", database); fprintf(stdout, "Selecting database %s\n", database);
if (mysql_select_db(sock, database)) if (mysql_select_db(sock, database))
......
...@@ -125,6 +125,7 @@ int main(int argc, char **argv) ...@@ -125,6 +125,7 @@ int main(int argc, char **argv)
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql)); fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
exit(1); exit(1);
} }
mysql.reconnect= 1;
switch (argc) switch (argc)
{ {
......
...@@ -1627,6 +1627,7 @@ int safe_connect(MYSQL* con, const char* host, const char* user, ...@@ -1627,6 +1627,7 @@ int safe_connect(MYSQL* con, const char* host, const char* user,
} }
sleep(CON_RETRY_SLEEP); sleep(CON_RETRY_SLEEP);
} }
con->reconnect= 1; /* TODO: change this to 0 in future versions */
return con_error; return con_error;
} }
......
...@@ -317,6 +317,7 @@ my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, ...@@ -317,6 +317,7 @@ my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
DBUG_ENTER("mysql_master_send_query"); DBUG_ENTER("mysql_master_send_query");
if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0)) if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0))
DBUG_RETURN(1); DBUG_RETURN(1);
master->reconnect= 1;
mysql->last_used_con = master; mysql->last_used_con = master;
DBUG_RETURN(simple_command(master, COM_QUERY, q, length, 1)); DBUG_RETURN(simple_command(master, COM_QUERY, q, length, 1));
} }
...@@ -351,6 +352,7 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, ...@@ -351,6 +352,7 @@ my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0, if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0,
0,0,0,0)) 0,0,0,0))
DBUG_RETURN(1); DBUG_RETURN(1);
slave_to_use->reconnect= 1;
DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, q, length, 1)); DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, q, length, 1));
} }
...@@ -448,6 +450,7 @@ static my_bool get_slaves_from_master(MYSQL* mysql) ...@@ -448,6 +450,7 @@ static my_bool get_slaves_from_master(MYSQL* mysql)
expand_error(mysql, CR_PROBE_MASTER_CONNECT); expand_error(mysql, CR_PROBE_MASTER_CONNECT);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
mysql->reconnect= 1;
if (mysql_query(mysql, "SHOW SLAVE HOSTS") || if (mysql_query(mysql, "SHOW SLAVE HOSTS") ||
!(res = mysql_store_result(mysql))) !(res = mysql_store_result(mysql)))
...@@ -615,6 +618,7 @@ mysql_connect(MYSQL *mysql,const char *host, ...@@ -615,6 +618,7 @@ mysql_connect(MYSQL *mysql,const char *host,
if (mysql->free_me) if (mysql->free_me)
my_free((gptr) mysql,MYF(0)); my_free((gptr) mysql,MYF(0));
} }
mysql->reconnect= 1;
DBUG_RETURN(res); DBUG_RETURN(res);
} }
} }
......
...@@ -109,6 +109,7 @@ bool __fastcall TForm1::connect_server() ...@@ -109,6 +109,7 @@ bool __fastcall TForm1::connect_server()
ret_value = true; ret_value = true;
is_server_started = true; is_server_started = true;
} }
MySQL->reconnect= 1;
return ret_value; return ret_value;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -397,6 +397,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535) ...@@ -397,6 +397,7 @@ NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
ndbout << "Connect failed" <<endl; ndbout << "Connect failed" <<endl;
returnValue = NDBT_FAILED; returnValue = NDBT_FAILED;
} }
mysql.reconnect= 1;
} }
if(returnValue == NDBT_OK){ if(returnValue == NDBT_OK){
mysql_set_server_option(&mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON); mysql_set_server_option(&mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON);
...@@ -712,6 +713,7 @@ static void* flexBenchThread(void* pArg) ...@@ -712,6 +713,7 @@ static void* flexBenchThread(void* pArg)
ndbout << "failed" << endl; ndbout << "failed" << endl;
NdbThread_Exit(0) ; NdbThread_Exit(0) ;
} }
mysql.reconnect= 1;
ndbout << "ok" << endl; ndbout << "ok" << endl;
int r; int r;
......
...@@ -80,6 +80,7 @@ BackupRestore::init() ...@@ -80,6 +80,7 @@ BackupRestore::init()
ndbout_c("Connect failed: %s", mysql_error(&mysql)); ndbout_c("Connect failed: %s", mysql_error(&mysql));
returnValue = false; returnValue = false;
} }
mysql.reconnect= 1;
ndbout << "Connected to MySQL!!!" <<endl; ndbout << "Connected to MySQL!!!" <<endl;
} }
......
...@@ -1587,8 +1587,24 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1587,8 +1587,24 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
port=mysql->options.port; port=mysql->options.port;
if (!unix_socket) if (!unix_socket)
unix_socket=mysql->options.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->reconnect=1; /* Reconnect as default */
mysql->server_status=SERVER_STATUS_AUTOCOMMIT; mysql->server_status=SERVER_STATUS_AUTOCOMMIT;
/* /*
...@@ -2161,6 +2177,7 @@ my_bool mysql_reconnect(MYSQL *mysql) ...@@ -2161,6 +2177,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate); strmov(mysql->net.sqlstate, tmp_mysql.net.sqlstate);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
tmp_mysql.reconnect= 1;
tmp_mysql.free_me= mysql->free_me; tmp_mysql.free_me= mysql->free_me;
/* Don't free options as these are now used in tmp_mysql */ /* Don't free options as these are now used in tmp_mysql */
bzero((char*) &mysql->options,sizeof(mysql->options)); bzero((char*) &mysql->options,sizeof(mysql->options));
......
...@@ -709,6 +709,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi) ...@@ -709,6 +709,7 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, if (!mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0,
mi->port, 0, 0)) mi->port, 0, 0))
DBUG_RETURN(1); DBUG_RETURN(1);
mysql->reconnect= 1;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -4394,6 +4394,7 @@ replication resumed in log '%s' at position %s", mi->user, ...@@ -4394,6 +4394,7 @@ replication resumed in log '%s' at position %s", mi->user,
thd->set_active_vio(mysql->net.vio); thd->set_active_vio(mysql->net.vio);
#endif #endif
} }
mysql->reconnect= 1;
DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed)); DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed));
DBUG_RETURN(slave_was_killed); DBUG_RETURN(slave_was_killed);
} }
......
...@@ -243,6 +243,7 @@ static void client_connect() ...@@ -243,6 +243,7 @@ static void client_connect()
fprintf(stdout, "\n Check the connection options using --help or -?\n"); fprintf(stdout, "\n Check the connection options using --help or -?\n");
exit(1); exit(1);
} }
mysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, " OK"); fprintf(stdout, " OK");
...@@ -1050,6 +1051,7 @@ static my_bool thread_query(char *query) ...@@ -1050,6 +1051,7 @@ static my_bool thread_query(char *query)
error= 1; error= 1;
goto end; goto end;
} }
l_mysql->reconnect= 1;
if (mysql_query(l_mysql, (char *)query)) if (mysql_query(l_mysql, (char *)query))
{ {
fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql)); fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
...@@ -4474,6 +4476,7 @@ static void test_stmt_close() ...@@ -4474,6 +4476,7 @@ static void test_stmt_close()
myerror("connection failed"); myerror("connection failed");
exit(1); exit(1);
} }
lmysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, " OK"); fprintf(stdout, " OK");
...@@ -5365,6 +5368,7 @@ DROP TABLE IF EXISTS test_multi_tab"; ...@@ -5365,6 +5368,7 @@ DROP TABLE IF EXISTS test_multi_tab";
fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local)); fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local));
exit(1); exit(1);
} }
mysql_local->reconnect= 1;
rc= mysql_query(mysql_local, query); rc= mysql_query(mysql_local, query);
myquery(rc); myquery(rc);
...@@ -5473,6 +5477,7 @@ static void test_prepare_multi_statements() ...@@ -5473,6 +5477,7 @@ static void test_prepare_multi_statements()
fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local)); fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local));
exit(1); exit(1);
} }
mysql_local->reconnect= 1;
strmov(query, "select 1; select 'another value'"); strmov(query, "select 1; select 'another value'");
stmt= mysql_simple_prepare(mysql_local, query); stmt= mysql_simple_prepare(mysql_local, query);
check_stmt_r(stmt); check_stmt_r(stmt);
...@@ -7004,6 +7009,7 @@ static void test_prepare_grant() ...@@ -7004,6 +7009,7 @@ static void test_prepare_grant()
mysql_close(lmysql); mysql_close(lmysql);
exit(1); exit(1);
} }
lmysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, " OK"); fprintf(stdout, " OK");
...@@ -7439,6 +7445,7 @@ static void test_drop_temp() ...@@ -7439,6 +7445,7 @@ static void test_drop_temp()
mysql_close(lmysql); mysql_close(lmysql);
exit(1); exit(1);
} }
lmysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, " OK"); fprintf(stdout, " OK");
......
...@@ -46,6 +46,7 @@ int main(int argc, char **argv) ...@@ -46,6 +46,7 @@ int main(int argc, char **argv)
perror(""); perror("");
exit(1); exit(1);
} }
sock->reconnect= 1;
if (mysql_select_db(sock,"test")) if (mysql_select_db(sock,"test"))
{ {
......
...@@ -227,6 +227,7 @@ int main() ...@@ -227,6 +227,7 @@ int main()
!mysql_real_connect(&sel, host, user, pass, db, 0,0,0 ) || !mysql_real_connect(&sel, host, user, pass, db, 0,0,0 ) ||
!mysql_real_connect(&del_ins, host, user, pass, db, 0,0,0 )) !mysql_real_connect(&del_ins, host, user, pass, db, 0,0,0 ))
die("Error in mysql_real_connect(): %s", mysql_error(&lock)); die("Error in mysql_real_connect(): %s", mysql_error(&lock));
lock.reconnect= sel.reconnect= del_ins.reconnect= 1;
permute(order, num_queries); permute(order, num_queries);
printf("count = %d\n", count); printf("count = %d\n", count);
......
...@@ -40,6 +40,7 @@ int main(int argc, char **argv) ...@@ -40,6 +40,7 @@ int main(int argc, char **argv)
perror(""); perror("");
exit(1); exit(1);
} }
mysql.reconnect= 1;
num = atoi(argv[2]); num = atoi(argv[2]);
count = 0; count = 0;
......
...@@ -43,6 +43,7 @@ int main(int argc, char **argv) ...@@ -43,6 +43,7 @@ int main(int argc, char **argv)
perror(""); perror("");
exit(1); exit(1);
} }
mysql.reconnect= 1;
if (mysql_select_db(sock,argv[1]) < 0) if (mysql_select_db(sock,argv[1]) < 0)
{ {
......
...@@ -44,6 +44,7 @@ int main(int argc, char **argv) ...@@ -44,6 +44,7 @@ int main(int argc, char **argv)
perror(""); perror("");
exit(1); exit(1);
} }
mysql.reconnect= 1;
count = 0; count = 0;
num = atoi(argv[2]); num = atoi(argv[2]);
......
...@@ -45,6 +45,7 @@ int main(int argc, char **argv) ...@@ -45,6 +45,7 @@ int main(int argc, char **argv)
perror(""); perror("");
exit(1); exit(1);
} }
mysql.reconnect= 1;
count = 0; count = 0;
num = atoi(argv[2]); num = atoi(argv[2]);
......
...@@ -51,6 +51,7 @@ int main(int argc, char **argv) ...@@ -51,6 +51,7 @@ int main(int argc, char **argv)
perror(""); perror("");
exit(1); exit(1);
} }
mysql.reconnect= 1;
count = 0; count = 0;
num = atoi(argv[2]); num = atoi(argv[2]);
while (count < num) while (count < num)
......
...@@ -55,6 +55,7 @@ unsigned __stdcall test_thread(void *arg __attribute__((unused))) ...@@ -55,6 +55,7 @@ unsigned __stdcall test_thread(void *arg __attribute__((unused)))
perror(""); perror("");
goto end; goto end;
} }
mysql.reconnect= 1;
if (verbose) { putchar('*'); fflush(stdout); } if (verbose) { putchar('*'); fflush(stdout); }
for (count=0 ; count < number_of_tests ; count++) for (count=0 ; count < number_of_tests ; count++)
{ {
......
...@@ -877,7 +877,10 @@ static void manager_exec_connect(struct manager_exec* e) ...@@ -877,7 +877,10 @@ static void manager_exec_connect(struct manager_exec* e)
{ {
if (mysql_real_connect(&e->mysql,e->con_host,e->con_user,e->con_pass,0, if (mysql_real_connect(&e->mysql,e->con_host,e->con_user,e->con_pass,0,
e->con_port,e->con_sock,0)) e->con_port,e->con_sock,0))
{
e->mysql.reconnect= 1;
return; return;
}
sleep(1); sleep(1);
} }
e->error="Could not connect to MySQL server withing the number of tries"; e->error="Could not connect to MySQL server withing the number of tries";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment