Forum BigDB two nooby DatabaseArray questions

Discussion and help relating to the PlayerIO database solution, BigDB.

two nooby DatabaseArray questions

Postby carsonmorton » June 5th, 2012, 9:31 pm

if I have this array: [thing1, thing2, null, null, thing3, thing4]
if I call Count(), will it return 4 (doesn't include the null spaces) or 6 (includes the null spaces)?

and if I call Add(thing5)
will it do this: [thing1, thing2, null, null, thing3, thing4, thing5]
or this: [thing1, thing2, thing5, null, thing3, thing4]
carsonmorton
 
Posts: 39
Joined: April 24th, 2012, 3:12 am

Re: two nooby DatabaseArray questions

Postby Henrik » June 6th, 2012, 2:36 pm

Question 1: 6

Question b: The first alternative. Add() puts the object at the end. Insert() inserts it at the position, and moves all holes and objects forward, and Set() overwrites the object or hole at the position you specify.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: two nooby DatabaseArray questions

Postby carsonmorton » June 6th, 2012, 6:30 pm

Thanks Henrik
carsonmorton
 
Posts: 39
Joined: April 24th, 2012, 3:12 am

Re: two nooby DatabaseArray questions

Postby carsonmorton » August 3rd, 2012, 8:01 pm

ok, here's another question:

when I call RemoveAt(index) will it leave behind a null object?
[thing1, null, thing3]
or will it leave an empty space?
[thing1, , thing3]
carsonmorton
 
Posts: 39
Joined: April 24th, 2012, 3:12 am

Re: two nooby DatabaseArray questions

Postby Benjaminsen » August 31st, 2012, 7:11 am

carsonmorton wrote:ok, here's another question:

when I call RemoveAt(index) will it leave behind a null object?
[thing1, null, thing3]
or will it leave an empty space?
[thing1, , thing3]


Try it ;)
As fare as I remember it pops the object from the array, not leaving behind a space, similar to splice in as3.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to BigDB