Forum BigDB Loading all objects from a table

Discussion and help relating to Player.IO's database solution, BigDB.

Loading all objects from a table

Postby MrBiscuits » December 22nd, 2011, 7:49 pm

Stupid question number 34.

Is there a way of loading all the objects from a table and into an array?
All the methods seem to need specific keys to get the data, but I want to get all of them.
MrBiscuits
Paid Member
 
Posts: 26
Joined: May 15th, 2011, 8:09 pm

Re: Loading all objects from a table

Postby Henrik » December 22nd, 2011, 10:35 pm

We highly discourage that, which is why it's difficult. What are you trying to do?

If you want to load a range of objects, you have to have an index on it that covers the objects you want to load:
http://playerio.com/documentation/refer ... #LoadRange
User avatar
Henrik
.IO
 
Posts: 570
Joined: January 4th, 2010, 1:53 pm

Re: Loading all objects from a table

Postby MrBiscuits » December 23rd, 2011, 2:21 pm

I have a small database of templates which the user loads in once (and loads all of them). After that the user just loads in instance data for that type of object from the server that only contains variables that can change.

For example I have monster templates that contain about 30 fields, but after loading that in once the user just needs to only load in the monster level and type per instance and the client can figure out the rest.
MrBiscuits
Paid Member
 
Posts: 26
Joined: May 15th, 2011, 8:09 pm

Re: Loading all objects from a table

Postby Henrik » December 23rd, 2011, 7:07 pm

Ok, but in that case you should know all the keys, right? And then the best way is to use the LoadKeys method to just load all of those objects at once:
http://playerio.com/documentation/refer ... b#LoadKeys
User avatar
Henrik
.IO
 
Posts: 570
Joined: January 4th, 2010, 1:53 pm

Re: Loading all objects from a table

Postby MrBiscuits » December 23rd, 2011, 8:10 pm

Ok thanks I'll do that.

I'll just have to make sure the list on the client side is always updated whenever I add or delete a template on the server.
MrBiscuits
Paid Member
 
Posts: 26
Joined: May 15th, 2011, 8:09 pm


Return to BigDB