[patch] TSQLScript doesn't execute last statement not terminated by ';' (FTerminator)
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
if I run this script with TSQLScript:
INSERT INTO A (ID) VALUES (1);
INSERT INTO A (ID) VALUES (2)
Only the first insert is executed. Not the second one - it's ignored because it lacks the terminating ';'. Furthermore, no exception is raised - so I even don't know about the last statement being ignored.
Steps to reproduce:
program SQLScriptTest;
{$mode delphi}
uses
SysUtils, sqldb, pqconnection;
var
Conn: TPQConnection;
Trans: TSQLTransaction;
Script: TSQLScript;
begin
Conn := TPQConnection.Create(nil);
Conn.HostName := 'localhost';
Conn.DatabaseName := 'fpctest';
Conn.UserName := 'postgres';
Conn.Password := '';
Conn.Connected := True;
Trans := TSQLTransaction.Create(Conn);
Trans.DataBase := Conn;
Script := TSQLScript.Create(Conn);
Script.Script.Text :=
'CREATE TABLE test (ID INTEGER)';
Script.DataBase := Conn;
Script.Transaction := Trans;
Script.Execute;
Trans.Commit;
Conn.Free;
end.
Additional information:
I ran the test suite - no additional tests were broken:
test/cg/tcalext6
test/opt/tdfa11
test/opt/tdfa8
test/packages/zlib/tzlib1
test/tcpstr2a
test/timplements4a
test/timplements4b
test/tset6
test/tweaklib2
test/units/sharemem/test1
webtbs/tw11039a
webtbs/tw11039b
webtbs/tw22744
webtbs/tw22744b
webtbs/tw24863
webtbs/tw29353
webtbs/tw3930
webtbs/tw4809
webtbf/tw18225b
webtbf/tw3930a
Patch attached
Mantis conversion info:
- Mantis ID: 32486
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 37355 (#488e7af3)
- Target version: 3.2.0