|
|
Choosing A Webhost: |
CVS update of libmysequoia/src (CarobMySQL.cpp): msg#00042db.carob.cvs
Date: Monday, February 13, 2006 @ 13:44:23 Author: zsolt Path: /cvsroot/carob/libmysequoia/src Modified: CarobMySQL.cpp (1.47 -> 1.48) - try to guess the default port to connect if no port was given. The strategy is the following: if from the config file the 3306 port was read first try to connect to sequoia hardcoded port (25322) and if this fails then tries the port 3306. ----------------+ CarobMySQL.cpp | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) Index: libmysequoia/src/CarobMySQL.cpp diff -u libmysequoia/src/CarobMySQL.cpp:1.47 libmysequoia/src/CarobMySQL.cpp:1.48 --- libmysequoia/src/CarobMySQL.cpp:1.47 Fri Feb 3 14:30:16 2006 +++ libmysequoia/src/CarobMySQL.cpp Mon Feb 13 13:44:23 2006 @@ -101,6 +101,8 @@ { LOG4CXX_DEBUG(logger, "Entering connect: host=" << host << " user=" << user << " passwd=" << passwd << " db=" << db << " port=" << port); + bool defaultport = port == 0; + if (mysqlPtr->status != MYSQL_STATUS_READY) { set_error(CR_COMMANDS_OUT_OF_SYNC, SQLT_UNKNOWN); @@ -150,7 +152,10 @@ if (!port) { - port = mysqlPtr->options.port; + //check if the cnf file contains the hardcoded mysql port (3306) + //if so, then first try to connect to the default sequoia port (25322) + //and if is unsuccessful, then to the 3306 port. + port = mysqlPtr->options.port == 3306 ? 25322 : mysqlPtr->options.port; if (!port) port = 25322; } @@ -179,7 +184,25 @@ ConnectionParameters connectionParameters(fromString(host), port, fromString(db), fromString(user), fromString(passwd), DEBUG_LEVEL_DEBUG); - Connection *newConnectionPtr = new Connection(connectionParameters); + Connection *newConnectionPtr; + + try { + newConnectionPtr = new Connection(connectionParameters); + } + catch (CarobException &e) + { + //if the default port was given and the connection to port 25322 + //failed we try the 3306 port + if (defaultport && (port == 25322)) + { + ConnectionParameters connectionParameters2(fromString(host), 3306, + fromString(db), fromString(user), fromString(passwd), DEBUG_LEVEL_DEBUG); + newConnectionPtr = new Connection(connectionParameters2); + } + else + throw; + } + if (newConnectionPtr) { //TODO handle not enough memory @@ -307,8 +330,10 @@ if (mysqlPtr->status != MYSQL_STATUS_GET_RESULT) { - set_error(CR_COMMANDS_OUT_OF_SYNC, SQLT_UNKNOWN); - LOG4CXX_DEBUG(logger, "Leaving get_results: result=0"); + //If the status is not get_result we don't throw cr_commands_out_of_sync + //this is required by PHP5 +/* set_error(CR_COMMANDS_OUT_OF_SYNC, SQLT_UNKNOWN); + LOG4CXX_DEBUG(logger, "Leaving get_results: result=0");*/ return 0; }
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS update of libmysequoia (3 files), csaba-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of libmysequoia/src (CarobStmt.cpp), zsolt-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of libmysequoia/src (CarobMySQL.cpp), zsolt-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of libmysequoia/src (CarobMySQL.cpp), zsolt-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home
| advertise | OSDir is
an inevitable website.
|