wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database(); Topic is solved

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Post Reply
Wolfgang
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Jan 28, 2019 8:22 am

wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();

Post by Wolfgang » Fri Feb 01, 2019 6:12 am

Hello

I would need something similar to:

Code: Select all

wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();
I want to have open a lot of databases at once, it is for a bible programm, and keeping everything in memory would take too much space, at least I think so.
How would it be possible to achieve something similar.
And what is the limit on open wxsqlite3 Databases?

User avatar
doublemax
Moderator
Moderator
Posts: 13316
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();

Post by doublemax » Fri Feb 01, 2019 8:20 am

One database is enough. The database file can be as big as you like.

And BTW i found "Martin_Luther_Uebersetzung_1912.txt" and it's less than 5mb. I think memory size won't be a problem.
Use the source, Luke!

utelle
Moderator
Moderator
Posts: 842
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();

Post by utelle » Fri Feb 01, 2019 8:43 am

Wolfgang wrote:I would need something similar to:

Code: Select all

wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();
In principal you could allocate an array of wxSQLite3Database objects with the following statement:

Code: Select all

wxSQLite3Database* h_dbi = new wxSQLite3Database[1024]();
// Open first connection
h_dbi[0].Open(...);
However, you would still have to open these database instances one by one using the Open method.
Wolfgang wrote:I want to have open a lot of databases at once, it is for a bible programm, and keeping everything in memory would take too much space, at least I think so.
Do you really have many separate database files? This smells like a bad design for your application.

Usually, one has a single database (or a small number of databases) each holding tables with the actual information. You access the information by querying the requested items from one or more tables.
Wolfgang wrote:How would it be possible to achieve something similar.
The best approach would be to organize the information within a reasonable small number of databases. The number of tables in a database is not limited. However, you can't join more than 64 tables in a single query.
Wolfgang wrote:And what is the limit on open wxsqlite3 Databases?
This is not a limitation of wxSQLite3Database, but a limitation of the underlying operating system. Most operating systems have limitations on the maximum number of files which can be open at the same time. Since SQLite databases are ordinary files, such a limitation holds true for databases as well.

SQLite3 allows to attach database files to a database connection. The default maximum number of attached databases is 10, but it can be changed to a higher number up to 125.

Regards,

Ulrich

Wolfgang
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Jan 28, 2019 8:22 am

Re: wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();

Post by Wolfgang » Fri Feb 01, 2019 8:52 am

doublemax wrote:One database is enough. The database file can be as big as you like.

And BTW i found "Martin_Luther_Uebersetzung_1912.txt" and it's less than 5mb. I think memory size won't be a problem.
With additional informatin like strongs numbers, versenumbers chapter book, and everything inseperate fields, it easily grows to 40mb. And that is for just one translation, furthermore, dictionaries easily go up to 100mb per dictionary.

And adding new translations is easier if in seperate files.

utelle
Moderator
Moderator
Posts: 842
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSQLite3Database* h_dbi[1024] = new wxSQLite3Database();

Post by utelle » Fri Feb 01, 2019 9:17 am

Wolfgang wrote:With additional informatin like strongs numbers, versenumbers chapter book, and everything inseperate fields, it easily grows to 40mb. And that is for just one translation, furthermore, dictionaries easily go up to 100mb per dictionary.
So what?! The theoretical size limit for a SQLite database is roughly 140 terabytes. How many translations do you have in mind? And do you need access to all of them at the same time?

Your actual database design really would depend on what exactly you want to accomplish.
Wolfgang wrote:And adding new translations is easier if in seperate files.
Of course, you could have a separate database file for each translation. However, if you choose that approach your application should limit the number of translations accessible at the same time to a reasonable number. I doubt that anybody needs simultaneous access to all available translations.

Regards,

Ulrich

Post Reply