Sending Large Objects
With Rogue Wave DB Link, you have only one way of sending LOBs to the database server, namely through the member functions
IldRequest::insertLongText or
IldRequest::insertBinary.
Both member functions actually update an already existing row using the discrimination clause passed in the fifth argument. This argument must contain a valid where clause, reduced to the predicate part —that is, without the where keyword.
Sending Text Data
The member function
IldRequest::insertLongText takes five arguments:
the text data buffer,
the data length,
a table name,
a column name,
a reduced
where clause.
This code extract shows that you must send the column data as a whole.
{
// Prepare the where clause of the update
ostr.seekp(ios::beg);
ostr << " NAME = '" << name << "'" << ends;
// Find out file size
int len = inFile.seekg(0, ios::end).tellg();
char* buff = new char [len + 1];
if (!buff) {
cout << "Memory exhausted: cannot allocate text buffer" << endl;
res = IlFalse;
}
else {
// Read in data
inFile.seekg(0, ios::beg); // Back to beginning of file
inFile.read(buff, len);
// Proper text insertion.
if (!request->insertLongText(buff, len, "USERTABLE",
"VALUE", str))
res = IlFalse;
}
Sending Binary Data
The member function
IldRequest::insertBinary takes four arguments:
An
IldBytes structure holding the data and its length,
A table name,
A column name, and
A reduced
where clause.
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.