TLobLocator.clear => access violation in orageneric10.dll

Zugg

Member²
Hello,

when I call Clear method on a TLobLocator some times it generated an access violation on orageneric10.dll : Violation d'acc
 
Hi Marco,

here is the function code :

Code:
function MyFunction(vObj, vTest: TCouple): TResultat;
var
  LOB11, LOB12, LOB14, lob17: TLobLocator;
  qrySearch, qryList: TOracleQuery;
begin
  qrySearch := TOracleQuery.Create(nil);
  qrySearch.Session := OraSessionEtude2;

  qryList := TOracleQuery.Create(nil);
  qryList.Session := OraSessionEtude2;
  qryList.SQL.Text := <....>;
  qryList.DeclareVariable('vT4_C6', OtInteger);
  qryList.DeclareVariable('vT4_C7', OtInteger);

  try
    qrySearch.SQL.AddStrings(qrySearch_.SQL);
    qrySearch.DeclareAndSet('vT3_C6', OtInteger, vObj.poste);
    qrySearch.DeclareAndSet('vT3_C7', OtInteger, vObj.cle);
    qrySearch.DeclareAndSet('vT3_C8', OtInteger, vTest.Poste);
    qrySearch.DeclareAndSet('vT3_C9', OtInteger, vTest.cle);
    qrySearch.execute;
    if qrySearch.rowcount > 0 then
    begin
      try
        // Retrieve Result informations
	      <....>
        // Retrieve LOB
        LOB11 := qrySearch.LOBField('T3_C11');
        if not LOB11.IsNull then
          Result.item := LOB11.asString;
        LOB12 := qrySearch.LOBField('T3_C12');
        if not LOB12.IsNull then
          Result.donnee := LOB12.asString;

        LOB14 := qrySearch.LOBField('T3_C14');
        if not LOB14.IsNull then
          Result.Question := LOB14.asString;

        LOB17 := qrySearch.LOBField('T3_C17');
        if not LOB17.IsNull then
          Result.Commentaire := LOB17.asString;
        // on recupere les champs + les data
        qryList.SetVariable('vT4_C6', qrySearch.fieldasInteger('T3_C1'));
        qryList.SetVariable('vT4_C7', qrySearch.fieldasInteger('T3_C2'));
        qryList.Execute;
        while not qryList.Eof do
        begin
          // test pour compatibilite avec les anciennes versions
          <...>
          qryList.Next;
        end;
        qryList.Close;
      finally
        // Initialize Result with default value
        <...>
        LOB11.Clear;
        LOB12.Clear;
        LOB14.Clear;
        lob17.Clear;
        qrySearch.Close;
      end;
    end
    else
    begin
      qrySearch.close;
      // Initialize Result with default value
      <...>
    end;
  finally
    qrySearch.Clear;
    FreeAndNil(qrySearch);
    qryList.Clear;
    FreeAndNil(qryList);
  end;
end;
In this code, I have tried to make a LOB.free but it generate a problem too, so I would like to use a LOB.Clear to clean memory data in LOB variable.

I have also made a test with Oracle 10.2.0.3 in Windows Vista and it's the same problem.
 
You should not free, clear, or otherwise modify the TLOBLocator instances returned by the LOBField method. They are managed by the TOracleQuery instance.
 
Thanks Marco,

but another question, why are there no bug with Oracle 9i ?
after migrating to Oracle 10g, I have found this problem but in 9i version, whith LOB.Clear (which you not recommanded) there were no access violation ?

Have you an idea why it doesn't not work (and make access violation) under Oracle 10g ?
 
Back
Top