Hello.
I want to restore a dump made by MyDump : it's a big SQL file with only INSERT instructions (no Lock/unlock).
But before this, I want to execute :
* lock tables instructions
* delete instructions for tables in the database with MyScript component
And restore of the dump
And :
* unlock tables instruction
This is OK.
If an error occur in the restore, I do a Rollback, and this rollback not work.
I do this :
* MyConnection1.StartTransaction;
* MyScript1.AutoCommit := False;
* MyScript1.SQL :=
* MyScript1.Execute
* MyScript1.ExecuteFile()
* MyConnection1.Rollback;
* MyScript1.SQL :=
* MyScript1.Execute
And the restore is realised !
But I want no restore (Rollback instruction).
It's the same problem with MyDump component.
MyDump / MyScript with Commit/Rollback
-
swierzbicki
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
Yes, all tables are InnoDB.
The script :
The file "script.sql" contain only INSERT INTO instruction :
The Rollback at End of script don't work :
the DELETE and INSERT is executed
The script :
Code: Select all
begin
MyConnection1.StartTransaction;
MyScript1.AutoCommit := False;
tstr := TStringList.Create;
tstr.Add('lock tables tablename write;');
tstr.Add('delete from tablename;');
MyScript1.SQL := tstr;
MyScript1.Execute;
MyScript1.ExecuteFile('script.sql');
tstr.Clear;
tstr.Add('unlock tables;');
MyScript1.SQL := tstr;
MyScript1.Execute;
MyConnection1.Rollback;
End;
Code: Select all
INSERT INTO tablename VALUES
('...','...',...),
('...','...',...);
the DELETE and INSERT is executed