Recent

Author Topic: [SOLVED]sqlite3dataset append causes external:sigsegv error  (Read 2955 times)

rgtech

  • Newbie
  • Posts: 2
[SOLVED]sqlite3dataset append causes external:sigsegv error
« on: September 21, 2012, 09:49:12 pm »
I am trying to create a simple database using sqlite and sqlite3dataset in win xp using Lazarus 0.9.30.4. The db file is created and open but when I try to Append to it I get the 'External:SIGSEGV' error.

Hear are the create and append lines
Code: [Select]
procedure TForm1.RunButtonClick(Sender: TObject);
begin
//create database file
  Dataset1.FileName:=IncludeTrailingPathDelimiter(sDir)+'simple.db';
  Label1.Caption:=Dataset1.FileName;
  if not Dataset1.TableExists then
  begin
    Dataset1.Fielddefs.Clear;
    Dataset1.Fielddefs.Add('id',ftAutoinc);
    Dataset1.Fielddefs.Add('zip',ftString);
    Dataset1.Fielddefs.Add('count', ftInteger);
    Dataset1.CreateTable;
    Label1.Caption:='fields created';
  end;
  Dataset1.Open;


end;

procedure TForm1.AppendButtonClick(Sender: TObject);
begin
  Dataset1.Append;
  Dataset1.FieldByName('zip').AsString:='12345';
  Dataset1.FieldByName('count').AsInteger:=1;
  Dataset1.Post;
  Label1.Caption:='Appended data';
end;

I followed the tutorials at sqlite4fpc -which were very helpful to get things started. I can create and run these with no errors. Anyone have any ideas as to what I missed?
I have also attached the simpldb project files (sqlite3.dll is in my directory but had to leave out of upload due to size limit).
« Last Edit: September 24, 2012, 08:52:26 pm by rgtech »

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: sqlite3dataset append causes external:sigsegv error
« Reply #1 on: September 23, 2012, 07:08:56 pm »
You have a stack overflow because of Dataset1.Mastersource being set to datasource1. Basically you are making a circular reference and Datalink events are looping forever causing a stack overflow. Remove the Dataset1.Mastersource. It is only used for master detail relationships where you point to the master query.

rgtech

  • Newbie
  • Posts: 2
[SOLVED] Re: sqlite3dataset append causes external:sigsegv error
« Reply #2 on: September 24, 2012, 08:50:38 pm »
Thank you very much ludub. I new it was something small that I was missing. Just learning how to program database and still figuring out how all the 'parts' connect to each other.

I added [SOLVED] to subject. If there is something else I am supposed to do to mark as solved please let me know. This was my first post here.

Thanks again - Ron