Packageplayerio
Interfacepublic interface BigDB

Provides access to the BigDB service provided by Player.IO.



Public Methods
 MethodDefined By
  
createObject(table:String, key:String, data:Object, callback:Function = null, errorHandler:Function = null):void
Creates a new DatabaseObject in the given table with the specified key.
BigDB
  
deleteKeys(table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void
Delete a set of DatabaseObjects from a table
BigDB
  
deleteRange(table:String, index:String, path:Array, start:Object, stop:Object, callback:Function = null, errorHandler:Function = null):void
Delete a range of DatabaseObjects from a table using an index
BigDB
  
load(table:String, key:String, callback:Function = null, errorHandler:Function = null):void
Load the DatabaseObject with the given key from the given table.
BigDB
  
loadKeys(table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void
Loads the DatabaseObjects with the given keys from the given table.
BigDB
  
loadKeysOrCreate(table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void
Loads or creates DatabaseObjects with the given keys from the given table.
BigDB
  
loadMyPlayerObject(callback:Function = null, errorHandler:Function = null):void
Loads the DatabaseObject corresponding to the player from the PlayerObjects table
BigDB
  
loadOrCreate(table:String, key:String, callback:Function = null, errorHandler:Function = null):void
Loads or creates the DatabaseObject with the given key from the given table.
BigDB
  
loadRange(table:String, index:String, path:Array, start:Object, stop:Object, limit:int, callback:Function = null, errorHandler:Function = null):void
Load a range of DatabaseObjects from a table using the specified index.
BigDB
  
loadSingle(table:String, index:String, indexValue:Array, callback:Function = null, errorHandler:Function = null):void
Load a DatabaseObject from a table using the specified index.
BigDB
Method Detail
createObject()method
public function createObject(table:String, key:String, data:Object, callback:Function = null, errorHandler:Function = null):void

Creates a new DatabaseObject in the given table with the specified key. If no key is specified, the object will receive an autogenerated id.

Parameters

table:String — The table to create the DatabaseObject in.
 
key:String — The key of the newly created DatabaseObject
 
data:Object — Initial data of the DatabaseObject passed as an object.
 
callback:Function (default = null) — Function executed when the DatabaseObject has successfully been created. The newly created DatabaseObject is passed to the callback handler: function(o:DatabaseObject):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while creating the DatabaseObject

deleteKeys()method 
public function deleteKeys(table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Delete a set of DatabaseObjects from a table

Parameters

table:String — The table to delete the DatabaseObjects from
 
keys:Array — The keys of the DatabaseObjects to delete
 
callback:Function (default = null) — Function executed when the DatabaseObjects are successfully deleted. No arguments are passed to the the callback methoh.
 
errorHandler:Function (default = null) — Function executed if an error occurs while deleting the DatabaseObjects

deleteRange()method 
public function deleteRange(table:String, index:String, path:Array, start:Object, stop:Object, callback:Function = null, errorHandler:Function = null):void

Delete a range of DatabaseObjects from a table using an index

Parameters

table:String — The table to delete the DatabaseObject from
 
index:String — The name of the index to query for the DatabaseObjects to delete
 
path:Array — Where in the index to start the range delete: An array of objects of the same types as the index properties, specifying where in the index to start loading DatabaseObjects from. For instance, in the index [Mode,Map,Score] you might use new ["expert","skyland"] as the indexPath and use the start and stop arguments to determine the range of scores you wish to delete. IndexPath can be set to null instead of an empty array.
 
start:Object — Where to start the range delete. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then start defines the minimum score to delete
 
stop:Object — Where to stop the range delete. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then stop defines the maximum score to delete
 
callback:Function (default = null) — Function executed when the DatabaseObjects are successfully deleted. No arguments are passed to the the callback methoh.
 
errorHandler:Function (default = null) — Function executed if an error occurs while deleting the DatabaseObjects

load()method 
public function load(table:String, key:String, callback:Function = null, errorHandler:Function = null):void

Load the DatabaseObject with the given key from the given table.

Parameters

table:String — The table to load the DatabaseObject from
 
key:String — The key of the DatabaseObject to load
 
callback:Function (default = null) — Function executed when the DatabaseObject is successfully loaded: function(o:DatabaseObject):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading the DatabaseObject.

loadKeys()method 
public function loadKeys(table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Loads the DatabaseObjects with the given keys from the given table.

Parameters

table:String — The table to load the DatabaseObject from
 
keys:Array — Array of keys to load from the given table
 
callback:Function (default = null) — Function executed when the DatabaseObjects are successfully loaded. An array of DatabaseObjects are passed to the method: function(dbarr:Array):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading the DatabaseObjects

loadKeysOrCreate()method 
public function loadKeysOrCreate(table:String, keys:Array, callback:Function = null, errorHandler:Function = null):void

Loads or creates DatabaseObjects with the given keys from the given table. New objects are created if there are no existing objects for the given keys.

Parameters

table:String — The table to load the DatabaseObjects from
 
keys:Array — They keys of the DatabaseObjects to load
 
callback:Function (default = null) — Function executed when the DatabaseObjects are successfully loaded or created: function(dbarr:Array):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading or creating the DatabaseObjects

loadMyPlayerObject()method 
public function loadMyPlayerObject(callback:Function = null, errorHandler:Function = null):void

Loads the DatabaseObject corresponding to the player from the PlayerObjects table

Parameters

callback:Function (default = null) — Function executed when the object has loaded successfully: function(o:DatabaseObject):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading the DatabaseObject


Example
The following example loads the current players DatabaseObject
         client.bigDB.loadMyPlayerObject(function(myDBObject:DatabaseObject):void{
             trace("Loaded", myDBObject)
         })
         
loadOrCreate()method 
public function loadOrCreate(table:String, key:String, callback:Function = null, errorHandler:Function = null):void

Loads or creates the DatabaseObject with the given key from the given table.

Parameters

table:String — The table from which to load or create the DatabaseObject
 
key:String — The key of the DatabaseObject to load or create
 
callback:Function (default = null) — Function executed when the DatabaseObject is successfully loaded or created: function(o:DatabaseObject):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading or creating the DatabaseObject

loadRange()method 
public function loadRange(table:String, index:String, path:Array, start:Object, stop:Object, limit:int, callback:Function = null, errorHandler:Function = null):void

Load a range of DatabaseObjects from a table using the specified index.

Parameters

table:String — The table to load the DatabaseObject from
 
index:String — The name of the index to query for the DatabaseObject
 
path:Array — Where in the index to start the range search: An array of objects of the same types as the index properties, specifying where in the index to start loading DatabaseObjects from. For instance, in the index [Mode,Map,Score] you might use ["expert","skyland"] as the indexPath and use the start and stop arguments to determine the range of scores you wish to return. IndexPath can be set to null if there is only one property in the index.
 
start:Object — Where to start the range search. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then start defines the minimum score to include in the results
 
stop:Object — Where to stop the range search. For instance, if the index is [Mode,Map,Score] and indexPath is ["expert","skyland"], then stop defines the maximum score to include in the results
 
limit:int — The max amount of objects to return
 
callback:Function (default = null) — Function executed when the DatabaseObjects are successfully loaded: An array of DatabaseObjects are passed to the method: function(dbarr:Array):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading the DatabaseObjects

loadSingle()method 
public function loadSingle(table:String, index:String, indexValue:Array, callback:Function = null, errorHandler:Function = null):void

Load a DatabaseObject from a table using the specified index.

Parameters

table:String — The table to load the DatabaseObject from
 
index:String — The name of the index to query for the DatabaseObject
 
indexValue:Array — An array of objects of the same types as the index properties, specifying which object to load
 
callback:Function (default = null) — Function executed when the DatabaseObject is successfully loaded: function(o:DatabaseObject):void{...}
 
errorHandler:Function (default = null) — Function executed if an error occurs while loading the DatabaseObject