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 carob (3 files): msg#00099

db.carob.cvs

Subject: CVS update of carob (3 files)

Date: Friday, February 24, 2006 @ 18:34:19
Author: gilles
Path: /cvsroot/carob/carob

Modified: include/SQLDataSerialization.hpp (1.12 -> 1.13)
src/DriverResultSet.cpp (1.40 -> 1.41)
src/SQLDataSerialization.cpp (1.26 -> 1.27)

Introduced LargeData serialization type (for byte arrays and blobs)
Fixed byteArrayDeserializer to use this new type and new
DriverSocket::receiveBytes functions. Fixes CAROB-66
Added delete of LargeData type in resultset memory freeing function


----------------------------------+
include/SQLDataSerialization.hpp | 9 +++++++++
src/DriverResultSet.cpp | 13 +++++++++++++
src/SQLDataSerialization.cpp | 15 +++++----------
3 files changed, 27 insertions(+), 10 deletions(-)


Index: carob/include/SQLDataSerialization.hpp
diff -u carob/include/SQLDataSerialization.hpp:1.12
carob/include/SQLDataSerialization.hpp:1.13
--- carob/include/SQLDataSerialization.hpp:1.12 Tue Feb 14 12:05:05 2006
+++ carob/include/SQLDataSerialization.hpp Fri Feb 24 18:34:19 2006
@@ -26,6 +26,8 @@

#include "CarobException.hpp"

+#include "Common.hpp" // for java_byte: cannot forward declare typedefs
+
namespace CarobNS {

class TypeTag;
@@ -85,6 +87,13 @@
int32_t nanos;
} SQLTimeStamp;

+/** Large Data: byte array, blob, clob */
+typedef struct
+{
+ int32_t length; //int32 to reflect java
+ java_byte* data;
+} LargeData;
+
/**
* Defines data type that can be found in ResultSets
*/
Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.40 carob/src/DriverResultSet.cpp:1.41
--- carob/src/DriverResultSet.cpp:1.40 Fri Feb 24 12:43:44 2006
+++ carob/src/DriverResultSet.cpp Fri Feb 24 18:34:19 2006
@@ -85,6 +85,19 @@
}
}
break;
+ case TT_BYTE_ARRAY:
+ case TT_BLOB:
+ case TT_CLOB:
+ for (cnt=0; cnt<data.size(); cnt++)
+ {
+ if (!nulls[cnt][col])
+ {
+ LargeData* ld =
static_cast<LargeData*>((data[cnt][col]).as_other);
+ delete[] ld->data;
+ delete ld;
+ }
+ }
+ break;
}
}
//Now remove data from the vector
Index: carob/src/SQLDataSerialization.cpp
diff -u carob/src/SQLDataSerialization.cpp:1.26
carob/src/SQLDataSerialization.cpp:1.27
--- carob/src/SQLDataSerialization.cpp:1.26 Tue Feb 14 12:05:05 2006
+++ carob/src/SQLDataSerialization.cpp Fri Feb 24 18:34:19 2006
@@ -224,16 +224,11 @@
throw (SocketIOException, UnexpectedException)
{
ResultSetDataType res;
- int baLength = 0;
- input>>baLength;
- uint8_t* byteArrayRead = new uint8_t[baLength];
- int32_t byteRead = 0;
- for (int i=0; i<baLength; i++)
- {
- input>>byteRead;
- byteArrayRead[i] = byteRead&0xFF;
- }
- res.as_other = static_cast<void*>(byteArrayRead);
+ LargeData* ld = new LargeData;
+ input>>ld->length;
+ ld->data = new java_byte[ld->length];
+ input.readBytes(ld->length, ld->data);
+ res.as_other = static_cast<void*>(ld);
return res;
}


<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