Forum > Databases
SQLite:Unexpected Column Not Found After Upgrading To Lazarus 3.4
(1/1)
Wilko500:
Background
I have a working program to migrate MS Access database data to SQLite that has been ok for many months. A change was required to the SQLite data structure so I re-ran the "working" program but had problems with the following line but only on the second call to the function.
--- 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";}};} --- iRes:= dbQuery.FieldByName(strKey).AsString; //This failing for ColUnits The SQL for the query was correct, copied from ShowMessage and run in the database browser, producing the expected output. After several hours of frustrated head scratching I hard coded a fix to jump over this troublesome piece of code.
Next I started getting Operation cannot be performed on active dataset. Searching the forum I found this from BigChimp, 2012
--- Quote --- QDetail.Close;
QDetail.SQL.Text:=Format(AdresLatest, [inttostr(NameID)]);
QDetail.Open;
--- End quote ---
and this from Knipfty on the same post
--- Quote ---I've found that anytime you change the SQL Text property, the dataset needs to be closed. The IDE does this automatically and forces you to set active to true to see the result. It doesn't surprise me that you need to do this programically as well.
--- End quote ---
Putting .close in before each of my SQL.Text statements fixed all my problems. It seems to me that there has been some kind of change within the IDE and possible the version of FPC I was using (maybe Laz-FPC 3.3.1-3.9.9 not certain of the version) and the Laz-FPC 3.4-3.2.2 I use currently.
Are internal changes such as these documented and if so where?
Huge thanks to both BigChimp and Knipfty
Khrys:
--- Quote from: Wilko500 on July 03, 2024, 06:18:31 pm ---Are internal changes such as these documented and if so where?
--- End quote ---
You can always look through the commit history of the compiler source tree on GitLab; or more specifically, that of the fcl-db package which contains the database units.
af0815:
--- Quote from: Wilko500 on July 03, 2024, 06:18:31 pm ---Putting .close in before each of my SQL.Text statements fixed all my problems.
--- End quote ---
To close the Query before i change a statement (or add) was normal for ages for me (exactly since my Delphi 7 times). Maybe it was accepted by accident sometimes, so it was no internal change - more a bugfix :-)
Navigation
[0] Message Index