23 typedef oracle::occi::Clob
Clob;
37 if (m_writeStmt ==
nullptr) {
38 throw(std::runtime_error(
"Write statement not prepared"));
43 if (m_writeStmt !=
nullptr) {
44 m_conn->terminateStatement(m_writeStmt);
46 std::cout <<
"Warning from IDataItem: statement was aleady closed" << std::endl;
55 if (m_readStmt !=
nullptr) {
56 m_conn->terminateStatement(m_readStmt);
58 std::cout <<
"Warning from IDataItem: statement was aleady closed" << std::endl;
70 std::cout <<
"Populating the Clob using writeBuffer(Stream) method" << std::endl;
82 std::string fname2 =
"/nfshome0/ecaldev/francesca/null_file.txt";
87 bufsize = inFile.tellg();
88 std::cout <<
" bufsize =" << bufsize << std::endl;
90 inFile.seekg(0, std::ios::beg);
93 char *
buffer =
new char[bufsize + 1];
97 Stream *strm = clob.getStream();
102 memset(buffer, buf, bufsize + 1);
103 inFile.read(buffer, bufsize);
104 std::cout <<
"we are here2.5" << std::endl;
106 strm->writeBuffer(buffer, strlen(buffer));
107 std::cout <<
"we are here2.6" << std::endl;
110 std::cout <<
"we are here3" << std::endl;
112 size = strlen(buffer);
113 strm->writeLastBuffer(buffer, size);
114 clob.closeStream(strm);
116 std::cout <<
"we are here4" << std::endl;
119 }
catch (SQLException &
e) {
120 throw(std::runtime_error(
std::string(
"populateClob(): ") + e.getMessage()));
123 std::cout <<
"Populating the Clob - Success" << std::endl;
128 Stream *instream = clob.getStream(1, 0);
129 unsigned char *
buffer =
new unsigned char[
size];
131 memset(buffer, buf,
size);
133 instream->readBuffer((
char *)buffer,
size);
134 std::cout <<
"remember to delete the char* at the end of the program ";
139 clob.closeStream(instream);
143 }
catch (SQLException &
e) {
144 throw(std::runtime_error(
std::string(
"readClob(): ") + e.getMessage()));
oracle::occi::Connection * m_conn
oracle::occi::Stream Stream
unsigned char * readClob(Clob &clob, int size) noexcept(false)
void createReadStatement() noexcept(false)
virtual std::string getTable()=0
void terminateWriteStatement() noexcept(false)
void terminateReadStatement() noexcept(false)
void populateClob(Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
void setPrefetchRowCount(int ncount) noexcept(false)
oracle::occi::Statement Statement
void setConfigTag(std::string x)
oracle::occi::SQLException SQLException
std::string getConfigTag()
void checkPrepare() noexcept(false)
virtual void prepareWrite() noexcept(false)=0