C Amalgamation – for SQLite

SQLite Logo
Image by CopyrightFreePictures from Pixabay

If I were to use a database in a game, it’s likely that it would be SQLite. It’s an open source SQL database that is 102 different C files and 32 others. Of those 102, 75% are C and the remainder header files.

Unlike many other SQL databases (for example MySQL, SQL Server, PostgreSQL) it doesn’t need to run as a separate server. It compiles directly into your application, adding a whopping 400 KB! (I’ve seen bigger picture files…)  It’s fast and very well tested. For every line of code there are 644 lines of test code! Details of testing here.

You wouldn’t use SQLite in an arcade game as it would be a bit of an overkill just to hold a high-score table, but in something like a Rogue or Mud game, I could easily see it being used to store rooms, corridors, treasures etc. SQLite is also very easy to use.

The word amalgamation means that all the 102 source files have been combined (amalgamated) into one file called SQLite3.c. So building it is a single command.

SQLite is probably the worlds most popular database. It’s found in most operating systems and is used in every smartphone.

Leave a Reply

Your email address will not be published. Required fields are marked *