View Single Post
03-02-17, 03:19 PM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
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(db.global.frameTemplate)

    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:

http://www.wowinterface.com/download...o.php?id=24356

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.

Last edited by Mayron : 04-26-17 at 05:28 AM.
  Reply With Quote