[fpc-devel]Access violation with IndexName property of TDbf

Tony Maro tony at maro.net
Mon Aug 2 19:23:51 CEST 2004


I'm not sure if this is a TDbf issue, or an FPC db issue, so I'm posting 
both places.  I'm using CVS of FPC from about 1 hour ago.

Basically, whatever I do, if I try to set the "IndexName" or 
"IndexFieldNames" property of the TDbf I get an access violation.

Here's a sample:

var
   MyDbf: TDbf;
begin
  MyDbf := TDbf.Create(nil);
  MyDbf.FilePath := 'data/';
  { we want to use Visual dBase VII compatible tables }
  MyDbf.TableLevel := 7;
  MyDbf.Exclusive := True;
  MyDbf.TableName := 'customers.dbf';
  With MyDbf.FieldDefs do begin
   Add('Id', ftAutoInc, 0, True);
   Add('Name', ftString, 80, True);
  End;
  MyDbf.CreateTable;
  MyDbf.Open;
  MyDbf.AddIndex('custid', 'Id', [ixPrimary, ixUnique]);
  MyDbf.AddIndex('custname.ndx','Name', [ixCaseInsensitive]);
  MyDbf.Close;
  MyDbf.Free;
  MessageDlg('Created.', mtInformation,[mbOk],0);

  MyDBF := TDBf.Create(nil);
  MyDBF.FilePath := 'data/';
  MyDBF.TableLevel := 25;
  MyDBF.TableName := 'customers.dbf';
  MyDBF.Open;
  MyDBF.OpenIndexFile('custname.ndx');
  MyDBF.IndexName := 'custname';
  //MyDBF.IndexFieldNames := 'Name';   // doesn't work either
  //MyDBF.IndexName := 'custid'; // doesn't work EITHER...
  MyDbf.Close;

end;

And the obligatory backtrace:
(gdb) run
Starting program: /home/tony/Projects/testcrash/project1
 
Program received signal SIGSEGV, Segmentation fault.
0x0806a29c in DBF_TDBF_$__GETRECORD$PCHAR$TGETMODE$BOOLEAN ()
(gdb) bt full
#0  0x0806a29c in DBF_TDBF_$__GETRECORD$PCHAR$TGETMODE$BOOLEAN ()
No symbol table info available.
#1  0x08070de8 in DB_TDATASET_$__RESYNC$TRESYNCMODE ()
No symbol table info available.
#2  0x0806b252 in DBF_TDBF_$__RESYNC$TRESYNCMODE ()
No symbol table info available.
#3  0x0806cf63 in DBF_TDBF_$__SETINDEXNAME$ANSISTRING ()
No symbol table info available.
#4  0x0816dd29 in TFORM1__BUTTON1CLICK (SENDER=0x40440ea8, this=0x4043eae8)
    at unit1.pas:59
        MYDBF = (TDBF *) 0x4057c014
#5  0x08102158 in TCONTROL__CLICK (this=0x40440ea8) at control.inc:1813
No locals.
#6  0x080d6b25 in TBUTTONCONTROL__CLICK (this=0x40440ea8)
    at buttoncontrol.inc:51
No locals.
#7  0x080ca201 in TCUSTOMBUTTON__CLICK (this=0x40440ea8) at buttons.inc:187
        FORM = (TCUSTOMFORM *) 0x0
#8  0x080ca220 in TCUSTOMBUTTON__WMDEFAULTCLICKED (MESSAGE=
      {MSG = 1031, WPARAM = -1073746528, LPARAM = 26, RESULT = 
1075674240, WPARA MLO = 60832, WPARAMHI = 49151, LPARAMLO = 26, LPARAMHI 
= 0, RESULTLO = 31872, RE SULTHI = 16413}, this=0x40440ea8) at 
buttons.inc:199
No locals.





More information about the fpc-devel mailing list