Thread Tools Display Modes
02-14-18, 07:47 AM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
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!

Last edited by Layback_ : 02-14-18 at 07:52 AM.
  Reply With Quote
02-14-18, 09:09 AM   #2
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
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.
  Reply With Quote
02-14-18, 10:54 AM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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!)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-14-18, 12:11 PM   #4
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Originally Posted by Phanx View Post
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
  Reply With Quote
02-14-18, 05:47 PM   #5
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by Phanx View Post
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!
  Reply With Quote
02-14-18, 06:10 PM   #6
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by Ammako View Post
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
  Reply With Quote
02-14-18, 11:10 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Layback_ View Post
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
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 02-14-18 at 11:15 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Standalone Database Library?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off