Hi Folks!
Is it possible to read the initial say 100 bytes of a CLOB or BLOB? I'm trying to do something along the lines of:
Query.Options.DeferredLobRead := False;
Query.Options.CacheLobs := True;
Query.SQL.Text := 'select myclob from mytable where id = 1';
Query.Execute;
if not Query.EOF then
begin
// read 100 bytes into field's value such that it will
// not read the full information from the server,
// I'd like to cache it in the dataset so it isn't re-read later.
end;
I've tried a few things but so far haven't got it to work. Any suggestions greatly appreciated!
-Mark
Question on partial CLOB read from query field.
You should set the DeferredLobRead option to True and CachLobs to False. Then you can use the code like this:
ODAC does not support caching of partial LOB values. If the CachLobs option is set to True, the whole LOB value is readed and cached.
If the CachLobs option is set to False, ODAC reads data from the database every time when you call the TOraLob.Read method.
Code: Select all
var
Lob: TOraLob;
s: string;
begin
OraQuery.Open;
Lob := OraQuery.GetLob('MYCLOB');
SetLength(s, 100);
Lob.Read(0, 100, @s[1]);
end;If the CachLobs option is set to False, ODAC reads data from the database every time when you call the TOraLob.Read method.