Change default number of attached databases
Change default number of attached databases
It seems that SQLite allows 125 databases to be attached however, the default is 10. How do you change this default value to something slightly higher?
Thanks
Thanks
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
Re: Change default number of attached databases
Hi,Columbo wrote:It seems that SQLite allows 125 databases to be attached however, the default is 10. How do you change this default value to something slightly higher?
Thanks
I may be wrong, but I believe that is a compile-time limitation. However, you can lower the number of connected databases by calling "sqlite3_limit".
Sent from my Moto E (4) using Tapatalk
Re: Change default number of attached databases
I want to increase the number higher than 10. I'm not sure how to do this or what the syntax would be if it is a compile-time limitation?
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
Re: Change default number of attached databases
You will need to re-compile the Sqlite source code and increase the value for the SQLITE_MAX_ATTACHED manifest constant. By default, it is set to 10.Columbo wrote:I want to increase the number higher than 10. I'm not sure how to do this or what the syntax would be if it is a compile-time limitation?
Sent from my Moto E (4) using Tapatalk
Re: Change default number of attached databases
Where do I find the SQLite source and what compiler is it compiled with? I thought that SQLite was installed with PB?You will need to re-compile the Sqlite source code and increase the value for the SQLITE_MAX_ATTACHED manifest constant. By default, it is set to 10.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
Re: Change default number of attached databases
SQLite is built into PureBasic. However, if you wish to customize SQLite, you will need to modify the canonical source code. You will also need a C compiler. You can get more information about that here:Columbo wrote:Where do I find the SQLite source and what compiler is it compiled with? I thought that SQLite was installed with PB?You will need to re-compile the Sqlite source code and increase the value for the SQLITE_MAX_ATTACHED manifest constant. By default, it is set to 10.
https://SQLite.org/getthecode.html
https://SQLite.org/howtocompile.html
If you want to use the above approach, you will most likely have to use SQLite as a dll.
Sent from my Moto E (4) using Tapatalk
Last edited by percy_b on Wed Jun 05, 2019 11:02 pm, edited 1 time in total.
Re: Change default number of attached databases
Thank you for your help. I don't know why they allow 125 attachments but set it to default to 10 and then make it so difficult to change the default.
It would be great if you could just use something like this in Purebasic:
Oh well, I guess I'll have to find another way to handle this problem.
Thanks again.
It would be great if you could just use something like this in Purebasic:
Code: Select all
UseSQLiteDatabase()
Set SQLITE_MAX_ATTACHED = 18
Thanks again.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
Re: Change default number of attached databases
Are you sure this is a real world problem?
Why would you want to attach to that many databases simultaneously? Remember, you can always detach and re-attach...
Why would you want to attach to that many databases simultaneously? Remember, you can always detach and re-attach...
PB 5.73 on Windows 10 & OS X High Sierra
Re: Change default number of attached databases
It is for a recipe program which has a categories database with subcategories attached. I guess detaching and re-attaching is an option but it seemed much easier and less coding to be able to attach all of the subcategories.Why would you want to attach to that many databases simultaneously? Remember, you can always detach and re-attach...
Thanks for the suggestion. I'll play with it a bit.
http://www.oldtimeradiotoday.com - Listen to or download classic old time radio broadcasts.
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Change default number of attached databases
I might have missed your point but why do the categories need to be in another database? I wrote a recipe manager years ago with a lot of help (as usual) and the categories are in the same database but a separate table in the same database. They don't need another database to function and none of the commercial programs do it that way.Columbo wrote:It is for a recipe program which has a categories database with subcategories attached. I guess detaching and re-attaching is an option but it seemed much easier and less coding to be able to attach all of the subcategories.Why would you want to attach to that many databases simultaneously? Remember, you can always detach and re-attach...
Thanks for the suggestion. I'll play with it a bit.
I analysed Living Cookbook, Paprika and Mastercook's databases and their their related tables are in the one database and joined by queries.
Just wondering.
Amateur Radio, D-STAR/VK3HAF
Re: Change default number of attached databases
I am with Fangbeast on this one:
These should be different tables in the same database...
These should be different tables in the same database...
PB 5.73 on Windows 10 & OS X High Sierra
Re: Change default number of attached databases
I have use cases where attached db's approach 10 or 12. It should default to a higher count. But, we can now recompile with all our custom settings and choose the resulting dll in usesqlitedatabase().
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum