Page 1 of 1

QxEntityEditor - SQLite views

PostPosted: Fri Dec 01, 2017 12:44 pm
by mdw
My SQLite DB contains a more complex recursive view:
Code: Select all
CREATE VIEW [vwGroupBibs] AS
WITH RECURSIVE
    [tab] AS(
        SELECT [BibFrom],
               [BibTo],
               [idGroup]
        FROM   [GroupBibs]
        UNION ALL
        SELECT [BibFrom] + 1,
               [BibTo],
               [idGroup]
        FROM   [tab]
        WHERE  [BibFrom] < [BibTo]
    )
SELECT DISTINCT [idGroup] AS [idGroup],
       [BibFrom] AS [BibNumber]
FROM   [tab];


When I try to import the schema of the DB containing this view, the action is quitted with the following error message (attachment). If I drop the view, everything is fine. I use QxEntityEditor release 1.1.9.

Re: QxEntityEditor - SQLite views

PostPosted: Fri Dec 01, 2017 3:28 pm
by qxorm
Hello,

I use QxEntityEditor release 1.1.9.

Did you try with latest version (QxEntityEditor 1.2.2) ?

Re: QxEntityEditor - SQLite views

PostPosted: Mon Dec 04, 2017 10:07 am
by mdw
It does not work yet (QxEntityEditor 1.2.2 portable).

Re: QxEntityEditor - SQLite views

PostPosted: Mon Dec 04, 2017 11:35 am
by qxorm
I think the problem is that QxEntityEditor is based on Qt 5.1.1 which embed SQLite 3.7.17.
And it seems that recursive query and WITH keyword are available only with SQLite version 3.8.3 or higher : https://stackoverflow.com/questions/745 ... on-sqlite3
Sorry there is no plan to upgrade Qt version for QxEntityEditor for now.
And I don't know if there is a workaround in SQLite.
I would recommand to create your entity (based on this view) manually.

Re: QxEntityEditor - SQLite views

PostPosted: Tue Dec 05, 2017 8:20 am
by mdw
We have found the following workaround: we maintain a copy of the SQLite DB without the special recursive view to generate the QxOrm entities in QxEntityEditor. It works, but obviously now we need to maintain two different template DBs.

Re: QxEntityEditor - SQLite views

PostPosted: Tue Dec 05, 2017 12:56 pm
by qxorm
Maybe you could try something like this :
- in the ./sqldrivers/ directory of your QxEntityEditor package : you could try to update the qsqlite.dll file.

Because all Qt5 versions should be binary compatible, it could work (QxEntityEditor is built with MSVC2012 on Windows).

For example : if you are using QxEntityEditor for Windows 64bits version, just download latest Qt5 64bits versions. Then copy the qsqlite.dll file from the downloaded Qt5 package to ./sqldrivers/ QxEntityEditor package (for example, for Qt 5.9, SQLite is in version 3.16.1 ==> so recursive view and WITH keyword are available).