WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Standalone Database Library? (https://www.wowinterface.com/forums/showthread.php?t=56043)

Layback_ 02-14-18 07:47 AM

Standalone Database Library?
 
Hi all,

Title says pretty much all.

Ace3 and its Database module, AceDB, are definitely powerful libraries that I would use for a huge project.

However, I found using Ace3 is totally an overkill for my small project and thus I'm willing to find some kind of standalone database library that would manage the addon's SV.

Any suggestions?

Thank you!

Ammako 02-14-18 09:09 AM

What kind of SVs are you using, and do you care about profiles? You don't specifically need a library to manage them either.

I'd probably say that using any ace in a small project scenario is probably overkill in general, but if you have plenty of SVs and wanted easily-managed profiles, might as well just use Ace anyway. It'd be less trouble than implementing those manually.

Phanx 02-14-18 10:54 AM

I think you're laboring under a misapprehension... Ace3 is a family of standalone libraries. Each Ace(whatever)-3.0 library is totally independent of any of the others, with a few obvious exceptions (e.g. AceDBOptions doesn't do anything without both AceDB and one of the AceConfig* libraries to consume the options table it generates).

You can absolutely use just AceDB-3.0.

If you're using the CurseForge packager to pull in your libraries, rather than referencing the whole Ace3 repository in your .pgkmeta file, just list the sub-paths to the individual libraries you want to use:

Code:

externals:
  Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
  Libs/CallbackHandler-1.0: svn://svn.wowace.com/wow/callbackhandler/mainline/tags/1.0.6/CallbackHandler-1.0
  Libs/LibStub: svn://svn.wowace.com/wow/libstub/mainline/tags/1.0

(Note that this technique only works with SVN repos, not Git or Hg. Really, the Ace3 project should be split up so that each library has its own repo and project page, but that's not up to me!)

Rainrider 02-14-18 12:11 PM

Quote:

Originally Posted by Phanx (Post 326900)
Code:

externals:
  Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
  Libs/CallbackHandler-1.0: svn://svn.wowace.com/wow/callbackhandler/mainline/tags/1.0.6/CallbackHandler-1.0
  Libs/LibStub: svn://svn.wowace.com/wow/libstub/mainline/tags/1.0

(Note that this technique only works with SVN repos, not Git or Hg. Really, the Ace3 project should be split up so that each library has its own repo and project page, but that's not up to me!)

It definitely works for both git and svn, don't know about hg though. And curse switched to a new repo system. The proper URL for AceDB3 would be

Layback_ 02-14-18 05:47 PM

Quote:

Originally Posted by Phanx (Post 326900)
I think you're laboring under a misapprehension... Ace3 is a family of standalone libraries. Each Ace(whatever)-3.0 library is totally independent of any of the others, with a few obvious exceptions (e.g. AceDBOptions doesn't do anything without both AceDB and one of the AceConfig* libraries to consume the options table it generates).

You can absolutely use just AceDB-3.0.

If you're using the CurseForge packager to pull in your libraries, rather than referencing the whole Ace3 repository in your .pgkmeta file, just list the sub-paths to the individual libraries you want to use:

Code:

externals:
  Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
  Libs/CallbackHandler-1.0: svn://svn.wowace.com/wow/callbackhandler/mainline/tags/1.0.6/CallbackHandler-1.0
  Libs/LibStub: svn://svn.wowace.com/wow/libstub/mainline/tags/1.0

(Note that this technique only works with SVN repos, not Git or Hg. Really, the Ace3 project should be split up so that each library has its own repo and project page, but that's not up to me!)

Wait...

So, AceDB object doesn't necessarily be initialized via AceAddon's OnInitialize method?

That's a good news!

Layback_ 02-14-18 06:10 PM

Quote:

Originally Posted by Ammako (Post 326897)
What kind of SVs are you using, and do you care about profiles? You don't specifically need a library to manage them either.

I'd probably say that using any ace in a small project scenario is probably overkill in general, but if you have plenty of SVs and wanted easily-managed profiles, might as well just use Ace anyway. It'd be less trouble than implementing those manually.

I've not yet decided the actual scope of the addon, but I'm definitely willing to create something that loads SV per each classes which is like class data type of AceDB.

But, great news from Phanx that I won't need an AceAddon-3.0 to initialize AceDB object and I'll be using it :banana:

Phanx 02-14-18 11:10 PM

Quote:

Originally Posted by Layback_ (Post 326908)
So, AceDB object doesn't necessarily be initialized via AceAddon's OnInitialize method?

Nope!

Here's how you would adapt the example from the AceDB-3.0 documentation page to use it without AceAddon-3.0. Yellow parts are copied from the documentation:

Code:

-- declare defaults to be used in the DB
local defaults = {
  profile = {
    setting = true,
  }
}


-- Here we set up event handling, which as a happy coincidence,
-- replicates 99% of what anyone uses AceEvent for in just 3 lines of code:

local MyAddon = CreateFrame("Frame", ADDON_NAME)
MyAddon:SetScript("OnEvent", function(self, event, ...)
  return self[event](self, ...)
end)

-- Now we replicate the functionality of the OnInitialize method from
-- AceAddon-3.0 by registering for an event and declaring a function to handle it:

MyAddon:RegisterEvent("PLAYER_LOGIN")
function MyAddon:PLAYER_LOGIN()
  -- Assuming the .toc says ## SavedVariables: MyAddonDB
  self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, true)

end



All times are GMT -6. The time now is 03:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI