Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of libmysequoia/src (CarobMySQL.cpp): msg#00042

db.carob.cvs

Subject: CVS update of libmysequoia/src (CarobMySQL.cpp)

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>
Google Custom Search

Free Magazines

Cisco News
Receive 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

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo