Dataset disconnected property and clob issue.
Posted: Fri 15 Aug 2014 12:52
It appears that closing a disconnected dataset that contains clobs will give an access violation if the session is closed as well. Here's a simple test case:
Table used by test case:
Console app that should cause the access violation:
Thanks for any help!
-Mark Ford
Benthic Software
Table used by test case:
Code: Select all
CREATE TABLE TEST_CLOB (
ID NUMBER(38) NOT NULL PRIMARY KEY,
CL CLOB);
INSERT INTO TEST_CLOB VALUES (1, LPAD('Z', 4000, 'A'));
COMMIT;Code: Select all
program ODACTest;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
OraCall,
Ora;
var
FOraSession: TOraSession;
FOraQuery: TOraQuery;
i: integer;
begin
FOraSession := TOraSession.Create(nil);
try
FOraSession.ConnectPrompt := False;
FOraSession.Options.UnicodeEnvironment := True;
FOraSession.Options.UseUnicode := True;
FOraSession.ConnectString := 'SCOTT/tiger@myserver';
FOraSession.Connect;
FOraQuery := TOraQuery.Create(nil);
try
FOraQuery.Session := FOraSession;
FOraQuery.ObjectView := True;
FOraQuery.Options.CacheLobs := True;
FOraQuery.FetchAll := True;
FOraQuery.SQL.Text := 'select * from test_clob';
try
FOraQuery.Open;
FOraQuery.Disconnected := True;
FOraSession.Disconnect;
while not FOraQuery.Eof do
begin
WriteLn;
WriteLn;
for i := 0 to FOraQuery.FieldCount - 1 do
WriteLn('Field: ' + FOraQuery.Fields[i].AsString);
WriteLn;
FOraQuery.Next;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
finally
FOraQuery.Close; // AV here, call to TOraLob.IsTemporary with nil OCISvcCtx property
FOraQuery.Free;
end;
WriteLn('Press Enter to Close.');
ReadLn;
finally
FOraSession.Free;
end;
end.-Mark Ford
Benthic Software