So Currently, in my own project I had the need for a high(er) level interface to a local SQL Lite database, beyond the basic implementation that will be offered in 4.6.
My goals were to include:
An easy way to query a local database through Blueprints.
A code first approach. You create classes that inherit from ChimeraSqlEntity, and a database is created automatically.
The result is an easy way to query a Sql Lite database from within blueprints (and from C++):
I’m considering on releasing the code for this plugin after 4.6 release if people are interested in using it. The plugin is capable of the following features atm:
- Creating a Database through the Editor automatically using classes that Inherit from ChimeraSqlEntity. It currently supports basic Property types “FString, int, floats ect”. It will skip over non supported ones.
- In the event you rename, or add properties, you can reimport your database, it will migrate over the data automatically to the new tables created as a result. (Database is backed up automatically in the case of any issues)
- Using MetaData on properties you can specify indexes to be created.
- Using C++ or Blueprints you can Query for a Specified Entity using Where, Order By, Take, functions, and execute the Query with Count, ToArray, or First functions.
What it will NOT do:
- Currently, there is no support for inserting data, my intent when originally creating this plugin was it for it to be source of static data that would be shipped with the game. However, I may add support for inserting in the near future as it wouldn’t be very difficult.
- There is absolutely NO Security in this Plugin. This plugin was designed to be used against a local database, with insensitive information. As such I have done nothing to protect the code from SQL injection, though I do plan on improving this aspect at least some (you know in case of Bobby Drop Tables!).
- Relationships are not loaded in automatically but this is on my plate to make happen. So instead of two queries to get a relationship off a table, you could do it in one.
If anyone is interested in this plugin, please let me know, and I will put it up after 4.6 on github (it relies on the SQLiteDatabaseSupport module)