Bug 148266 - Firebird: entering several SQL commands directly with delimiter impossible
Summary: Firebird: entering several SQL commands directly with delimiter impossible
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.2.6.2 release
Hardware: x86 (IA32) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2022-03-30 12:25 UTC by malt25
Modified: 2023-04-30 08:07 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description malt25 2022-03-30 12:25:46 UTC
Description:
In HSQLDB I could enter several commands directly in Tools > SQL:
ALTER TABLE "Adresse" ADD "Vorname" VARCHAR(25) BEFORE "Name"
ALTER TABLE "Adresse" ADD "email" VARCHAR(50) BEFORE "Name"

All were executed together at once.

In Firebird only one command can be entered and executed.
Several commands:
ALTER TABLE table_name ALTER field_name POSITION 1 
ALTER TABLE table_name ALTER field_name2 POSITION 2
ALTER TABLE table_name ALTER field_name3 POSITION 3
or
ALTER TABLE table_name ALTER field_name POSITION 1;
ALTER TABLE table_name ALTER field_name2 POSITION 2;
ALTER TABLE table_name ALTER field_name3 POSITION 3
or
ALTER TABLE table_name ALTER field_name POSITION 1,
ALTER TABLE table_name ALTER field_name2 POSITION 2,
ALTER TABLE table_name ALTER field_name3 POSITION 3

result in this error message:
*Token unknown - line 2, column 1
*ALTER
caused by
'isc_dsql_prepare'

It is time consuming to enter each command separately.

Steps to Reproduce:
1. enter in Tools > SQL:
ALTER TABLE table_name ALTER field_name POSITION 1 
ALTER TABLE table_name ALTER field_name2 POSITION 2
ALTER TABLE table_name ALTER field_name3 POSITION 3

or

ALTER TABLE table_name ALTER field_name POSITION 1;
ALTER TABLE table_name ALTER field_name2 POSITION 2;
ALTER TABLE table_name ALTER field_name3 POSITION 3

or

ALTER TABLE table_name ALTER field_name POSITION 1,
ALTER TABLE table_name ALTER field_name2 POSITION 2,
ALTER TABLE table_name ALTER field_name3 POSITION 3

Actual Results:
error message:
*Token unknown - line 2, column 1
*ALTER
caused by
'isc_dsql_prepare'

Expected Results:
1:


Reproducible: Always


User Profile Reset: Yes



Additional Info:
no other info
Comment 1 Robert Großkopf 2022-03-30 13:04:11 UTC
Have tested this with the described command 
ALTER TABLE table_name ALTER field_name POSITION …;
and also with
INSERT INTO table_name (fieldname) VALUES(…);

Could only execute one command. Delimiter ';' doesn't work in Firebird.
Seems it is the same behavior in Firebid server connecting by JDBC. So could be a special Firebird bug?

All tested with LO 7.3.2.2 on OpenSUSE 15.3 64bit rpm Linux.
Comment 2 Julien Nabet 2022-03-30 16:58:44 UTC
Searching "firebird multiple statements", just wonder if it's possible in Firebird.

I found an old link here:
https://stackoverflow.com/questions/1698114/firebird-multiple-statements about "execute block"

Also:
https://firebirdsql.org/manual/migration-mssql-syntax.html
Comment 3 Robert Großkopf 2022-03-30 17:34:06 UTC
I have also searched for it. Seems it is a little bit confused:
https://www.firebirdsql.org/pdfmanual/html/isql-terminator.html

The terminator seems to be a ';' by default. But it won't run from Base …
Comment 4 Robert Großkopf 2022-03-30 17:44:40 UTC
Seems Firebird needs a special EXECUTE BLOCK for this:

execute block as
begin
  INSERT INTO "table" ("ID") VALUES(4);
  INSERT INTO "table" ("ID") VALUES(5);
  INSERT INTO "table" ("ID") VALUES(6); 
end

will work here.
Comment 5 malt25 2022-04-01 16:52:39 UTC
in Tools > SQL:

execute block as
begin
  ALTER TABLE "0base" ALTER "eL1" POSITION 1;
  ALTER TABLE "0base" ALTER "eL2" POSITION 2;
  ALTER TABLE "0base" ALTER "eL3" POSITION 3;
end

results in:

1: firebird_sdbc error:
*Dynamic SQL Error
*SQL error code = -104
*Token unknown - line 3, column 3
*ALTER
caused by
'isc_dsql_prepare'

each SQL command alone works.