Upgraded to RS 2010, DOA 4.1, now Access Violation with otClob

Brazzell

Member
Hi,

After upgrading these versions, I am now getting Access Violations when trying to execute a query containing three TLobLocators. This is with an existing program that has worked for a couple of years with Delphi 2006 and DOA 4.0. I am posting the relevant lines below. Any ideas?

Thanks,
Steve

SQL_:=TLobLocator.CreateTemporary(toSession,otCLOB,False);
OBJECT_:=TLobLocator.CreateTemporary(toSession,otCLOB,False);
COLUMN_:=TLobLocator.CreateTemporary(toSession,otCLOB,False);
...
toQuery.SQL.Add(s);

sql_.AsString:=q.sql_statement;
object_.AsString:=q.object_list;
column_.AsString:=q.column_list;

if trim(q.object_list)='' then object_.Clear;
if trim(q.column_list)='' then column_.clear;

toQuery.DeclareVariable('sql_',otCLOB);
toQuery.DeclareVariable('object_',otCLOB);
toQuery.DeclareVariable('column_',otCLOB);

toQuery.SetComplexVariable('sql_',sql_);
toQuery.SetComplexVariable('object_',object_);
toQuery.SetComplexVariable('column_',column_);

try
toQuery.Execute;
except
...

 
Marco,

I isolated just the code in question so I could send you a reproducible version, but this excerpt worked ok. I finally restructured the code to a point that it now works, but I can't justify why it did not work before.

From a pseudo-code standpoint, here is what I had been doing:

Create temporary TLOBLocators
Loop
--Iterations 1 & 2 inserts into unrelated table
--Iteration 3:
----Assign values to TLobLocator variables
----Declare variables
----Set Complex variables
----Insert into table with cLOBs.
----** Access Violation **
Loop End
Free TLobLocators

I moved the creation of the temporary TLOBLocators to just before
the assignment (meaning, after the unrelated records were inserted) and the error went away.

Something was trashing the TLobLocators before they got used, so now I have to create them for every record I insert and free them afterwards for each record.

As I said, the code works flawlessly in Delphi 2006 / DOA 4.0

Thanks,
Steve
 
Back
Top