From: <ibr...@us...> - 2011-02-19 15:08:36
|
Revision: 3893 http://tora.svn.sourceforge.net/tora/?rev=3893&view=rev Author: ibre5041 Date: 2011-02-19 15:08:29 +0000 (Sat, 19 Feb 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/src/tooracleconnection.cpp Modified: branches/tora-trotl/src/tooracleconnection.cpp =================================================================== --- branches/tora-trotl/src/tooracleconnection.cpp 2011-02-19 13:57:32 UTC (rev 3892) +++ branches/tora-trotl/src/tooracleconnection.cpp 2011-02-19 15:08:29 UTC (rev 3893) @@ -212,24 +212,26 @@ { ::trotl::SqlOpenLob clob_open(_data, OCI_LOB_READONLY); QString retval = QString("Datatype: Oracle [N]CLOB\nSize: %1B\n").arg(getLength()); - char buffer[MAXTOMAXLONG]; - ub4 chunk_size = _data.getChunkSize(); + char buffer[524288]; unsigned offset = 0; - + unsigned to_read = 16 * _data.getChunkSize(); + oraub8 bytes_read = 0, chars_read = 0; + while(offset < MAXTOMAXLONG) { - unsigned to_read = MIN(MAXTOMAXLONG - offset, chunk_size); - unsigned bytes_read = _data.read(&buffer[offset], MAXTOMAXLONG - offset, offset+1, to_read); - offset += bytes_read; - if(bytes_read == 0) // end of LOB reached + oraub8 cr = 0, br = 0; + br = _data.read(&buffer[0], sizeof(buffer), offset+1, to_read, &cr); + offset += cr; + chars_read += cr; + bytes_read += br; + if(br == 0) // end of LOB reached break; + retval += QString::fromUtf8(buffer, br); } - buffer[MIN(offset,(unsigned)MAXTOMAXLONG)] = '\0'; - - if(offset == MAXTOMAXLONG) - return QString::fromUtf8(buffer) + "\n...<TRUNCATED>"; - else - return QString::fromUtf8(buffer); + + if(offset != _data.length()) + retval += "\n...<TRUNCATED>"; + return retval; } /* virtual */ QString userData() const throw() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |