| Summary: | Python SFDatabases.Database.GetRows() crashes when no data is available | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Szymon Nikliborc <szymon.nikliborc> |
| Component: | Base | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | jp, rafael.palma.lima |
| Priority: | medium | ||
| Version: | 7.3.7.2 release | ||
| Hardware: | x86-64 (AMD64) | ||
| OS: | All | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
| Bug Depends on: | |||
| Bug Blocks: | 127593 | ||
| Attachments: |
Calc file
Error window |
||
|
Description
Szymon Nikliborc
2023-07-11 15:12:31 UTC
Created attachment 188318 [details]
Calc file
Created attachment 188319 [details]
Error window
Hi, I have just run your script and it worked. Here's what I got as result:
------------< Python Shell >------------
>>> test1()
/home/rafael/Downloads/test.odb
Connection to Base successful
query ='CREATE TABLE "tickers" ("id" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY, "ticker" VARCHAR(50) NOT NULL, "currency" VARCHAR(10) NOT NULL)'
Query executed successfully
query ='INSERT INTO "tickers" ("ticker", "currency") VALUES (\'a\', \'aa\')'
Query executed successfully
query ='SELECT "id" FROM "tickers" WHERE "ticker" = \'a\' '
Query executed successfully
execute_read_query(connection, query) =((0,),)
query ='SELECT "id" FROM "tickers" WHERE "ticker" = \'b\' '
Query executed successfully
execute_read_query(connection, query) =()
------------
I simply opened the file, entered APSO Python sheel and ran "test1()".
Note that if you run the script for a second time, it will crash because the ODB file will have been created.
@JPL any input in this issue?
(In reply to Rafael Lima from comment #3) > Hi, I have just run your script and it worked. Here's what I got as result: > > ------------< Python Shell >------------ > >>> test1() > /home/rafael/Downloads/test.odb > Connection to Base successful > query ='CREATE TABLE "tickers" ("id" INTEGER GENERATED BY DEFAULT AS > IDENTITY(START WITH 0) NOT NULL PRIMARY KEY, "ticker" VARCHAR(50) NOT NULL, > "currency" VARCHAR(10) NOT NULL)' > Query executed successfully > query ='INSERT INTO "tickers" ("ticker", "currency") VALUES (\'a\', \'aa\')' > Query executed successfully > query ='SELECT "id" FROM "tickers" WHERE "ticker" = \'a\' ' > Query executed successfully > execute_read_query(connection, query) =((0,),) > > query ='SELECT "id" FROM "tickers" WHERE "ticker" = \'b\' ' > Query executed successfully > execute_read_query(connection, query) =() > ------------ > > I simply opened the file, entered APSO Python sheel and ran "test1()". > > Note that if you run the script for a second time, it will crash because the > ODB file will have been created. > > @JPL any input in this issue? Problem is with Linux. Windows is ok. (In reply to Szymon Nikliborc from comment #4) > Problem is with Linux. Windows is ok. I tested in Kubuntu 23.04 and it worked... maybe you could try again on another Linux install and see if the issue persists. My system info: Version: 7.5.4.2 (X86_64) / LibreOffice Community Build ID: 50(Build:2) CPU threads: 16; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: en-US Ubuntu package version: 4:7.5.4-0ubuntu0.23.04.1 Calc: threaded My conclusion is that the bug is a duplicate of bug#155204. The script aborts on line 61, which attempts to execute next query: SELECT "id" FROM "tickers" WHERE "ticker" = 'b' Now, this query does not return any record. Exactly the situation described in above-mentioned bug. The bug is corrected since LO 7.5.4. Thanks for having reported this bug. *** This bug has been marked as a duplicate of bug 155204 *** |