Bug 137566 - FIREBIRD: some errors during - create Table and insert records via menue "tools/SQL"
Summary: FIREBIRD: some errors during - create Table and insert records via menue "too...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2020-10-17 19:56 UTC by Richard Demattio
Modified: 2024-02-10 17:18 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Testcases (2.09 KB, text/plain)
2020-10-17 19:58 UTC, Richard Demattio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Demattio 2020-10-17 19:56:55 UTC
Description:
creating tables and inserting records are leading to errors "token unknown"
and the operations are failing

Steps to Reproduce:
see the attached file

Actual Results:
creating a new table via Tools SQL works fine, when I klick "Execute"
inserting ONE record into this table afterwards works also fine
~~~~~~~~~~~~~~
create table AND insert record in one transaction brings:
   *SQL error code = -104
   *Token unknown - line 10, column 1
   *INSERT "Error
after "execute"
also "COMMIT" is unknown in such a sequence
~~~~~~~~~~~~~~~~
inserting two records in one transaction also brings:
   *SQL error code = -104
   *Token unknown - line 2, column 1
   *INSERT
~~~~~~~~~~~~~~
inserting two or more records via an EXECUTE BLOCK ...
works fine.

See the attached testcases




Expected Results:
should work as one sequence!
This way it would be possible and easy to create tables, load records and update by definitions in a textfile.


Reproducible: Always


User Profile Reset: No



Additional Info:
BUILD:

https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=17cbc559be6936777904e5cf8a517cac89045264
Comment 1 Richard Demattio 2020-10-17 19:58:05 UTC
Created attachment 166471 [details]
Testcases
Comment 2 Richard Demattio 2020-10-17 19:59:52 UTC
the database was created by LO Version 7.0.1.2 with FIREBIRD embedded
Comment 3 Richard Demattio 2020-10-17 20:01:10 UTC
nice to have:
=============
the popup of "Tools/SQL" should be resizeable.
Comment 4 Robert Großkopf 2020-10-18 16:28:04 UTC
Could confirm this buggy behavior for the internal Firebird database on OpenSuse 15.1 64bit rpm Linux an LO 7.0.2.2.

The code will work well with internal Hsqldb. So a special internal Firebird bug.
Comment 5 Julien Nabet 2022-02-05 10:35:13 UTC
Here's a code pointer for those interested:
#0  dbaui::DirectSQLDialog::implExecuteStatement(rtl::OUString const&)
    (this=0x9ed00d0, _rStatement="CREATE TABLE \"tla_Kontaktarten\" (\n\t \"Maske\"   INTEGER  PRIMARY KEY,\n\t \"Typ\"\t   VARCHAR(30) NOT NULL UNIQUE\n);\nINSERT INTO \"tla_Kontaktarten\" VALUES (1,'Testadresse');") at dbaccess/source/ui/dlg/directsql.cxx:202
#1  0x00007f3d2faf844d in dbaui::DirectSQLDialog::executeCurrent() (this=0x9ed00d0) at dbaccess/source/ui/dlg/directsql.cxx:366
#2  0x00007f3d2faf8929 in dbaui::DirectSQLDialog::OnExecute(weld::Button&) (this=0x9ed00d0) at dbaccess/source/ui/dlg/directsql.cxx:418

first I thought about spliting the string on each ";" and call implExecuteStatement for each request but since a ";" may also appear in a string, I suppose we need a full SQL parser. Even if there's one in LO (I guess https://opengrok.libreoffice.org/search?project=core&full=OSQLParser&defs=&refs=&path=&hist=&type=&xrd=&nn=1&si=full&si=full&n=25 ?), I don't know at all how to use it.
Comment 6 QA Administrators 2024-02-06 03:11:51 UTC Comment hidden (obsolete)
Comment 7 Richard Demattio 2024-02-10 17:01:45 UTC
about the Error on "create table AND insert record in one transaction"
I guess, the table must exist first (committed) and inserting a record makes sense only afterwards.
~~~~~~~~~~~~~~~~~~~~~
inserting two or more records via "execute block" is an acceptable workaround to avoid error when "inserting two records".
~~~~~~~~~~~~~~~~~~~~~
so:it works for me
Comment 8 Richard Demattio 2024-02-10 17:18:54 UTC
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: de-AT (en_US.UTF-8); UI: en-US
Calc: threaded