2011. január 4., kedd
Create and destroy DBISAM in-memory tables as needed
Problem/Question/Abstract:
When I have deleted an in-memory table and I want to create it again, I get an error message that I have duplicate field names. What is wrong here?
Answer:
This automatically creates and destroys memory tables as needed. Use these procedures to open and close your tables.
procedure OpenTbl(Tbl: TDBISAMTable);
begin
if (Tbl.Active = False) then
begin
with Tbl do
begin
try
if not (Exists) and InMemory then
CreateTable;
Open;
First;
except
raise EOpenTable.Create('Error: couldn' t open table.('+Tbl.TableName+':
'+Tbl.Name+')');
end;
end;
end;
end;
procedure CloseTbl(Tbl: TDBISAMTable);
begin
with Tbl do
begin
if (Active = True) then
begin
if (state = dsInsert) or (state = dsEdit) then
begin
try
Post;
except
Cancel;
end;
end;
Tbl.FlushBuffers;
Close;
if InMemory then
begin
try
DeleteTable;
except
{ ... }
end;
end;
end;
end;
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése