[Libreoffice-bugs] [Bug 144694] SQLite: Base Direct SQL Not Running Properly

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Sep 25 13:23:22 UTC 2021


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

--- Comment #7 from Lionel Elie Mamane <lionel at mamane.lu> ---
(In reply to flywire from comment #6)
> User should be able to run a SQL script that returns the result as a view
> (ie query table grid).

Creating a query, in the left part of the screen, "query" and then "new" does
that.

> Tools → SQL doesn't do that.

Doesn't it do that if you check the "show results" box?

(In reply to Julien Nabet from comment #5)
> The more I think about it, the more it seems we should use an SQL parser
> here.

That's a possibility, but it will stay a heuristic; it will never cover all
dialects of SQL. Another direction altogether would be to just ask the user to
choose between "execute as Query (return rows)" and "execute as Update or DDL
(return update count)" or (see below) "automatic"; if the SDBC driver doesn't
support automatic mode, grey out the automatic choice and "force" the user to
tell us.

If the SDBC drivers were all "perfect" and "fully able", we would just
unconditionally use "execute" and then use
 com::sun::star::sdbc::XMultipleResults::getResultSet()
 com::sun::star::sdbc::XMultipleResults::getUpdateCount()
to retrieve the result, and
 com::sun::star::sdbc::XMultipleResults::getMoreResults()
to retrieve the next result; this has the *driver* (the database system?) tell
us whether that was a query, and update, or both at the same time.

My memory tells me I already have changed the Tools->SQL code to do just that,
if/when the underlying SDBC driver supports
com::sun::star::sdbc::XMultipleResults
and indicates so in
com::sun::star::sdbc::XDatabaseMetaData::supportsMultipleResultSets

Anybody wanting to enhance the heuristic used when the driver is not
feature-complete (no XMultipleResults or supportsMultipleResultSets returns
false) is welcom to, but IMO the best / most robust results is getting the SDBC
drivers to support that interface.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210925/e7317313/attachment.htm>


More information about the Libreoffice-bugs mailing list