25 typedef oracle::occi::Clob
Clob;
40 throw(std::runtime_error)
43 throw(std::runtime_error(
"Write statement not prepared"));
48 throw(std::runtime_error)
53 std::cout <<
"Warning from IDataItem: statement was aleady closed"<< std::endl;
59 throw(std::runtime_error)
65 throw(std::runtime_error)
71 throw(std::runtime_error)
76 std::cout <<
"Warning from IDataItem: statement was aleady closed"<< std::endl;
89 throw (std::runtime_error)
94 std::cout <<
"Populating the Clob using writeBuffer(Stream) method" << std::endl;
97 char *
file = (
char *)fname.c_str();
98 std::cout<<
"we are here0.5 file is:"<<fname<<std::endl;
100 std::ifstream inFile;
104 std::cout << fname <<
" file not found\n";
107 std::string fname2=
"/nfshome0/ecaldev/francesca/null_file.txt";
117 bufsize = inFile.tellg();
118 std::cout <<
" bufsize ="<<bufsize<< std::endl;
120 inFile.seekg( 0,std::ios::beg );
124 char *buffer =
new char[bufsize + 1];
129 Stream *strm=clob.getStream();
134 memset (buffer, buf, bufsize + 1);
135 inFile.read(buffer,bufsize);
138 strm->writeBuffer(buffer,strlen(buffer));
145 strm->writeLastBuffer(buffer,size);
146 clob.closeStream(strm);
153 throw(std::runtime_error(
"populateClob(): "+e.getMessage()));
156 std::cout <<
"Populating the Clob - Success" << std::endl;
161 throw (std::runtime_error)
165 Stream *instream = clob.getStream (1,0);
166 unsigned char *buffer=
new unsigned char[
size];
168 memset (buffer, buf,
size);
170 instream->readBuffer ((
char*)buffer,
size);
171 std::cout <<
"remember to delete the char* at the end of the program ";
177 clob.closeStream (instream);
182 throw(std::runtime_error(
"readClob(): "+e.getMessage()));
void populateClob(Clob &clob, std::string fname, unsigned int bufsize)
oracle::occi::Connection * m_conn
oracle::occi::Stream Stream
virtual void prepareWrite()=0
unsigned char * readClob(Clob &clob, int size)
virtual std::string getTable()=0
void terminateReadStatement()
void terminateWriteStatement()
oracle::occi::SQLException SQLException
void createReadStatement()
oracle::occi::Statement Statement
void setConfigTag(std::string x)
oracle::occi::SQLException SQLException
void setPrefetchRowCount(int ncount)
std::string getConfigTag()
tuple size
Write out results.