|
|
Choosing A Webhost: |
CVS update of libmysequoia/src (CarobMySQL.cpp MySQLAPI.cpp): msg#00077db.carob.cvs
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> |
|---|---|---|
| Previous by Date: | CVS update of carob (include/DriverSocket.hpp src/DriverSocket.cpp), zsolt-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
|---|---|
| Next by Date: | CVS update of libmysequoia/test-suite/php5 (README), mathieu-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Previous by Thread: | CVS update of libmysequoia/src (CarobMySQL.cpp MySQLAPI.cpp), zsolt-Tt5JLJuBijYiZlD9aYmxOGD2FQJk+8+b |
| Next by Thread: | CVS update of libmysequoia/test (TestMySQLAPI.cpp TestMySQLAPI.hpp), 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.
|