25 typedef oracle::occi::Clob
Clob;
41 if (m_writeStmt ==
nullptr) {
42 throw(std::runtime_error(
"Write statement not prepared"));
48 if (m_writeStmt !=
nullptr) {
49 m_conn->terminateStatement(m_writeStmt);
51 std::cout <<
"Warning from IDataItem: statement was aleady closed"<< std::endl;
58 m_readStmt=
m_conn->createStatement();
63 m_readStmt->setPrefetchRowCount(ncount);
68 if (m_readStmt !=
nullptr) {
69 m_conn->terminateStatement(m_readStmt);
71 std::cout <<
"Warning from IDataItem: statement was aleady closed"<< std::endl;
88 std::cout <<
"Populating the Clob using writeBuffer(Stream) method" << std::endl;
101 std::string fname2=
"/nfshome0/ecaldev/francesca/null_file.txt";
111 bufsize = inFile.tellg();
112 std::cout <<
" bufsize ="<<bufsize<< std::endl;
114 inFile.seekg( 0,std::ios::beg );
118 char *
buffer =
new char[bufsize + 1];
123 Stream *strm=clob.getStream();
128 memset (buffer, buf, bufsize + 1);
129 inFile.read(buffer,bufsize);
132 strm->writeBuffer(buffer,strlen(buffer));
139 strm->writeLastBuffer(buffer,size);
140 clob.closeStream(strm);
146 }
catch (SQLException &
e) {
147 throw(std::runtime_error(
"populateClob(): "+e.getMessage()));
150 std::cout <<
"Populating the Clob - Success" << std::endl;
158 Stream *instream = clob.getStream (1,0);
159 unsigned char *
buffer=
new unsigned char[
size];
161 memset (buffer, buf,
size);
163 instream->readBuffer ((
char*)buffer,
size);
164 std::cout <<
"remember to delete the char* at the end of the program ";
170 clob.closeStream (instream);
174 }
catch (SQLException &
e) {
175 throw(std::runtime_error(
"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