Hi,
i want to store a binary file with 6587919 byte into a table, but I get the
following exception: ORA-22920: row containing the LOB value is not locked.
My code is:
try
{
session sql(backEnd, connectString);
idx = 5;
std::ifstream is(inputfilename.c_str(), std::ifstream::binary);
if (is)
{
// get length of file:
is.seekg (0, is.end);
int length = is.tellg();
is.seekg (0, is.beg);
char * buffer = new char [length];
std::cout << "Reading " << length << " characters... ";
// read data as a block:
is.read (buffer,length);
if (is)
std::cout << "all characters read successfully.\n";
else
std::cout << "error: only " << is.gcount() << "
could be read\n";
is.close();
sql << "insert into soci_blob (id, img) values (:id,
empty_blob())", use(idx);
blob b(sql);
oracle_session_backend *sessionBackEnd =
static_cast<oracle_session_backend *>(sql.get_backend());
oracle_blob_backend *blobBackEnd =
static_cast<oracle_blob_backend *>(b.get_backend());
OCILobDisableBuffering(sessionBackEnd->svchp_,
sessionBackEnd->errhp_, blobBackEnd->lobp_);
sql << "select img from soci_blob where id = :id",
use(idx), into(b);
assert(b.get_len() == 0);
// note: blob offsets start from 1
b.write(1, buffer, sizeof(buffer));
sql << "update soci_blob set length = :length where id =
:id", use(length), use(idx);
// append does not work (Oracle bug #886191 ?)
//b.append(buf, sizeof(buf));
//assert(b.get_len() == sizeof(buf) + 10);
sql.commit();
std::cout << "all characters saved successfully.\n";
delete[] buffer;
}
}
catch (oracle_soci_error const & e)
{
std::cerr << "Oracle error: " << e.err_num_ << " " << e.what() <<
std::endl;
}
I have the following question:
How and where I can look the row?
Mit freundlichem Gruß
Ulrich Heinicke
--
______________________________________________
DAVID Software GmbH - Wendenring 1 - 38114 Braunschweig
Tel.: +49 531 24379-73
Fax.: +49 531 24379-79
E-Mail: mailto:[email protected]
WWW: http://www.david-software.de
Eintragung: Amtsgericht Braunschweig, HRB 3167
Geschäftsführer: Frank Ptok
______________________________________________
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users