Recent

Author Topic: [SOLVED] SQLite raised exception class 'External: SIGSEGV'  (Read 4652 times)

dodgebros

  • Full Member
  • ***
  • Posts: 169
Re: SQLite raised exception class 'External: SIGSEGV'
« Reply #15 on: October 20, 2023, 07:07:41 pm »
rvk:
Quote
What does that code do?
So what are you trying to do there?
I found this piece of code here in this forum several years ago when I was looking for a solution to the 'database locked' error.  It was suppose to be the answer to this problem so that is why I included it.
Quote
If on the other hand you have connected set to true in your IDE then THAT is the cause of your locked file.
Because then the IDE/Lazarus has the file open at design time and you open it again at run time.
I did indeed have the SQLite3Connection1 set to active.  So I now have SQLite3Connection1, SQLQuery1, and Transaction1 all set to active false.  I do have the code below:

Code: Pascal  [Select][+][-]
  1. procedure TDataModule1.DataModuleCreate(Sender: TObject);
  2. var
  3.   strDbName: string;
  4. begin
  5.      strDbName := SysUtils.ExtractFilePath(ParamStr(0)) + 'data.sqlite3';
  6.      DataModule1.SQLite3Connection1.DatabaseName := strDbName;
  7. end;
  8.  
It is working great now, thank you rvk for your help!

egsuh:
Quote
If Datamodule is auto-created, you don't have to create TSQLQuery within the DatamoduleCreate event if you dropped it from component palette.

Transaction should be started before any action on the database is done. So,

  Transaction1.StartTransaction;   or    Transaction1.Active := true;   should precede

  SQLQuery1.Open; or SQLQuery1.ExecSQL;

   And then you call

   Transaction1.Commit;
Now that makes since, thank you!
 

dodgebros

  • Full Member
  • ***
  • Posts: 169
Re: SQLite raised exception class 'External: SIGSEGV'
« Reply #16 on: October 20, 2023, 07:10:18 pm »
Thank you Zvoni for your reply.  I will keep your code example for future reference
TD

rvk

  • Hero Member
  • *****
  • Posts: 6716
Re: SQLite raised exception class 'External: SIGSEGV'
« Reply #17 on: October 20, 2023, 07:12:17 pm »
I did indeed have the SQLite3Connection1 set to active. 
Yep, bingo. That was the cause of the locked file then.
BTW you didn't have it to active in the test project you shared  ;D

But that's why I never set it to Connected or Active in the IDE.

Glad it works now.

dodgebros

  • Full Member
  • ***
  • Posts: 169
Re: SQLite raised exception class 'External: SIGSEGV'
« Reply #18 on: October 20, 2023, 07:16:27 pm »
Thanks again rvk, I had lost hope in being able to use SQLite in my projects.
TD

 

TinyPortal © 2005-2018