SQL Database Support
Add support for SQL database to allow savegame with complex data structure. Import code from the old pixel board project. Create a driver for SQLite, revise the recordset structure, maybe make it immutable.
There is something tricky here when it will later be integrated with Pixel Board. The main input chanel from pixel board to the Black Book game is throught commands. By using a simple line of text to insert or launch process in the game.
But the database system is directly related to the output chanel. How does pixel board gets it's information from the game. If the SQL database is inside the game, then it needs a standard API to query information from the game.
In this case, it might just be easier that data is output as a recordset. Else I'll have to use JSON, text or another format to transfer the game data to output.
It would be much more simple, if all games required a database and that the code was part of Black Book. I don't think there is any need to have more than 1 database, since this DB is also the save game, there is no reason to split the information into multiple files.
There might be a data formatter, that takes a SQL record set and format it for text output. This would only be used for command line interfaces. Pixel Board will have it's own data formattter to adapt it for graphic interface.
Another solution would have been to put all output as text, and make pixel board use that text to create it's user interface. The advantage is what you see in text mode will be what you get in graphic mode. But the problem is that it will be visually restraining, so it might be easier to delegate the presentation somewhere else for more flexibility.
UPDATE: It is possible to store Views as long are their name does not start with numerals and only have Letters, numerals and underscore. It could be possible to store qeuries as view with names to use them with the SHOW command. The SQL command activated with the DEBUG command will allow any query. You can query the views available in the table sqlite_master where type ='view'. If could be used to show a list of available views to the user. Their ID could also be used for short typing.
TODO
- SQL driver for Sqliteforjava
- Recordset class to import. Probably immutable content.
- Add the "show" command with view display.
- Add a command line recordset formatter. Not a simple toString method since pixel board will generate widgets, unless I am also using text formatting for conveniency. Still, it could be an encoded text like HTML, so better use a formatter.
ISSUES
- There are some problems with sqlite4java and gradle because it require native dependencies and I have a hand time to make gradle download the native files by itself. It works for the code bu not for the binairies.