tvplaint: Fix FireBird datastore demo crashing after creating the DB.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5172 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2016-09-17 17:10:43 +00:00
parent 824cbb6a59
commit ecdb5f28de
5 changed files with 19 additions and 16 deletions

View File

@ -60,6 +60,14 @@
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Options>
<Win32>

View File

@ -6,6 +6,7 @@ Login parameters for the created database:
password: masterkey
NOTE:
The project creates a new database on the fly. For reasons unknown at the moment,
an exception is raised here if started from the IDE. This does not happen any
more once the database exists.
The project creates a new database on the fly using above-menitoned login
parameters. For reasons unknown at the moment, the first program entries after
adding a resource are not stored --> a restart of the demo program is required
after adding the first resource.

View File

@ -278,7 +278,7 @@ object Form1: TForm1
end
object SQLTransaction1: TSQLTransaction
Active = False
Action = caCommit
Action = caCommitRetaining
Database = IBConnection1
Options = []
left = 256
@ -321,6 +321,7 @@ object Form1: TForm1
LoginPrompt = False
KeepConnection = True
Transaction = SQLTransaction1
HostName = 'localhost'
Options = []
left = 136
top = 120

View File

@ -89,8 +89,6 @@ begin
VpFirebirdDatastore1.Connection := IBConnection1;
VpFirebirdDatastore1.AutoCreate := true;
VpFirebirdDatastore1.CreateTables;
VpFirebirdDatastore1.Connected := true;

View File

@ -100,15 +100,13 @@ end;
procedure TVpFirebirdDatastore.CreateAllTables(dbIsNew: Boolean);
var
tableNames: TStringList;
needCommit: Boolean;
begin
needCommit := false;
if dbIsNew then begin
CreateTable(ContactsTableName);
CreateTable(EventsTableName);
CreateTable(ResourceTableName);
CreateTable(TasksTableName);
needCommit := true;
FConnection.Transaction.Commit;
end else
begin
tablenames := TStringList.Create;
@ -118,30 +116,27 @@ begin
if tablenames.IndexOf(ContactsTableName) = -1 then begin
CreateTable(ContactsTableName);
needCommit := true;
FConnection.Transaction.Commit;
end;
if tablenames.IndexOf(EventsTableName) = -1 then begin
CreateTable(EventsTableName);
needCommit := true;
FConnection.Transaction.Commit;
end;
if tablenames.IndexOf(ResourceTableName) = -1 then begin
CreateTable(ResourceTableName);
needCommit := true;
FConnection.Transaction.Commit;
end;
if tablenames.IndexOf(TasksTableName) = -1 then begin
CreateTable(TasksTableName);
needCommit := true;
FConnection.Transaction.Commit;
end;
finally
tablenames.Free;
end;
end;
if needCommit then
FConnection.Transaction.Commit;
end;
// Connection and tables are active afterwards!