Forum BigDB Not possible to copy DatabaseObjects between tables?

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

Not possible to copy DatabaseObjects between tables?

Postby wildbunny » July 8th, 2011, 10:35 am

Hi guys,

So in order to at least have some kind of way to protect myself against losing data when writing to BigDB in RoomClosed(), I'm trying to do a back-up of objects from one table into another as soon as they're loaded.

But, all it saves is a blank object with the given key.

Code: Select all
PlayerIO.BigDB.Load(DatabaseTableNames.Rooms, roomIdToLoad, (dbo) =>
{
    PlayerIO.BigDB.CreateObject(<a different table name>, dbo.Key, dbo, resultDbo => { }, OnDatabaseError);
}


Help? I'm running out of ideas now.... :|

Cheers, Paul.
wildbunny
 
Posts: 217
Joined: March 9th, 2011, 10:35 am

Re: Not possible to copy DatabaseObjects between tables?

Postby Oliver » July 11th, 2011, 1:31 pm

Woarh... I'm not sure that'll work. I suppose it should work... I'll add it to the todo list.

I think you'll have to manually copy the properties of the object over to an empty database object and save that, for now, as a workaround.

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Not possible to copy DatabaseObjects between tables?

Postby Oliver » July 11th, 2011, 1:32 pm

Also, i'm not sure how that will protect you from loosing data?

Saves on RoomClose just won't complete -- they'll never partially complete.

- Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Not possible to copy DatabaseObjects between tables?

Postby wildbunny » July 11th, 2011, 1:47 pm

Oliver wrote:Also, i'm not sure how that will protect you from loosing data?

Saves on RoomClose just won't complete -- they'll never partially complete.

- Oliver


Well, because I was using DeleteKeys followed by CreateObject, I could end up with deleted data. I've now switched to LoadOrCreate() followed by Save(), so I shouldn't loose data completely at least :)

I tried to write a routine to copy one dbo from table to table, but its impossible because you can't tell what type each property is...

Cheers, Paul.
wildbunny
 
Posts: 217
Joined: March 9th, 2011, 10:35 am

Re: Not possible to copy DatabaseObjects between tables?

Postby Oliver » July 11th, 2011, 2:10 pm

Isen't there a way to enumerate properties as Objects? I can't remember.

- Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Not possible to copy DatabaseObjects between tables?

Postby wildbunny » July 11th, 2011, 2:29 pm

Oliver wrote:Isen't there a way to enumerate properties as Objects? I can't remember.

- Oliver


You can enumerate them as string names, but I couldn't find a way to get the type out....
wildbunny
 
Posts: 217
Joined: March 9th, 2011, 10:35 am

Re: Not possible to copy DatabaseObjects between tables?

Postby markloika » July 12th, 2011, 9:15 pm

In regard to saving never partially completing - I think it happens on very rare occasion. With Block Miner v1 (with it saving the entire 200x200 world at once) there have been a few cases where the world object only saved partially, which has resulted in player's worlds cut at some vertical line, where everything to the right of that vertical line simply doesn't exist anymore.

With Block Miner v2, it has been completely re-written, so everything is done in 50x50 chunks, which is very manageable and has caused no aborts thus far. It has been tested to work with worlds up to 3200x100 (that's 128 50x50 chunks!) with no issues.

Mark
markloika
 
Posts: 76
Joined: July 8th, 2010, 3:46 am


Return to BigDB



cron