WoWInterface (
-   General Authoring Discussion (
-   -   Created a new database Library (

Mayron 03-02-17 03:19 PM

Created a new database Library
For a while my UI has been using my own database library, but now I have modified it for general use.

It has additional functionality compared to the standard AceDB that you might find interesting:
  1. You can append default values onto a defaults table.
  2. You can use database table inheritance (very useful):

    Lua Code:
    1. db.profile.aFrame:SetParent(

    This means that if a value cannot be found in the "aFrame" database table, then it will get it from the parent database table.
    This allows you to make templates that many tables inherit from. This has many advantages compared to using the defaults
    table; You can customise the template using your own config menu to apply changes to all objects that inherit from it, and
    all the changes are persistent.

  3. The database framework uses metatables to automatically select and retrieve the appropriate values automatically for you using a three step pattern:

    1. Check if the key/value pair is located in the saved variable table.
    2. If not found, check if the key/value pair is located in the defaults table.
    3. If not found, check if the Observer has a parent. If it does, repeat step 1 using the parent Observer.

  4. You can parse and set database values using path addresses (stringns) to query values from the database:

    Lua Code:
    1. value = db:ParsePathValue("global.core.settings["..moduleName.."][5]")
    2. db:SetPathValue("profile.aModule.aSubTable", value)
  5. You can remove and restore profiles in case users accidentally removed the wrong profiles.

It has proven to be very useful for my projects so if any of these features seem useful for your needs then
feel free to give it a go and let me know what you think:

EDIT: Just updated it to support many databases running simultaneously using db:CreateDatabase() method.
The new version requires a different way of setting it up and starting the database. Information is on the download page.

Mayron 04-26-17 05:05 AM

Updated this library to make it much more user friendly. Also, the documentation on the download page is much nicer to read and understand.

Functions have been renamed, an OnStart function has been added so that the database starts automatically after the AddOn using the database has been successfully loaded, and more helpful functions have been added.

All times are GMT -6. The time now is 12:47 PM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI