Date: Sunday, December 18, 2005 @ 20:14:20
Author: zsolt
Path: /cvsroot/carob/libmysequoia
Modified: include/CarobMySQL.hpp (1.14 -> 1.15) src/CarobMySQL.cpp (1.23
-> 1.24)
Modified function free_results to be static. It can be called when no
CarobMYSQL object is available.
Modified also delete_row_data(), delete_query_fields() to be static methods.
------------------------+
include/CarobMySQL.hpp | 6 +++---
src/CarobMySQL.cpp | 28 ++++++++++++++++++++++------
2 files changed, 25 insertions(+), 9 deletions(-)
Index: libmysequoia/include/CarobMySQL.hpp
diff -u libmysequoia/include/CarobMySQL.hpp:1.14
libmysequoia/include/CarobMySQL.hpp:1.15
--- libmysequoia/include/CarobMySQL.hpp:1.14 Thu Dec 15 13:31:25 2005
+++ libmysequoia/include/CarobMySQL.hpp Sun Dec 18 20:14:20 2005
@@ -141,7 +141,7 @@
* Free the stored results
* If res == liveResultPtr will close the query on the server
*/
- void free_results (MYSQL_RES * res);
+ static void free_results (MYSQL_RES * res);
/**
* Return true if there are no more rows to fetch from the result set or
@@ -264,7 +264,7 @@
* Release allocated field structure from the memory
* @param fields a pointer to the field structure
*/
- void delete_query_fields (MYSQL_FIELD * &fields, unsigned int field_count);
+ static void delete_query_fields (MYSQL_FIELD * &fields, unsigned int
field_count);
/**
* Allocates a row from the freshly fetched results
@@ -283,7 +283,7 @@
* @param row a pointer containing the row with data
* @param field_count number of fields in the row
*/
- void delete_row_data (MYSQL_ROW & row, const unsigned int field_count);
+ static void delete_row_data (MYSQL_ROW & row, const unsigned int
field_count);
};
#endif /* _CAROBMYSQL_HPP */
Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.23
libmysequoia/src/CarobMySQL.cpp:1.24
--- libmysequoia/src/CarobMySQL.cpp:1.23 Fri Dec 16 12:07:49 2005
+++ libmysequoia/src/CarobMySQL.cpp Sun Dec 18 20:14:20 2005
@@ -399,11 +399,25 @@
LOG4CXX_DEBUG(logger, "Entering free_results.");
if (res)
{
- if (res == liveResultPtr)
+ MYSQL *mysqlPtr = 0;
+ CarobMYSQL *cm = 0;
+
+ //Check if it is a "live" resultset
+ if (!res->data)
{
- liveResultPtr = 0;
- drsPtr = 0;
- stmtPtr->close();
+ mysqlPtr = res->handle;
+
+ //if it is a CarobMYSQL object, free the results from
there too
+ if (isCarobObject(mysqlPtr))
+ {
+ cm = static_cast<CarobMYSQL *> (mysqlPtr->thd);
+ if (res == cm->liveResultPtr)
+ {
+ cm->liveResultPtr = 0;
+ cm->drsPtr = 0;
+ cm->stmtPtr->close();
+ }
+ }
}
if (res->data)
@@ -424,7 +438,7 @@
delete_row_data(res->current_row,res->field_count);
}
- if (mysqlPtr->fields == res->fields)
+ if (mysqlPtr && mysqlPtr->fields == res->fields)
{
mysqlPtr->fields = 0;
mysqlPtr->field_count = 0;
@@ -433,8 +447,10 @@
delete [] res->lengths;
delete res;
+
+ if (mysqlPtr)
+ mysqlPtr->status = MYSQL_STATUS_READY;
}
- mysqlPtr->status = MYSQL_STATUS_READY;
LOG4CXX_DEBUG(logger, "Leaving free_results.");
}
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits