ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Correct. SQLite is an SQL database and arranges the data in 2D arrays (tables) but BerkeleyDB is a key-value database and thus a different animal. I was hoping there would be a fork of BerkelyDB hiding somewhere or something similar yet packaged for APT.
YottaDB could be an alternative, it is a key-value database, but there is not an APT package for it. I myself can install it no problem but those I would hand off to would not enjoy an unpackaged db. Maybe that's on them though.
I'm not familiar with BerkeleyDB, but when I want non-relational key-value stuff I'll usually go with either a simple ini file or with Redis - there's a handful of Perl libraries.
(It also happens to be the first response to searching key value perl, which might provide other candidates if Redis isn't suitable for whatever reason.)
“BerkleyDB” is basically what we old-schoolers would refer to as “ISAM = Indexed Sequential Access Method.” It provided only the primitive ability to find a single record based on a single key.
If you are still encountering such software in service, it is time to rewrite it. And “SQLite” is now the appropriate solution. You can implement the remedy “a step at a time.”
Last edited by sundialsvcs; 01-20-2024 at 09:59 AM.
After looking around, including at my own scripts, I guess the answer for most use-cases will be SQLite.
For other situations, such as nested comment hierarchies and controlled vocabulary taxonomies, something else is probably better. Though by making convoluted queries one can force a hierarchy from a table.
You can certainly use an SQL table to create the "ISAM" model. You don't make direct calls to low-level subroutines. Instead, you submit a query, and SQLite does the hard work for you. It has a "very solid" shared-file implementation that works on and across all platforms, and "it just works." You will find that your replacement code is much simpler than what Berkely required.
Bear in mind that:"transactions" are very important when working with SQLite. This is what will give you the "'lazy' read/write" behavior that you are probably used to. Without it, SQLite will physicallycommit every write – waiting for it to complete – and will not "buffer" anything when reading. The result is much slower performance than you might otherwise expect. But, it is designed that way. (Most database interfaces provide a convenient "auto-transactions" feature. Use it.) When you do the right thing the right way, SQLite is a speed demon.
Last edited by sundialsvcs; 02-10-2024 at 08:46 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.