User:AerialX/Coding Sandbox/SQLite

From WiiBrew
Jump to navigation Jump to search

This is a Wii port of the SQLite library - a lightweight SQL library for working with flat configuration files. It's a cross-platform library, and only took slight modifications to the unix platform code to compile and execute on the Wii. However, it currently only works in single-threaded mode and any commands that attempt to write to a database fail with an error: "unable to open database file"

If anyone knows how it could be fixed, I would be greatly appreciative. I will look into it sometime (I intend on using SQLite as the configuration backend for my upcoming project), but right now I lack the time. I recently found out that DrTwox was apparently working on a port but I've not seen mention of it since.

Download

The download contains SQLite's modified source code complete with a Makefile, as well as a precompiled static library. It also contains the sources and binary of a simple example program. The supplied binaries were compiled with devkitPPC r15, libogc r20080602, and libfat r20080530 on Linux x86_64.

Download

Usage

The library works as explained in the documentation. To specifically use my sample you must use the homebrew channel and wiiload to send arguments.

Quick steps:

  1. Copy the supplied test.db file to your SD card (I'll assume its location is /test.db)
  2. Open up the homebrew channel on your Wii, and assuming you have wiiload set up for use, run the command wiiload sqlite.dol "/test.db" "SELECT * FROM lolwut;" to see the contents of my example database.

You may supply any database path or commands that you wish, but be aware that any SQL commands that attempt to write data will fail. I made the test database with the sqlite3 CLI app.

template.c

I won't bother showing the source of the app here; there's nothing special about it. It's just SQLite's Quickstart Guide example code plugged on to a stock Wii template.