Hi,
I found a reason why people experience difficulties with scripts containing "SET TERM". The problem occurs when there are comments before the SET TERM statement. ZSQLProcessor includes the comment into the complete statement (variable SQL) and then checks if the statement starts with "SET TERM", which is not true because of the comment.
I think the bug is rather old and caused some people to even write workarounds.
Sorry for not having a patch yet but it shouldn't be hard for someone that knows the Zeos code better.
Thanks,
Tarnschaf
Bug in ZSQLProcessor dtSetTerm
Moderators: gto, EgonHugeist
Hello tarnschaf,
I checked the SQL script to understand the problem. Until a solution is available, I suggest to solve the problem another way: use the same delimiter throughout the length of the script. Example:
The Zeos code would look like:
I'm willing to check and fix the code so it's left me a break.
Greetings,
Josimar
I checked the SQL script to understand the problem. Until a solution is available, I suggest to solve the problem another way: use the same delimiter throughout the length of the script. Example:
Code: Select all
CREATE TABLE L4PARTS
(
ID Integer NOT NULL,
"Nummer" VarChar(22),
"Artikel" VarChar(25),
PRIMARY KEY (ID)
)//
CREATE TABLE L4ADRESSES
(
ID Integer NOT NULL,
"Firma" VarChar(25),
"Name" VarChar(25),
PRIMARY KEY (ID)
)//
CREATE TRIGGER AUTOINC_L4PARTS_ID FOR L4PARTS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
new.ID = gen_id( L4PARTS_AUTOINC, 1 );
END//
Code: Select all
function RunScript(AOwner : TComponent; Connection : TZConnection; Script : TStringList): String;
var
SqlProcessor : TZSqlProcessor;
begin
Result := '';
SqlProcessor := TZSqlProcessor.Create(aOwner);
try
SqlProcessor.Connection := Connection;
SqlProcessor.DelimiterType := dtSetTerm;
SqlProcessor.Delimiter := '//'; // <-- look
SqlProcessor.Script.Assign(Script);
try
SqlProcessor.Execute;
except
on E:Exception do Result := E.Message;
end;
finally
SqlProcessor.Free;
end;
end;
Greetings,
Josimar
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
tarnschaf,
bug confirmed. For the first i prose your follow the instructions of josimarz until i or somebody else will find the time to fix this stupid issue.
bug confirmed. For the first i prose your follow the instructions of josimarz until i or somebody else will find the time to fix this stupid issue.
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
josimarz, tarnschaf,
bug fixed Rev. 1915. Can you test it?
bug fixed Rev. 1915. Can you test it?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/