Página 1 de 1

Sqlite datasource for DBBrowse

Publicado: Vie Ene 21, 2022 12:40 am
por DC
Speaking of things I don't know how to do, how do we connect a Sqlite Dataset to a TDBBrowse?

7 minutes after the last post, I discovered I don't know how to add a defined Sqlite source to a TDBBrowse.

The existing Sqlite database is pointed to with the oConnect property in the TDBrowse. But the oDataSet property of the TDBBrowse won't accept the Sqlite Data Source oSqlite_AllFiles.

It doesn't show it in the picklist, and won't accept if it if it's typed manually.

The only table in the Sqlite database has more than 10 million records. Will that be a problem?
TDBBrowse_oDataSet.jpg
TDBBrowse_oDataSet.jpg (93 KiB) Visto 1492 veces

Re: Sqlite datasource for DBBrowse

Publicado: Vie Ene 21, 2022 2:35 am
por Hurricane
Hi,

1 - In TSQLiteDataSouce:
assign the full name of the DB file (:cConnect)

2 - add TSQLQuery:
define SQL statement (:cSelect)
assign/select the DataSource (:oDataSource)
activate (:lOpen) *

3 - In TDBBrowse:
assign/select the TSQLQuery (:oDataSet)
If there are no columns in the browse, they will be created automatically in the designer.

* Activate via code. You can enable via designer to see the data, but prefer to generate the EXE with this property disabled.
SQLQuery.png
SQLQuery.png (13.92 KiB) Visto 1487 veces
Also see the examples:
Xailer\SAMPLES\DataControls\SQLite1
Xailer\SAMPLES\DataControls\SQLite2

Re: Sqlite datasource for DBBrowse

Publicado: Dom Ene 23, 2022 6:33 pm
por DC
Thanks, Hurricane. All that makes sense.

Unfortunately, when I try to active the query, about 7 seconds after Selecting lOpen = T, in the tSqlQuery Object, Xailer Enterprise abruptly exits, without saving the setting or popping up a warning.

I'll try shortening the number of rows, in case this is some kind of Virtual Memory issue.



There's also a linking problem. I won't worry about it until all the components are working, but am getting

Compiling: frm_AllFiles.prg...
Linking: SqliteViewer.exe...
C:/Xailer/Lib/libxailer.a(ISQLite.o):(.text+0x3b): undefined reference to `sqlite3_value_type'
C:/Xailer/Lib/libxailer.a(ISQLite.o):(.text+0x78): undefined reference to `sqlite3_value_text'
C:/Xailer/Lib/libxailer.a(ISQLite.o):(.text+0x88): undefined reference to `sqlite3_value_text'
...
and related errors.

1 Files, 0 Warnings, 162 Errors
Compile time: 0.70s Link time: 1.86s Total time: 2.57s

The project is probably not pointing to a library that's mentioned in the docs. This is the first time I tried using the Sqlite components, in a form. Everything else has been in code.


Anyway, thanks Hurriance. You got me a little further. I always expect a few hurdles, and trial & error, the first time around.


(Edit: The problem was the number of rows. It was about 17 million. That's fine, I can partition out this particular table into multiple tables)

Re: Sqlite datasource for DBBrowse

Publicado: Dom Ene 23, 2022 9:42 pm
por ignacio
Hi,

I suppose you have included the sqlite library in your project. In case yes, please try to run any SQLite sample and tell us your results.

Regards,

Re: Sqlite datasource for DBBrowse

Publicado: Mié Ene 26, 2022 4:23 pm
por DC
ignacio escribió: Dom Ene 23, 2022 9:42 pm Hi,

I suppose you have included the sqlite library in your project. In case yes, please try to run any SQLite sample and tell us your results.

Regards,
Thanks Ignacio,

I just checked on the sqlite library, and everything is compiling without errors.