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 MySQLAPI.cpp): msg#00077

db.carob.cvs

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

Date: Thursday, February 23, 2006 @ 13:58:31
Author: zsolt
Path: /cvsroot/carob/libmysequoia/src

Modified: CarobMySQL.cpp (1.53 -> 1.54) MySQLAPI.cpp (1.46 -> 1.47)

- implemented mysql_insert_id (a query is sent to the server "select
last_insert_id()" to retrieve the value. It will work, if persistent connection
is on)


----------------+
CarobMySQL.cpp | 6 +++---
MySQLAPI.cpp | 15 +++++++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)


Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.53
libmysequoia/src/CarobMySQL.cpp:1.54
--- libmysequoia/src/CarobMySQL.cpp:1.53 Wed Feb 22 15:23:57 2006
+++ libmysequoia/src/CarobMySQL.cpp Thu Feb 23 13:58:31 2006
@@ -191,8 +191,8 @@
try
{
ConnectionParameters connectionParameters(fromString(host), port,
- fromString(db), fromString(user), fromString(passwd), DEBUG_LEVEL_OFF);
-
+ fromString(db), fromString(user), fromString(passwd), DEBUG_LEVEL_OFF,
DEFAULT_POLICY, DEFAULT_RETRY_INTERVAL, true);
+
Connection *newConnectionPtr;

try {
@@ -205,7 +205,7 @@
if (defaultport && (port == 25322))
{
ConnectionParameters connectionParameters2(fromString(host), 3306,
- fromString(db), fromString(user), fromString(passwd),
DEBUG_LEVEL_OFF);
+ fromString(db), fromString(user), fromString(passwd),
DEBUG_LEVEL_OFF, DEFAULT_POLICY, DEFAULT_RETRY_INTERVAL, true);
newConnectionPtr = new Connection(connectionParameters2);
}
else
Index: libmysequoia/src/MySQLAPI.cpp
diff -u libmysequoia/src/MySQLAPI.cpp:1.46 libmysequoia/src/MySQLAPI.cpp:1.47
--- libmysequoia/src/MySQLAPI.cpp:1.46 Wed Feb 22 15:23:57 2006
+++ libmysequoia/src/MySQLAPI.cpp Thu Feb 23 13:58:30 2006
@@ -741,9 +741,20 @@
{
LOG4CXX_DEBUG(logger, "Entering mysql_insert_id: mysql=" << mysql);

- //TODO implementation
int result = 0;
-
+ //just a simulation for the moment. A query "SELECT last_insert_id()" is
sent to the server
+ //this will work, if persistent connection is used.
+ if (mysql && !mysql_query(mysql,"SELECT last_insert_id()"))
+ {
+ MYSQL_RES *res = mysql_store_result(mysql);
+ MYSQL_ROW row;
+ if (res && (row = mysql_fetch_row(res)) && *row)
+ result = atoi(*row);
+ mysql_free_result(res);
+
+ mysql->insert_id = result;
+ }
+
LOG4CXX_DEBUG(logger, "Leaving mysql_insert_id: result=" << result);
return result;
}


<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