Examples, sqlite_mushrooms: close transaction at application end, fixes SIGSEGV at program close

git-svn-id: trunk@43757 -
This commit is contained in:
maxim 2014-01-17 22:45:55 +00:00
parent 079e565ed6
commit 8f68b9e105
2 changed files with 17 additions and 26 deletions

View File

@ -147,7 +147,7 @@ object Form1: TForm1
OnClose = FormClose OnClose = FormClose
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.2.0.2' LCLVersion = '1.3'
object DBNavigator1: TDBNavigator object DBNavigator1: TDBNavigator
Left = 6 Left = 6
Height = 35 Height = 35
@ -206,7 +206,7 @@ object Form1: TForm1
end end
object DBEdit1: TDBEdit object DBEdit1: TDBEdit
Left = 128 Left = 128
Height = 23 Height = 21
Top = 408 Top = 408
Width = 166 Width = 166
DataField = 'Image_Link' DataField = 'Image_Link'
@ -236,22 +236,22 @@ object Form1: TForm1
Columns = < Columns = <
item item
Title.Caption = 'Common Name' Title.Caption = 'Common Name'
Width = 101 Width = 86
FieldName = 'Common_Name' FieldName = 'Common_Name'
end end
item item
Title.Caption = 'Scientific Name' Title.Caption = 'Scientific Name'
Width = 98 Width = 87
FieldName = 'Scientific_Name' FieldName = 'Scientific_Name'
end end
item item
Title.Caption = 'Order' Title.Caption = 'Order'
Width = 45 Width = 43
FieldName = 'Order' FieldName = 'Order'
end end
item item
Title.Caption = 'Genus' Title.Caption = 'Genus'
Width = 48 Width = 45
FieldName = 'Genus' FieldName = 'Genus'
end end
item item
@ -261,7 +261,7 @@ object Form1: TForm1
end end
item item
Title.Caption = 'Notes' Title.Caption = 'Notes'
Width = 46 Width = 43
FieldName = 'Notes' FieldName = 'Notes'
end> end>
DataSource = Datasource1 DataSource = Datasource1
@ -322,23 +322,22 @@ object Form1: TForm1
DataSource = Datasource1 DataSource = Datasource1
OnDblClick = DBImage1DblClick OnDblClick = DBImage1DblClick
OnDBImageRead = DBImage1DBImageRead OnDBImageRead = DBImage1DBImageRead
OnDBImageWrite = DBImage1DBImageWrite
Proportional = True Proportional = True
end end
end end
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
Height = 15 Height = 13
Top = 55 Top = 55
Width = 22 Width = 18
Caption = 'Link' Caption = 'Link'
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 360 Left = 360
Height = 15 Height = 13
Top = 55 Top = 55
Width = 24 Width = 20
Caption = 'Blob' Caption = 'Blob'
ParentColor = False ParentColor = False
end end
@ -353,13 +352,13 @@ object Form1: TForm1
end end
object Label3: TLabel object Label3: TLabel
Left = 8 Left = 8
Height = 15 Height = 13
Top = 424 Top = 424
Width = 32 Width = 30
Caption = 'Note :' Caption = 'Note :'
ParentColor = False ParentColor = False
end end
object Datasource1: TDatasource object Datasource1: TDataSource
DataSet = SQLQuery1 DataSet = SQLQuery1
left = 216 left = 216
top = 192 top = 192
@ -380,14 +379,14 @@ object Form1: TForm1
top = 192 top = 192
end end
object SQLTransaction1: TSQLTransaction object SQLTransaction1: TSQLTransaction
Active = True Active = False
Action = caCommitRetaining Action = caCommitRetaining
Database = SQLite3Connection1 Database = SQLite3Connection1
left = 208 left = 208
top = 120 top = 120
end end
object SQLite3Connection1: TSQLite3Connection object SQLite3Connection1: TSQLite3Connection
Connected = True Connected = False
LoginPrompt = False LoginPrompt = False
DatabaseName = 'ImageTest.db3' DatabaseName = 'ImageTest.db3'
KeepConnection = False KeepConnection = False

View File

@ -43,8 +43,6 @@ type
Column: TColumn; AState: TGridDrawState); Column: TColumn; AState: TGridDrawState);
procedure DBImage1DBImageRead(Sender: TObject; S: TStream; procedure DBImage1DBImageRead(Sender: TObject; S: TStream;
var GraphExt: string); var GraphExt: string);
procedure DBImage1DBImageWrite(Sender: TObject; S: TStream; GraphExt: string
);
procedure DBImage1DblClick(Sender: TObject); procedure DBImage1DblClick(Sender: TObject);
procedure DBNavigator1BeforeAction(Sender: TObject; Button: TDBNavButtonType procedure DBNavigator1BeforeAction(Sender: TObject; Button: TDBNavButtonType
); );
@ -131,12 +129,6 @@ end;
procedure TForm1.DBImage1DBImageWrite(Sender: TObject; S: TStream;
GraphExt: string);
begin
end;
procedure TForm1.DBImage1DblClick(Sender: TObject); procedure TForm1.DBImage1DblClick(Sender: TObject);
var var
BlobStream: TStream; BlobStream: TStream;
@ -186,7 +178,7 @@ end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin begin
SQLQuery1.ApplyUpdates; SQLQuery1.ApplyUpdates;
SQLTransaction1.CommitRetaining; SQLTransaction1.Commit;
end; end;
procedure TForm1.FormCreate(Sender: TObject); procedure TForm1.FormCreate(Sender: TObject);