https://bugs.documentfoundation.org/show_bug.cgi?id=144694

Buovjaga <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|SQLite: Base Direct SQL     |SQLite: a Base query
                   |returns error "The data     |including table creation
                   |content could not be        |and selecting returns error
                   |loaded. The execution of    |"The data content could not
                   |the query doesn't return a  |be loaded. The execution of
                   |valid result set."          |the query doesn't return a
                   |                            |valid result set." (see
                   |                            |comment 27)

--- Comment #27 from Buovjaga <[email protected]> ---
== The preparation ==

Set up SQLite3 based on
https://wiki.documentfoundation.org/Documentation/HowTo/Base/Connect_to_SQLite

On Linux, for ODBC, use instructions for your distro. I used
https://wiki.archlinux.org/title/Open_Database_Connectivity

I installed unixodbc from Arch repos.

I installed sqliteodbc from AUR.

I created an empty test database with `> test.db` (`touch test.db` also works).

I created an /etc/odbc.ini referencing the test database.

[ODBC Data Sources]
tdf144694            = SQLite3 Driver

[tdf144694]
Driver      = /usr/lib/libsqlite3odbc.so
Description = tdf144694
database    = /path/to/test.db

Then I followed the steps from the TDF wiki article.

In Base, select database - Connect to an existing database: ODBC
Set up ODBC connection - Browse and Choose a data source, tdf144694
Set up user authentication - Test connection
Save and proceed to create database

== The testing itself ==

The problematic query that you should copy is in the text file attachment
198125. The query first creates a table called org and inserts data into it.
Then it immediately selects some data.

No errors are shown, if you execute it via Tools - SQL (both checkboxes should
be checked, run directly and show output). This does not show the result of the
select in the Output field, though. The result is only shown, if you execute
the creation of the table and the select (starting with WITH RECURSIVE)
separately.

The error "The data content could not be loaded. The execution of the query
doesn't return a valid result set" is shown with these steps:

1. Go to the Queries view in Base, single-click "Create Query in SQL View"
2. Activate "Run SQL command directly" from the right side of the toolbar
3. Paste in the full query from attachment 198125 and click Save, give it a
name, close the query window
4. Double-click the name of the query you created to run it

Now you should see the error. The table itself has been created. The result is
shown fine, if you split the query into the creation and select steps as
mentioned before.

When testing, the table can be deleted by executing this command in the SQL
dialog:
DROP TABLE org;

(the status will be "1: The execution of the query does not return a valid
result set.", which is fine in this case)

It is more convenient to drop the table than delete the .db file and create a
blank one because in that case the connection in an existing Base file will no
longer work and you would have to create a new Base file.

You can always check the state via the command line with
sqlite3 test.db

and saying

.tables

It will print "org", if the table exists or nothing, if it doesn't.

Use .quit to exit.

Side notes (I should report these separately): on Linux with kf6 UI, the error
dialog can't be closed - the application has to be forcefully closed. Best to
run from the command line to make it easy with Ctrl+C, then.

With any UI, using Tools - SQL to run the query, closing it and opening it
again, the dialog width will be huge. Even twice the screen width with gtk3.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to