Forum > Databases

heaptrc and sqlite

<< < (2/2)

ancamini:
 Thaddy,I am aware that not seeing all the code you may think that the first line is wrong...
but before in Create i wrote..


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---constructor THBConfigDb.Create(dbSnsPathName, dirBck, dbElemName: string);var  strSql: TStringList;begin  inherited Create;  FdirDb := ExtractFileDir(dbSnsPathName) + PathDelim;  FdbName := ExtractFileName(dbSnsPathName);  FdirBck := dirBck + PathDelim;  FdbElem := dbElemName;  Fcnx := nil;  Fquery := nil;  FdbOk := False;   strSql := TStringList.Create;  strSql.Add('create table moduli (id INTEGER PRIMARY KEY AUTOINCREMENT,');  strSql.Add('fam INTEGER, tipo INTEGER, numod INTEGER, etic VARCHAR (30), checked INTEGER,');  strSql.Add('data VARCHAR (255));');  FsqlTabMod := strSql.Text;   strSql.Clear;  strSql.Add('CREATE TABLE componenti (id INTEGER PRIMARY KEY ASC AUTOINCREMENT, idmod INTEGER,');  strSql.Add('fam INTEGER, tipo INTEGER, numod INTEGER, nuitem INTEGER, etic VARCHAR (30),');  strSql.Add('data VARCHAR (255));');  FsqlTabComp := strSql.Text;  FreeAndNil(strSql);end;  
so I am quite sure that the first line can test that it is assigned or not.
In no other place I recreate the connection nor query, but surely there are problems...
And about heaptrc the log do write row number and name of the procedure/function, from here I see where to go to see the source code...
but debugging step by step i don not see any errors...

Zvoni this is the code that terminates connection...same for query

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---rocedure THBConfigDb.resetCnx;begin  try    if Assigned(Fcnx) then      if Fcnx.Connected then Fcnx.Close();    FreeAndNil(Fcnx);  except    Fcnx := nil;  end;end;                            
but I am not sure about the code in the except. As for the Transaction Fcnx is the owner so i assume that it is released by Fcnx.

Carlo



rvk:

--- Quote from: ancamini on October 27, 2022, 09:19:48 pm --- Thaddy,I am aware that not seeing all the code you may think that the first line is wrong...
but before in Create i wrote..

--- End quote ---
Make a small project which reproduces your problem because this is nuts.
We see just half of the code.

There is no problem with heaptrc, TSQLite3Connection and TSQLQuery.
But you have problems in your code.

For example you also don't show the freeing of Fquery.
You also don't show where you call those 'reset' functions (other then when failing to open).

But if you assign Fcnx as the owner you wouldn't even need to free it (Fcnx will do that).

When you are stripping your code to get a smaller repoducable example you will probably stumble on your error in thinking yourself.

ancamini:
RVK I agree with you...just now I am cutting away all the "superfluos" code trying to be as small but effective possible...

Carlo

Navigation

[0] Message Index

[*] Previous page

Go to full version