store UserVariables in one call

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
agrios
Posts: 18
Joined: 20 Oct 2010, 20:42

store UserVariables in one call

Post by agrios »

We are planing to store all the user's variables in one field of H2 database if possible. I think there will be some strings and integers in it, so we probably use Actionscript object.

Is it a good idea or there are better ways?
What is recommended or proven method?
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

I would use one column per variable, and keep related variables in an appropriate table.

The reason for this approach is that it's more flexible and easily understandable by other users. Also, if the variables are separated - you can easily manipulate and fetch each individual varaible.

At login internal event, you could fetch the required variables and then populate the user's variables with the data.
Smartfox's forum is my daily newspaper.
agrios
Posts: 18
Joined: 20 Oct 2010, 20:42

Post by agrios »

Thank you BigFish!

I feel like it is easier faster and safer for java extension to get data once,
and manipulate variables on the server side to my heart content
then to fetch several variables between server - client.

I think like this: server side extension gets data from H2, selects and manipulates it. Then prepares response, packs it and sends once BUM!
We have basically two calls: one request and one response. Well, and one call from java extension to H2.

Whole process is understandable only to somebody who has access to
java class on server side.

Am I doing some mistake here?
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

There's no problem with what you're doing.

I even use your approach some times. For example, I store a unique string to represent what each user owns in terms of avatar. It wouldn't make sense to have 1000 columns - one for each avatar where it would be more ideal to store the whole thing inside one column.

There's no prefect solution for everything. So if you think you should store it inside one column, go for it.
Smartfox's forum is my daily newspaper.
Post Reply