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 (include/CarobMySQL.hpp src/CarobMySQL.cpp): msg#00150

db.carob.cvs

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

Date: Tuesday, January 24, 2006 @ 15:47:47
Author: csaba
Path: /cvsroot/carob/libmysequoia

Modified: include/CarobMySQL.hpp (1.20 -> 1.21) src/CarobMySQL.cpp (1.32
-> 1.33)

In mysql_real_connect() read the default options from the my.cnf ini file.


------------------------+
include/CarobMySQL.hpp | 5 +++
src/CarobMySQL.cpp | 69 +++++++++++++++++++++++++++++++++++++----------
2 files changed, 60 insertions(+), 14 deletions(-)


Index: libmysequoia/include/CarobMySQL.hpp
diff -u libmysequoia/include/CarobMySQL.hpp:1.20
libmysequoia/include/CarobMySQL.hpp:1.21
--- libmysequoia/include/CarobMySQL.hpp:1.20 Wed Jan 11 11:25:37 2006
+++ libmysequoia/include/CarobMySQL.hpp Tue Jan 24 15:47:47 2006
@@ -266,6 +266,11 @@
* @param field_count number of fields in the row
*/
static void delete_row_data (MYSQL_ROW & row, const unsigned int
field_count);
+
+ /**
+ * Read the MySQL ini file.
+ */
+ void read_ini_file();
};

#endif /* _CAROBMYSQL_HPP */
Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.32
libmysequoia/src/CarobMySQL.cpp:1.33
--- libmysequoia/src/CarobMySQL.cpp:1.32 Thu Jan 19 15:37:21 2006
+++ libmysequoia/src/CarobMySQL.cpp Tue Jan 24 15:47:47 2006
@@ -40,7 +40,7 @@
mysql->field_alloc.block_size = MYSEQUOIA_MAGIC;
mysql->free_me = free_me;
//TODO maybe a real server version string ???
- mysql->server_version = "50015";
+ mysql->server_version = "50018";
mysql->protocol_version = PROTOCOL_VERSION;
// TODO fill in other required mysql fields

@@ -61,7 +61,15 @@
FREE_AND_NULL_ARRAY(mysqlPtr->db);
FREE_AND_NULL_ARRAY(mysqlPtr->host_info);
FREE_AND_NULL_ARRAY(mysqlPtr->info);
-
+
+ FREE_AND_NULL(mysqlPtr->options.my_cnf_file);
+ FREE_AND_NULL(mysqlPtr->options.my_cnf_group);
+ FREE_AND_NULL(mysqlPtr->options.host);
+ FREE_AND_NULL(mysqlPtr->options.user);
+ FREE_AND_NULL(mysqlPtr->options.password);
+ FREE_AND_NULL(mysqlPtr->options.db);
+ mysqlPtr->options.port = 0;
+
mysqlPtr->field_alloc.used = 0;
mysqlPtr->extra_info = 0;

@@ -82,6 +90,13 @@
return false;
}

+ if (mysqlPtr->options.my_cnf_file || mysqlPtr->options.my_cnf_group)
+ {
+ read_ini_file();
+ FREE_AND_NULL(mysqlPtr->options.my_cnf_file);
+ FREE_AND_NULL(mysqlPtr->options.my_cnf_group);
+ }
+
if (unix_socket)
{
set_error(CR_NOT_IMPLEMENTED, SQLT_UNKNOWN);
@@ -92,29 +107,49 @@
/* Must supply at least a user name, or connection to sequoia will fail */
if (!user || !*user)
{
- set_error(CR_NULL_POINTER, SQLT_UNKNOWN);
- LOG4CXX_DEBUG(logger, "Leaving connect.");
- return false;
+ user = mysqlPtr->options.user;
+ if (!user || !*user)
+ {
+ set_error(CR_NULL_POINTER, SQLT_UNKNOWN);
+ LOG4CXX_DEBUG(logger, "Leaving connect.");
+ return false;
+ }
}

if (!host || !*host)
- host = "localhost";
-
+ {
+ host = mysqlPtr->options.host;
+ if (!host || !*host)
+ host = "localhost";
+ }
+
if (!passwd)
- passwd = "";
+ {
+ passwd = mysqlPtr->options.password;
+ if (!passwd)
+ passwd = "";
+ }

if (!port)
- port = 25322;
+ {
+ port = mysqlPtr->options.port;
+ if (!port)
+ port = 25322;
+ }

/* Check for delayed connection. If db name not given, the connection can't
happen, because sequoia doesn't support it.
* The real connection will happen after the user call the command
mysql_select_db or mysql_real_connect */
if (!db || !*db)
{
- delete_connection();
- set_connect_info(host, user, passwd, 0, port);
-
- LOG4CXX_DEBUG(logger, "Leaving connect.");
- return true;
+ db = mysqlPtr->options.db;
+ if (!db || !*db)
+ {
+ delete_connection();
+ set_connect_info(host, user, passwd, 0, port);
+
+ LOG4CXX_DEBUG(logger, "Leaving connect (delayed connection.)");
+ return true;
+ }
}

try
@@ -771,3 +806,9 @@

LOG4CXX_DEBUG(logger, "Leaving delete_row_data.");
}
+
+void
+CarobMYSQL::read_ini_file()
+{
+ // TODO implementation
+}


<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