Print Thread
"List index out of bounds error" while creating TOracleQuery-object
#9499 09/17/07 02:55 PM
Joined: Sep 2007
Posts: 2
The Netherlands
Member
OP Offline
Member
Joined: Sep 2007
Posts: 2
The Netherlands
Sometimes (sorry but I couldn't reproduce this), I'm getting "List index out of bounds (..)" errors while creating the TOracleQuery object.

I'm using D5, DOA 406 and Oracle 10g.

Code
function TBlahBlah.CreateQuery(SQLLines : TStringList; Options : TCreateQueryOptions = [cqoExecute, cqoOptimize]; Session : TOracleSession = nil) : TOracleQuery;
var r: char;
begin
  if Session = nil then
    Session := FDefaultSession;

  try
    r := 'a';
    result := TOracleQuery.Create(Application); // <<-- error
    r := 'b';
    result.Session := Session;

    for i := 0 to SQLLines.Count - 1 do
      result.SQL.Add(SQLLines[i]);

    if cqoExecute in Options then
      result.Execute;

    if FDebug then
      Notify('[TBlahBlah.CreateQuery]: ' + SQLLines.Text);
  except
    ...
    // log error message and value of r
    ...
    raise;
  end;
end;
I wonder whether replacing Application with Nil solves the problem, but I doubt it.

Any ideas?

Thanks in advance!

Re: "List index out of bounds error" while creating TOracleQuery-object
#9500 09/17/07 09:45 PM
Joined: Aug 1999
Posts: 22,216
Member
Offline
Member
Joined: Aug 1999
Posts: 22,216
[quote]I wonder whether replacing Application with Nil solves the problem, but I doubt it.[/quote]Actually, I think it will. I have never used an Application as a component owner though, only forms, datamodules, and nil.


Marco Kalter
Allround Automations
Re: "List index out of bounds error" while creating TOracleQuery-object
#9501 09/18/07 12:35 PM
Joined: Sep 2007
Posts: 2
The Netherlands
Member
OP Offline
Member
Joined: Sep 2007
Posts: 2
The Netherlands
Ah, so it actually does make a difference. We'll just have to try this and see if errors will occur in the future. It's quite odd that the error message only appears every now-and-then. This makes debugging a real pain in the ... (exactly).

Thanks for your advice!

- Andr


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.025s Queries: 13 (0.006s) Memory: 2.5048 MB (Peak: 3.0421 MB) Data Comp: Off Server Time: 2024-05-11 21:55:49 UTC
Valid HTML 5 and Valid CSS