News for hackers. Stuff that matters.
Re:Why SQLite succeeded as a database (2016) by outworlder on Wednesday February 19, 2020 @02:38PM (#22369190)
One thing that I wish more people realized, especially ones developing native apps, is this: unless you really need an specific file format for your application, don't design your own. Just use SQLite. You get so much out of it (including features like undo), as well as a huge toolkit.
Re:Why SQLite succeeded as a database (2016) by combatentropy on Wednesday February 19, 2020 @04:34PM (#22370340)
"SQLite does not compete with client/server databases. SQLite competes with fopen()." --- https://www.sqlite.org/whentouse.html
Re:Why SQLite succeeded as a database (2016) by kalleboo on Wednesday February 19, 2020 @11:03PM (#22372586)
Even Apple, home of not-invented-here, built their "Core Data" object storage API (which is extremely prevalent throughout iOS and macOS apps) using SQLite as a backing store.
Re:Why SQLite succeeded as a database (2016) by flukus on Wednesday February 19, 2020 @11:40PM (#22372718)
And you lose the ability to quickly change settings in a text editor, to have multiple settings files, to have tiered (system, local, project) settings files, to version them in source control, etc. Instead of learning ini, josn and xml you'll have to learn whatever schema project x uses and there will be more schemas than file formats. Plus SQLite might be fast, but it's still a lot more overhead than parsing an ini file.
Re:Why SQLite succeeded as a database (2016) by gwbas1c on Thursday February 20, 2020 @11:00AM (#22375959)
> unless you really need an specific file format for your application

It's all about choosing the right tool for the job.

There's great reasons to use xml files over SQLite, but that mostly comes down to needing a file to be human readable versus file size.

In the product that I work on, I moved very small tables out to xml files because it's easier to inspect them in a text editor instead of expecting non-developers to figure out a database. These files are also small enough and are written infrequently enough that any performance difference between xml and SQLite is negligible.

The vast majority of data is in SQLite. An older version of the product would always write out a giant xml file, but when the xml got big, performance suffered. In this case, SQLite is the correct choice because it can make a small change to the database without needing to rewrite the entire file.

Re:Why SQLite succeeded as a database (2016) by imtringued on Thursday February 20, 2020 @10:26AM (#22375682)
Why are you comparing schemas to file formats? Those configuration files still have their own user defined schemas.
Re:Why SQLite succeeded as a database (2016) by ric2b on Thursday February 20, 2020 @01:20PM (#22377227)
> And you lose the ability to quickly change settings in a text editor

There are plenty of SQL CLI/GUI clients that support SQLite.

But if you need end users to be able to change some configurations sure, move those to standalone files and parse them.

Re:Why SQLite succeeded as a database (2016) by int_19h on Thursday February 20, 2020 @10:55PM (#22380832)
You don't lose the ability to have multiple or tiered settings files - there's nothing preventing you from using as many SQLite database files as you want.

The other points are valid, but not everything can be shoehorned into JSON or XML. Sometimes the data size is too large for the read-everything-into-memory approach. Sometimes you need to deal with a lot of binary blobs. And so on.

Re:Why SQLite succeeded as a database (2016) by jimis on Wednesday February 19, 2020 @05:38PM (#22370863)
> (including features like undo)

Can you please elaborate on this?

Re:Why SQLite succeeded as a database (2016) by g82918 on Wednesday February 19, 2020 @07:45PM (#22371755)
Transaction rollback is probably what he meant. If that is a familiar topic to you the relation to undo should make sense and his point should be clear. If that doesn't make sense, look up ACID, Transactions, and Migrations in the context of a database.
Re:Why SQLite succeeded as a database (2016) by hinkley on Wednesday February 19, 2020 @11:32PM (#22372690)
I had a different interpretation. It's not uncommon in commercial code to use a sort of copy-on-write behavior where every edit creates a new row and marks the other one as dead (for instance, filling in or blanking out a column to mark it defunct). You leave an audit trail behind.

Which, with a little bit of work, can be used to revert to earlier versions.