AceDB-3.0 Documentation Draft

Getting a hold of AceDB:

local AceDB = LibStub:GetLibrary("AceDB-3.0")
local AceDB = LibStub("AceDB-3.0")

Available Datatypes

char
	- Character-specific data. No other characters can access or change this data, it is specific to one character and one character alone.
realm
	- Realm-specific data. All of the players characters on the same realm share this database.
class
	- Class-specific data. All of the players characters of a certain class share this database.
race
	- Race-specific data. All of the players characters of a certain race share this database.
faction
	- Faction-specific data. All of the players characters of a certain faction share this database.
factionrealm
	- Faction and realm specific data. All of the players characters on the same realm and in the same faction share this database.
profile
	- Profile-specific data. All characters using the same profile share this database. Every character can select its own profile, or they can all share one.
global
	- Global Data. All characters on the same account share this database.

Usage Documentation

[code]
-- creating a database object on top of our SavedVariables Var
local db = AceDB:New("MyAddonDB")

-- now save some value to our profile
db.profile.firstValue = 1
db.profile.secondValue = 2

-- and some data to our charecter based data
db.char.firstValue = 1

[/code]

You can access all datatypes in the same way:
DBObject.<datatype>.key = value



AceDB-3.0 API:

AceDB:New( tbl[, defaults[, defaultprofile]] )
	tbl (string or table) - target table to store our DB in, either string pointing to a global table (your addons SV table), or a direct table reference
	[defaults] (table) - reference to the defaults table
	[defaultprofile] (string) - default profile to start with on an empty DB (defaults to character)
Returns a new DBObject encapsulating the specified "tbl"


DBObject API:

DBObject:RegisterDefaults( [defaults] )
	[defaults] (table) - A table of defaults for this database
Sets the defaults table for the given database object by clearing any that are currently set, and then setting the new defaults, if specified.
Calling db:RegisterDefaults() without specifying a defaults table will remove all defaults from the table.

DBObject:SetProfile( name )
	name (string) - The name of the profile to set as the current profile
Changes the profile of the database and all of it's namespaces to the supplied named profile

DBObject:GetProfiles( [tbl] )
	[tbl] (table) - A table to store the profile names in (optional)
Returns a table with the names of the existing profiles in the database.
You can optionally supply a table to re-use for this purpose.

DBObject:GetCurrentProfile()
Returns the current profile name used by the database

DBObject:DeleteProfile(name)
	name (string) - The name of the profile to be deleted
Deletes a named profile.  This profile must not be the active profile.

DBObject:CopyProfile(name)
	name (string) - The name of the profile to be copied into the current profile
Resets the current profile and copies the specified profile into the current profile.

DBObject:ResetProfile()
Resets the current profile

DBObject:ResetDB(defaultProfile)
	defaultProfile (string) - The profile name to use as the default
Resets the entire database, using the string defaultProfile as the new default profile.

DBObject:RegisterNamespace(name [, defaults])
	name (string) - The name of the new namespace
	defaults (table) - A table of values to use as defaults
Creates a new database namespace, directly tied to the database.  This
is a full scale database in it's own rights other than the fact that
it cannot control its profile individually.
Returns a new DBObject pointing to the namespace.


Defaults Table Documentation:

