Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 1 of 1 total |
#8962 Data record buffers corrupt in the table incident |
Wed, Mar 4 2009 1:44 AM | Permanent Link |
Garey | delphi 6+dbisam4.05
always show #8962 Error, if i try to repairtable, pop #11013 error msg. here is my testing source code pls help me, thanks Regards Garey ======================== unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, DB, dbisamtb, StdCtrls, Grids, DBGrids, dbisamct; type Tfrmtestdbisam = class(TForm) Timerinsert: TTimer; TimerQry: TTimer; procedure FormShow(Sender: TObject); procedure CreateTable; procedure TimerinsertTimer(Sender: TObject); procedure TimerQryTimer(Sender: TObject); private { Private declarations } public { Public declarations } end; TCEThread = class(TThread) protected procedure Execute; override; end; var frmtestdbisam: Tfrmtestdbisam; implementation {$R *.dfm} procedure Tfrmtestdbisam.CreateTable; var filepath: String; v_SQL: String; qryCretetbl: TDBISAMQuery; begin qryCretetbl := TDBISAMQuery.Create(nil); filepath := ExtractFilePath(Application.ExeName)+'cedb'; qryCretetbl.DatabaseName := filepath; v_sql := ' CREATE TABLE IF NOT EXISTS "INCIDENT" '+#10+ ' ( '+#10+ ' idx autoinc,'+#10+ ' receiveddate timestamp,'+#10+ ' atkdate Date,'+#10+ ' atktime time,'+#10+ ' sourceip varchar(15),'+#10+ ' sourcenum integer,'+#10+ ' sourcename varchar(50),'+#10+ ' sourceport varchar(10),'+#10+ ' targetip varchar(30),'+#10+ ' targetnum integer,'+#10+ ' targetname varchar(30),'+#10+ ' targetport varchar(30),'+#10+ ' attacktype varchar(200),'+#10+ ' deviceid varchar(15),'+#10+ ' severity int,'+#10+ ' remarks varchar(200), '+#10+ ' primary key ("idx") compress full'+#10+ ' ) '; with qryCretetbl do begin sql.Clear; sql.Add(v_sql); execSql; end; qryCretetbl.Free; end; procedure Tfrmtestdbisam.FormShow(Sender: TObject); begin CreateTable; Timerinsert.Enabled := true; TimerQry.Enabled := true; end; procedure Tfrmtestdbisam.TimerinsertTimer(Sender: TObject); var inserttbl: TDBISAMTable; i: integer; tblRepair: TDBISAMTable; ThreadSession: TDBISAMSession; begin Timerinsert.Enabled := false; for i := 0 to 10 do begin inserttbl := TDBISAMTable.Create(nil); with inserttbl do begin DatabaseName := ExtractFilePath(Application.ExeName)+'cedb'; tablename := 'incident'; active := true; Append; fieldByName('receiveddate').Value := now; FieldByName('atkdate').AsString := FormatDateTime('yyyy-mm-dd',now); FieldByName('atktime').AsString := FormatDateTime('hh:nn:ss',now); FieldByName('sourceip').AsString := '1.1.1.1'; FieldByName('sourcenum').AsString := '222222'; FieldByName('sourcename').AsString := 'source name'; FieldByName('targetip').AsString := '2.2.2.2'; FieldByName('targetnum').AsString := '33333'; FieldByName('targetname').AsString := 'dest name'; FieldByName('targetport').AsString := '80'; FieldByName('attacktype').AsString := 'attack type'; FieldByName('deviceid').AsString := 'deviceid1'; FieldByName('remarks').AsString := ' this is a testing app.'; post; Application.ProcessMessages; end; inserttbl.Free; end; Timerinsert.Enabled := true; end; procedure Tfrmtestdbisam.TimerQryTimer(Sender: TObject); var thread: TThread; begin TimerQry.Enabled := false; thread := TCEThread.Create(True); thread.Resume; end; { TCEThread } procedure TCEThread.Execute; var Qry,Qrydel: TDBISAMQuery; ThreadSession: TDBISAMSession; tblrepair: TDBISAMTable; begin try ThreadSession:=TDBISAMSession.Create(nil); ThreadSession.PrivateDir := ExtractFilePath(Application.ExeName)+'cedb'; ThreadSession.AutoSessionName := True; ThreadSession.LockProtocol := lpPessimistic; Qry := TDBISAMQuery.Create(nil); Qry.SessionName := ThreadSession.SessionName; Qry.DatabaseName := ExtractFilePath(Application.ExeName)+'cedb'; with Qry do begin Close; SQL.Clear; SQL.Add('select max(idx) maxidx from incident '); Qry.Prepare; open; frmtestdbisam.Writelog; end; Qry.Close; Qry.Free; Application.ProcessMessages; Qrydel := TDBISAMQuery.Create(nil); Qrydel.SessionName := ThreadSession.SessionName; Qrydel.DatabaseName := ExtractFilePath(Application.ExeName)+'cedb'; with Qrydel do begin close; SQL.Add(' delete from incident '); Qrydel.Prepare; execSQL; end; Qrydel.Free; ThreadSession.Free; frmtestdbisam.TimerQry.Enabled := true; except tblrepair := TDBISAMTable.Create(nil); tblrepair.DatabaseName := ExtractFilePath(Application.ExeName)+'cedb'; tblrepair.TableName := 'incident'; if tblrepair.Exists then tblrepair.RepairTable(true); tblrepair.Free; end; end; end. ===the testing source code================ |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |